Guest User

Untitled

a guest
Jan 12th, 2018
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1. <?php
  2. /* These are our valid username and passwords */
  3. $user = 'test';
  4. $pass = '123456';
  5.  
  6. if (isset($_POST['username']) && isset($_POST['password')) {
  7.  
  8. if (($_POST['username'] == $user) && ($_POST['password'] == $pass)) {
  9.  
  10. if (isset($_POST['rememberme'])) {
  11. /* Set cookie to last 1 year */
  12. setcookie('username', $_POST['username'], time()+31536000);
  13. setcookie('password', md5($_POST['password']), time()+31536000);
  14. echo 'rememberme set <br />';
  15. } else {
  16. /* Cookie expires when browser closes */
  17. setcookie('username', $_POST['username'], 0);
  18. setcookie('password', md5($_POST['password']), 0);
  19. echo 'rememberme not set <br />';
  20. }
  21. //header('Location: cookie.php');
  22. echo 'post submit <br />';
  23. } else {
  24. echo 'Username/Password Invalid';
  25. }
  26.  
  27. } else {
  28. echo 'You must supply a username and password.';
  29. }
  30. echo '<br /> End of file';
  31. ?>
Add Comment
Please, Sign In to add comment