Guest User

Untitled

a guest
Jul 10th, 2018
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.08 KB | None | 0 0
  1. <?php
  2.  
  3. if(isset($_GET['action'])){
  4. $action = $_GET['action'];
  5. $actions = array('login', 'sercure');
  6. }else{
  7. $action = '';
  8. $actions = array('login', 'sercure');
  9. }
  10.  
  11. if(!isset($action) || !in_array($action, $actions)){
  12. echo '<a href="index.php?action=login">Login</a>';
  13. }else{
  14. if($action == 'login'){
  15. echo '<form method="post" action="">
  16. <input type="text" name ="username" /><br />
  17. <input type="password" name="password" /><br />
  18. <input type="submit" name="login" value="Login!" />
  19. </form>';
  20. if(isset($_POST['login'])){
  21. $username = $_POST['username'];
  22. $password = md5(sha1($_POST['password']));
  23. if($username == 'admin' && $password == md5(sha1('wezBB'))){
  24. $_SESSION['isLogged'] == 'true';
  25. header('Location: index.php?action=sercure');
  26. die;
  27. }
  28. }
  29. }
  30. if($action == 'sercure'){
  31. if($_SESSION['isLogged'] == 'true'){
  32. echo 'Logged In!';
  33. }
  34. }
  35. }
Add Comment
Please, Sign In to add comment