Guest User

Untitled

a guest
Mar 13th, 2018
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.69 KB | None | 0 0
  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.   $query = "SELECT post_count FROM cms_users WHERE username = '".$username."' AND password = '".$password."'";
  15.   $result = mysql_query($query);
  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.     print "Welcome ".$username."<br>";
  25.   }
  26.   // close the connection to the database
  27.   mysql_close($con);
  28. ?>
  29. </body>
  30. </html>
Add Comment
Please, Sign In to add comment