Advertisement
Guest User

Untitled

a guest
Oct 14th, 2017
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.42 KB | None | 0 0
  1. [align=center]What you will need:
  2. A basic understand of PHP and VB.net.
  3. A webhost / vps to host the PHP scripts on
  4. An mysql database
  5.  
  6.  
  7. Start:
  8.  
  9. Setting Up The Database:
  10.  
  11. First things first you will need to create a new database. After creating the database insert a new table called "users" with 2 columns name these 2 columns "username" and "password"
  12.  
  13. The PHP scripts:
  14.  
  15. You will need to create 2 new files, config.php and login.php
  16. Config.php
  17. [php]
  18. <?php
  19. $connection = mysqli_connect('localhost', 'username', 'password');
  20. if (!$connection){
  21. die("Database Connection Failed" . mysqli_error($connection));
  22. }
  23. $select_db = mysqli_select_db($connection, 'database name');
  24. if (!$select_db){
  25. die("Database Selection Failed" . mysqli_error($connection));
  26. }
  27. ?>
  28.  
  29. [/php]
  30.  
  31. Login.php
  32. [php]
  33. <?php
  34. include "config.php";
  35. $username = htmlspecialchars(mysqli_real_escape_string($connection, $_GET['username']));
  36. $password = htmlspecialchars(mysqli_real_escape_string($connection, $_GET['password']));
  37.  
  38. $query = "SELECT * FROM `users` WHERE username='$username' and password='$password'";
  39.  
  40. $result = mysqli_query($connection, $query) or die(mysqli_error($connection));
  41. $count = mysqli_num_rows($result);
  42.  
  43. if ($count == 1){
  44. echo "Login.Success";
  45. }else{
  46. echo "Login.Failed";
  47. }
  48. ?>
  49. [/php]
  50.  
  51. Visual Basic:
  52. Create 2 new text boxes. Set the test to username and password (this is just a place holder)
  53.  
  54.  
  55.  
  56. [/align]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement