Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <body>
- <?php
- // connect to the mysql database
- $con = mysql_connect("127.0.0.1","root","seedubuntu");
- mysql_select_db("test_cms", $con);
- // get the user data
- $username = $_POST['user'];
- $password = $_POST['password'];
- // query the database
- $sql = "SELECT * FROM cms_users WHERE username = '".$username."' AND password = '".$password."'";
- $result = mysql_query($sql);
- $number_of_results = mysql_num_rows($result);
- if ($number_of_results == 0)
- {
- print "Wrong username/password <br>";
- }
- else
- {
- $row = mysql_fetch_array($result);
- print "Welcome ".$row['username']."! You are logged in.<br>";
- }
- // close the connection to the database
- mysql_close($con);
- ?>
- </body>
- </html>
Add Comment
Please, Sign In to add comment