Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- session_start();
- include('index-redirect.php');
- include('header.php');
- if ($user)
- {
- die("You're already logged in! You are being redirected to the home page. If you are not redirected, <a href='index.php'>click here</a>.");
- }
- else
- $username = $_POST['username'];
- $password = $_POST['password'];
- if ($username&&password)
- {
- $connect = mysql_connect("localhost","sourpic_sourvid","sourvid") or die("Couldn't connect to the database - Please try again later.");
- mysql_select_db("sourpic_sourvid") or die("Couldn't find the database.");
- $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'];
- $verifyed = $row['valid'];
- }
- //check to see if they match!
- if (strtolower($username)==$dbusername&&md5($password)==$dbpassword&&$valid=1)
- {
- echo "You're in! You are now being redirected to the home page. If you are not redirected, <a href='index.php'>click here</a>.";
- $_SESSION['username']=strtolower($username);
- }
- else
- echo "Incorrect password!";
- }
- else
- die("That user doesn't exist!");
- }
- else
- die("Please enter a username and password!");
- include('footer.php');
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement