Advertisement
guitarman0831

Untitled

Jun 11th, 2011
1,152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.95 KB | None | 0 0
  1. <?php
  2.     session_start();
  3.    
  4.     $username = $_POST['username'];
  5.     $password = $_POST['password'];
  6.    
  7.     //Hash password in a new variable
  8.     $password2 = md5($password);
  9.    
  10.     require_once "/home/a7435766/public_html/scripts/dbconnect.php";
  11.    
  12.     $query = mysql_query("SELECT * FROM userstwo WHERE username = '$username' && password = '$password2'");
  13.    
  14.     if((mysql_num_rows($query)) != 0) {
  15.         //Store username and password in a cookie
  16.         if($_POST['remember'] == 'rememberme') {
  17.             setcookie("username",$username,time()+3600*24*5,'','.ohjustthatguy.com');
  18.             setcookie("password",$password,time()+3600*24*2,'','.ohjustthatguy.com');
  19.         } else {
  20.             setcookie("username","",time()-10,'','.ohjustthatguy.com');
  21.             setcookie("password","",time()-10,'','.ohjustthatguy.com');
  22.         }
  23.         $_SESSION['username'] = $username;
  24.         header('Location: http://www.ohjustthatguy.com/uploads/uploads.html');
  25.     } else {
  26.         header('Location: http://www.ohjustthatguy.com/uploads/');
  27.     }
  28. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement