Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- session_start();
- $username = $_POST['username'];
- $password = $_POST['password'];
- if ($username&&$password)
- {
- $connect = mysql_connect("192.168.0.17","root","***************") or die ("Unable to connect to MySQL! Contact the admin.");
- mysql_select_db("login") or die ("Unable to find to database! Contact the admin.");
- $query = mysql_query("SELECT * FROM users WHERE username='$username'");
- $numrows = mysql_num_rows($query);
- if ($numrows !=0)
- {
- while ($row = mysql_fetch_assoc($query))
- {
- $dbusername = $row['username'];
- $dbpassword = $row['password'];
- }
- if ($username==$dbusername&&$password==$dbpassword)
- {
- echo "Logged in! <a href='membersarea'>click here to enter the members area</a>"
- $_SESSION['username']=$dbusername;
- }
- else
- echo "Incorrect username and/or password.";
- }
- else
- die ("Incorrect username and/or password.");
- }
- else
- die ("Please enter a username and password")
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement