Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- include ("index.htm");
- session_start();
- include 'forum/connect.php';
- $username = $_POST['username'];
- $password = $_POST['password'];
- if ($username && $password)
- {
- $sql = "SELECT * FROM users WHERE username='$username'";
- $query = mysqli_query($link, $sql);
- $numrows = mysqli_num_rows($query);
- echo 'num rows: ' . $numrows . ' mysql_error . ' . mysqli_error($link); die();
- if ($numrows!=0)
- {
- while ($row = mysqli_fetch_assoc($query))
- {
- $dbusername = $row['username'];
- $dbpassword = $row['password'];
- }
- // Check to see if they match!
- if ($username==$dbusername&&md5 ($password==$dbpassword))
- {
- echo 'Successfully Logged in! <a href="member.php">Click here to enter the member page!</a>';
- $_SESSION['username']=$username;
- $_SESSION['id'] = $row['id'];
- $_SESSION['username'] = $row['username'];
- $_SESSION['password'] = $row['password'];
- $_SESSION['email'] = $row['email'];
- }
- else
- {
- echo "Incorrect Password!";
- }
- }
- else
- die("That user does not exist!");
- }
- else
- die("Please enter a username and a password");
- ?>
Add Comment
Please, Sign In to add comment