Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ------------------------[ Login.php ]------------------------
- <?php
- // Connection details
- $dbhost = "host"; //!! localhost or the ip of the server
- $dbname = "dbname"; //!! name of the database
- $dbuser = "user"; //!! username
- $dbpass = "pass"; //!! password
- $user = addslashes($_GET['username']);
- $pass = addslashes($_GET['password']);
- mysql_connect($dbhost, $dbuser, $dbpass)or die("3");
- $verb = mysql_select_db($dbname);
- if ($verb)
- {
- $sql = "SELECT * FROM login WHERE username='".$user."'";
- $quer = mysql_query($sql) or die("4");
- $num = mysql_num_rows($quer);
- if ($num == 0)
- {
- echo("0");
- exit();
- }
- else
- {
- $row = mysql_fetch_object($quer);
- $passwort = $row->password;
- if ($passwort == $pass)
- {
- echo("1");
- exit();
- }
- else
- {
- echo("2");
- exit();
- }
- }
- }
- mysql_close();
- ?>
- ------------------------[ SQL Query ]------------------------
- -- phpMyAdmin SQL Dump
- -- http://www.phpmyadmin.net
- -- --
- CREATE TABLE `login` (
- `username` text collate latin1_german1_ci NOT NULL,
- `password` text collate latin1_german1_ci NOT NULL,
- FULLTEXT KEY `password` (`password`)
- ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_german1_ci;
- --
- -- Data
- --
- INSERT INTO `login` VALUES ('test123', 'e99a18c428cb38d5f260853678922e03');
- ------------------------[ VB.net Section ]------------------------
- Imports System.Security.Cryptography
- Imports System.Management
- Imports System.Text
- ' in the class
- Dim myhwid As String 'we need this later for our HWID
- Private Function MD5_Encode(ByVal strString As String) As String 'This function encrypts our HWID to a MD5 hash
- Dim MD5 As New MD5CryptoServiceProvider
- Dim Data As Byte()
- Dim Result As Byte()
- Dim Res As String = ""
- Dim Tmp As String = ""
- Data = Encoding.ASCII.GetBytes(strString)
- Result = MD5.ComputeHash(Data)
- For i As Integer = 0 To Result.Length - 1
- Tmp = Hex(Result(i))
- If Len(Tmp) = 1 Then Tmp = "0" & Tmp
- Res += Tmp
- Next
- Return Res.ToLower
- End Function
- Private Function ID() 'Creates the HWID from the ProcessorID, Video Controller RAM and the size of the disk drive ; you can change this of course
- Dim out As String = ""
- Try
- Dim searcher As New ManagementObjectSearcher( _
- "root\CIMV2", _
- "SELECT * FROM Win32_Processor")
- For Each queryObj As ManagementObject In searcher.Get()
- out &= queryObj("ProcessorId").ToString
- Next
- Catch : End Try
- Try
- Dim searcher As New ManagementObjectSearcher( _
- "root\CIMV2", _
- "SELECT * FROM Win32_VideoController")
- For Each queryObj As ManagementObject In searcher.Get()
- out &= "-" & queryObj("AdapterRAM").ToString
- Next
- Catch : End Try
- Try
- Dim searcher As New ManagementObjectSearcher( _
- "root\CIMV2", _
- "SELECT * FROM Win32_DiskDrive")
- For Each queryObj As ManagementObject In searcher.Get()
- out &= "-" & queryObj("Size").ToString
- Next
- Catch : End Try
- Return out
- End Function
- 'load event
- myhwid = MD5_Encode(ID)
- ' Login Button
- Try
- Dim WC As New Net.WebClient
- Dim response As String = WC.DownloadString("http://www.yourwebsite.com/dir/login.php?username=" & TextBox1.Text & "&password=" & MD5_Encode(TextBox2.Text)) '!! EDIT HERE WEBSITE URL ; Downloading the response from our website
- Select Case response
- Case 0
- MsgBox("User does not exist!", MsgBoxStyle.Exclamation)
- Case 1
- Dim hwid As String = WC.DownloadString("http://www.yourwebsite.com/dir/hwid.txt") '!! EDIT HERE WEBSITE URL ; Checking the HWID
- If hwid.Contains(myhwid) = True Then
- MsgBox("Success!", MsgBoxStyle.Information)
- ' Login successful
- Else
- MsgBox("Wrong hwid!", MsgBoxStyle.Exclamation)
- End If
- Case 2
- MsgBox("Wrong password!", MsgBoxStyle.Exclamation)
- Case 3
- MsgBox("Unable to connect to database!", MsgBoxStyle.Critical)
- Case 4
- MsgBox("Could not find table!", MsgBoxStyle.Critical)
- End Select
- Catch
- MsgBox("Could not connect to server!", MsgBoxStyle.Critical)
- End Try
- '
Advertisement
Add Comment
Please, Sign In to add comment