Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- session_start();
- $username = $_POST['username'];
- $password = $_POST['password'];$myusername = stripslashes($username);$mypassword = stripslashes($password);
- if ($myusername&&$mypassword)
- {
- $connect = mysql_connect("","","") or die("Could not connect...");
- mysql_select_db("") or die("Could not connect to the DB");
- $query = mysql_query("SELECT * FROM names WHERE Username='$myusername'");
- $nunrows = mysql_num_rows($query);
- if (!$numrows=0)
- {
- while ($row = mysql_fetch_assoc($query))
- {
- $dbusername = $row['Username'];
- $dbpassword = $row['Password'];
- }
- if ($myusername==$dbusername&&$mypassword==$dbpassword)
- {
- echo "You have logged in! <a href='member.php'>Click</a> here to view the members page!";
- $_SESSION['username']=$dbusername;
- }
- else
- echo "Incorrect password!";
- }
- else
- die("Username doesn't exist! Please register on the server!");
- }
- else
- die("Please enter a Username and a Password");
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement