trewq343

Untitled

Jan 9th, 2012
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.11 KB | None | 0 0
  1. ------------------------[ Login.php ]------------------------
  2. <?php
  3. // Connection details
  4. $dbhost = "host"; //!! localhost or the ip of the server
  5. $dbname = "dbname"; //!! name of the database
  6. $dbuser = "user"; //!! username
  7. $dbpass = "pass"; //!! password
  8.  
  9. $user = addslashes($_GET['username']);
  10. $pass = addslashes($_GET['password']);
  11.  
  12. mysql_connect($dbhost, $dbuser, $dbpass)or die("3");
  13. $verb = mysql_select_db($dbname);
  14.  
  15. if ($verb)
  16. {
  17. $sql = "SELECT * FROM login WHERE username='".$user."'";
  18. $quer = mysql_query($sql) or die("4");
  19. $num = mysql_num_rows($quer);
  20. if ($num == 0)
  21. {
  22. echo("0");
  23. exit();
  24. }
  25. else
  26. {
  27. $row = mysql_fetch_object($quer);
  28. $passwort = $row->password;
  29. if ($passwort == $pass)
  30. {
  31. echo("1");
  32. exit();
  33. }
  34. else
  35. {
  36. echo("2");
  37. exit();
  38. }
  39. }
  40. }
  41. mysql_close();
  42. ?>
  43.  
  44.  
  45. ------------------------[ SQL Query ]------------------------
  46. -- phpMyAdmin SQL Dump
  47. -- http://www.phpmyadmin.net
  48. -- --
  49.  
  50. CREATE TABLE `login` (
  51. `username` text collate latin1_german1_ci NOT NULL,
  52. `password` text collate latin1_german1_ci NOT NULL,
  53. FULLTEXT KEY `password` (`password`)
  54. ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_german1_ci;
  55.  
  56. --
  57. -- Data
  58. --
  59.  
  60. INSERT INTO `login` VALUES ('test123', 'e99a18c428cb38d5f260853678922e03');
  61.  
  62. ------------------------[ VB.net Section ]------------------------
  63. Imports System.Security.Cryptography
  64. Imports System.Management
  65. Imports System.Text
  66.  
  67. ' in the class
  68. Dim myhwid As String 'we need this later for our HWID
  69.  
  70. Private Function MD5_Encode(ByVal strString As String) As String 'This function encrypts our HWID to a MD5 hash
  71. Dim MD5 As New MD5CryptoServiceProvider
  72. Dim Data As Byte()
  73. Dim Result As Byte()
  74. Dim Res As String = ""
  75. Dim Tmp As String = ""
  76.  
  77. Data = Encoding.ASCII.GetBytes(strString)
  78. Result = MD5.ComputeHash(Data)
  79. For i As Integer = 0 To Result.Length - 1
  80. Tmp = Hex(Result(i))
  81. If Len(Tmp) = 1 Then Tmp = "0" & Tmp
  82. Res += Tmp
  83. Next
  84. Return Res.ToLower
  85. End Function
  86.  
  87. 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
  88. Dim out As String = ""
  89. Try
  90. Dim searcher As New ManagementObjectSearcher( _
  91. "root\CIMV2", _
  92. "SELECT * FROM Win32_Processor")
  93. For Each queryObj As ManagementObject In searcher.Get()
  94. out &= queryObj("ProcessorId").ToString
  95. Next
  96. Catch : End Try
  97. Try
  98. Dim searcher As New ManagementObjectSearcher( _
  99. "root\CIMV2", _
  100. "SELECT * FROM Win32_VideoController")
  101. For Each queryObj As ManagementObject In searcher.Get()
  102. out &= "-" & queryObj("AdapterRAM").ToString
  103. Next
  104. Catch : End Try
  105. Try
  106. Dim searcher As New ManagementObjectSearcher( _
  107. "root\CIMV2", _
  108. "SELECT * FROM Win32_DiskDrive")
  109. For Each queryObj As ManagementObject In searcher.Get()
  110. out &= "-" & queryObj("Size").ToString
  111. Next
  112. Catch : End Try
  113. Return out
  114. End Function
  115.  
  116. 'load event
  117. myhwid = MD5_Encode(ID)
  118.  
  119.  
  120. ' Login Button
  121. Try
  122. Dim WC As New Net.WebClient
  123. 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
  124. Select Case response
  125. Case 0
  126. MsgBox("User does not exist!", MsgBoxStyle.Exclamation)
  127. Case 1
  128. Dim hwid As String = WC.DownloadString("http://www.yourwebsite.com/dir/hwid.txt") '!! EDIT HERE WEBSITE URL ; Checking the HWID
  129. If hwid.Contains(myhwid) = True Then
  130. MsgBox("Success!", MsgBoxStyle.Information)
  131. ' Login successful
  132. Else
  133. MsgBox("Wrong hwid!", MsgBoxStyle.Exclamation)
  134. End If
  135. Case 2
  136. MsgBox("Wrong password!", MsgBoxStyle.Exclamation)
  137. Case 3
  138. MsgBox("Unable to connect to database!", MsgBoxStyle.Critical)
  139. Case 4
  140. MsgBox("Could not find table!", MsgBoxStyle.Critical)
  141. End Select
  142. Catch
  143. MsgBox("Could not connect to server!", MsgBoxStyle.Critical)
  144. End Try
  145.  
  146. '
Advertisement
Add Comment
Please, Sign In to add comment