Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <head>
- <title></title>
- </head>
- <body>
- <form method="POST">
- Username: <input type="text" name="username"></br>
- Password: <input type="password" name="password"></br>
- <input type="submit" value="Log in" name='log'></br>
- </form>
- </body>
- </html>
- <?php
- if(isset($_POST['log']))
- {
- $username = $_POST['username'];
- $password = $_POST['password'];
- if (isset($username) && isset($password))
- {
- $connection = mysql_connect("localhost", "stu12985_db1", "3ooM6eBC");
- $database = "stu12985_db1";
- mysql_select_db($database,$connection);
- $query = mysql_query("SELECT * FROM users WHERE username='$username'");
- $numrow = mysql_num_rows($query);
- echo "Num: ".$numrow;
- if ($numrow > 0)
- {
- while ($row = mysql_fetch_assoc($query))
- {
- $dbusername = $row['username'];
- $dbpassword = $row['password'];
- if ($username==$dbusername&&$password==$dbpassword)
- {
- echo "You have logged in succesfully!";
- }
- else
- {
- echo "Incorrect Pass.!";
- }
- }
- }
- else
- {
- echo "oebele";
- }
- }
- else
- {
- echo "Enter an username and a password";
- }
- }
- ?>
Add Comment
Please, Sign In to add comment