daily pastebin goal
34%
SHARE
TWEET

Untitled

a guest Mar 13th, 2018 99 Never
Upgrade to PRO!
ENDING IN00days00hours00mins00secs
 
  1. <html>
  2. <body>
  3. <?php
  4.  
  5.   // connect to the mysql database
  6.   $con = mysql_connect("127.0.0.1","root","seedubuntu");
  7.   mysql_select_db("test_cms", $con);
  8.  
  9.   // get the user data
  10.   $username = $_POST['user'];
  11.   $password = $_POST['password'];
  12.  
  13.   // query the database
  14.   $sql = "SELECT * FROM users WHERE username = '".$username."' AND password = '".$password."'";  
  15.   $result = mysql_query($sql);
  16.   $number_of_results = mysql_num_rows($result);
  17.  
  18.   if ($number_of_results == 0)
  19.   {
  20.       print "Wrong username/password <br>";
  21.   }
  22.   else
  23.   {
  24.     $row = mysql_fetch_array($result);
  25.     print "Welcome ".$row['username']."! You are logged in.<br>";
  26.   }
  27.   // close the connection to the database
  28.   mysql_close($con);
  29. ?>
  30. </body>
  31. </html>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top