Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- session_start();
- include ("index.htm");
- 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);
- if ($numrows!=0)
- {
- while ($row = mysqli_fetch_assoc($query))
- {
- $dbusername = $row['username'];
- $dbpassword = $row['password'];
- }
- // Check to see if they match!
- if ($username==$dbusername&& sha1($password==$dbpassword))
- {
- echo 'Successfully Logged in! <a href="member.php">Click here to enter the member page!</a>';
- $_SESSION['signed_in'] = TRUE;
- $_SESSION['username'] = $username;
- $_SESSION['id'] = $row['id'];
- $_SESSION['username'] = $row['username'];
- $_SESSION['password'] = $row['password'];
- $_SESSION['email'] = $row['email'];
- $_SESSION['user_level'] = $row['user_level'];
- echo '<META HTTP-EQUIV="Refresh" Content="0; URL=index.php">';
- }
- 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