Guest User

Untitled

a guest
Jun 24th, 2018
525
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2.   $servername = "localhost";  //replace your servername
  3.   $username = "root";   //replace your username
  4.   $password = "toor";        //replace your password
  5.   $dbname = "shop";    //replace your database name
  6.  
  7.   // Create connection
  8.    $conn = mysqli_connect($servername, $username, $password, $dbname);
  9.  
  10.  
  11.     if ( isset($_GET["user"]) and isset($_GET["password"]) )
  12.     {
  13.         $username = $_GET["user"];
  14.         $password = md5( $_GET["password"] );
  15.  
  16.         $val = "SELECT * FROM users WHERE name = '$username' and password = '$password'";
  17.     $test = mysqli_query( $conn, $val );
  18.  
  19.         if ( !$res = mysqli_query( $conn, $val ) )
  20.         {
  21.             echo "Error: Our query failed to execute and here is why: <br/>";
  22.             echo "Query: " . $val . "<br/>";
  23.             echo "Errno: " . $conn->errno . "<br/>";
  24.             echo "Error: " . $conn->error . "<br/>";
  25.         }
  26.         else
  27.         {
  28.             $data = $res->fetch_all();
  29.         if ( $data )
  30.                 echo "Your card number: " . $data[0][2];
  31.         else
  32.         echo "Login error!";        
  33. }
  34.     }
  35. ?>
  36.  
  37. <!DOCTYPE html>
  38. <html lang="en">
  39.     <head>
  40.         <title>Shop login</title>
  41.     </head>
  42.     <body>
  43.         <form action="" method="GET" class="form-signin">
  44.             <h2>Please login</h2>
  45.             <label for="user" class="sr-only">Username</label>
  46.             <input type="text" name="user" id="user" class="form-control" placeholder="Username" required="" autofocus=""><br/><br/>
  47.             <label for="password" class="sr-only">Password</label>
  48.             <input type="password" id="password" name="password" class="form-control" placeholder="Password" required=""><br/><br/>
  49.             <button class="btn btn-lg btn-primary btn-block" type="submit">Log in</button>
  50.         </form>
  51.     </body>
  52. </html>
RAW Paste Data