Advertisement
Niko454

Untitled

Apr 18th, 2015
241
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. $check = mysql_query("SELECT * FROM users WHERE username = '$username'")or die(mysql_error());
  2.  
  3. while($info = mysql_fetch_array( $check ))
  4.  
  5. {
  6.  
  7.  
  8.  
  9. //if the cookie has the wrong password, they are taken to the login page
  10.  
  11. if ($password != $info['password'])
  12.  
  13. { header("Location: login_test.php");
  14.  
  15. }
  16.  
  17.  
  18.  
  19. //otherwise they are shown the admin area
  20.  
  21. else
  22.  
  23. {
  24.  
  25. echo "Admin Area<p>";
  26.  
  27. echo "Your Content<p>";
  28.  
  29. echo "<a href=logout.php>Logout</a>";
  30.  
  31. }
  32.  
  33. }
  34.  
  35. }
  36.  
  37. else
  38.  
  39.  
  40.  
  41. //if the cookie does not exist, they are taken to the login screen
  42.  
  43. {
  44.  
  45. header("Location: login_test.php");
  46.  
  47. }
  48.  
  49. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement