Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // In response to a Yahoo Answer's question
- session_start();
- $username = $_POST['username'];
- $password = $_POST['password'];
- if ($username && $password){
- $connect = mysql_connect("localhost", "par24_user", "*password*") or die("Couldn't Connect!");
- mysql_select_db("par24_user")or die ("Couldn't find db!");
- $username = mysql_real_escape_string($username);
- $password = md5($password);
- $result = mysql_query( "SELECT username FROM user WHERE username='" . $username . "' AND password='" . $password . "' LIMIT 1");
- if($result && mysql_num_rows($result) > 0){
- $_SESSION['username'] = mysql_fetch_object($result)->username;
- echo "You've Logged on! <a href='member.php'</a> Click here to eneter member page.";
- }else{
- echo 'Invalid Username/Password Combination. <a href="' . $_SERVER['HTTP_REFERER'] . '">Click To Return</a>';
- }
- } else {
- die ("Please enter a username and password!");
- }
- ?
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement