Posted By

fackz on 05/19/09


Tagged


Versions (?)

Who likes this?

4 people have marked this snippet as a favorite

fackz
phalkunz
aleksanderek
BrianCoyDesign


simple and basic login


 / Published in: PHP
 

  1. <?php
  2. if($_GET['acao']=="logar"){
  3. $senha = $_POST['pwd'];
  4. if($senha=="trielo"){
  5. $_SESSION['userName'] = "UserNameXXX";
  6. $_SESSION['HTTP_USER_AGENT'] = md5($_SERVER['HTTP_USER_AGENT']);
  7. header("Location: /home.php");
  8. exit;
  9. } else {
  10. echo "Senha incorreta!";
  11. }
  12.  
  13. }
  14. ?>
  15.  
  16. //other pages
  17.  
  18. <?php
  19. if((!$_SESSION['userName'])||($_SESSION['HTTP_USER_AGENT'] != md5($_SERVER['HTTP_USER_AGENT']))){
  20. header("Location: /");
  21. }
  22. ?>

Report this snippet  

You need to login to post a comment.