Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- session_start();
- $username = $_POST["username"];
- $password = $_POST["password"];
- if (isset($username) && isset($password))
- {
- $connect = mysql_connect("localhost","root","usbw") or die("Couldn't connect!");
- mysql_select_db("phplogin") or die ("couldn't find db!");
- $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'];
- }
- // check to see if they match!
- if ($username==$dbusername&&$password==$dbpassword)
- {
- echo "You're in! <br><a href='member.php'>Click here</a> to enter the member page.";
- $_SESSION['username'] = $dbusername;
- }
- else
- {
- echo "Incorrect password!";
- }
- }
- else
- {
- die("That user doesn't exist!");
- }
- }
- else
- {
- die("Please enter and username and password!");
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement