Guest User

go home you are drunk

a guest
Jul 5th, 2018
36
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.21 KB | None | 0 0
  1. <?php
  2.  
  3.     error_reporting( ~E_DEPRECATED & ~E_NOTICE );
  4.     define('DBHOST','localhost');
  5.     define('DBUSER','id6394283_tarank');
  6.     define('DBPASS','tarank');
  7.     define('DBNAME','id6394283_db');
  8.    
  9.     $con=mysqli_connect(DBHOST,DBUSER,DBPASS) or die("cannot connect");
  10.     $dbcon=mysqli_select_db($con,DBNAME) or die("cannot select DB");
  11.     if(!$con)
  12.     {
  13.         echo "error connection";
  14.     }
  15.     ?>
  16.     <html>
  17.         <head>SQL</head>
  18.         <body>
  19.             <form method="post">
  20.                 <input type="text" name="username" placeholder="Username"><br>
  21.                 <input type="text" name="password" placeholder="Password"><br>
  22.                 <input type="submit" name="submit">
  23.             </form>
  24.         <?php
  25.         if(isset($_POST["submit"]))
  26.         {
  27.             $username=$_POST["username"];
  28.             $password=$_POST["password"];
  29.             $query="select *from tb1 where(username='$username') and (password='$password')";
  30.            
  31.             $result=mysqli_query($con,$query);
  32.             if(mysqli_num_rows($reult)==1)
  33.             {
  34.                 echo "Login Accepted";
  35.             }
  36.             else
  37.             {
  38.                 echo "Login Rejected";
  39.             }
  40.            
  41.         }
  42.         ?>
  43.         </body>
  44.     </html>
Add Comment
Please, Sign In to add comment