Advertisement
Guest User

Untitled

a guest
Mar 4th, 2019
357
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.80 KB | None | 0 0
  1. <?php
  2. var_dump( $_POST);
  3. function Login($user,$pass){
  4. if($user != "biggun"|| $pass != "boom"){
  5. return false;
  6. }else{
  7. return true;
  8. }
  9. }
  10. if(!empty($_POST)){
  11. $user = $_POST['user'];
  12. $pass = $_POST['pass'];
  13.  
  14. if(Login($user, $pass)===true){
  15. $salt = "kill";
  16. $cookieVal = $user . "," . md5($user.$salt);
  17. setcookie("loggedin", $cookieVal,time()+60*60*24*30); //1maand
  18. header('Location: index.php');
  19. } else{
  20. $error = true;
  21. }
  22. }
  23. ?>
  24.  
  25.  
  26. <!DOCTYPE html>
  27. <html lang="en">
  28. <head>
  29. <meta charset="UTF-8">
  30. <title>Document</title>
  31. <link rel="stylesheet" href="css.css">
  32. </head>
  33. <body>
  34.  
  35. <div id="app">
  36. <form action="" method="post">
  37. <h1>Log in to Twitch</h1>
  38. <nav class="nav--login">
  39. <a href="#" id="tabLogin">Log in</a>
  40. <a href="#" id="tabSignIn">Sign up</a>
  41. </nav>
  42.  
  43. <?php if( isset($error) ): ?>
  44. <div class="alert hidden">That password was incorrect. Please try again</div>
  45. <?php endif; ?>
  46.  
  47. <div class="form form--login">
  48.  
  49. <label for="username">Username</label>
  50. <input type="text" id="username" name="user">
  51.  
  52. <label for="password">Password</label>
  53. <input type="password" id="password" name="pass">
  54.  
  55. </div>
  56.  
  57. <div class="form form--signup hidden">
  58. <label for="username2">Username</label>
  59. <input type="text" id="username2">
  60.  
  61. <label for="password2">Password</label>
  62. <input type="password" id="password2">
  63.  
  64. <label for="email">Email</label>
  65. <input type="text" id="email">
  66. </div>
  67.  
  68. <a href="#" class="btn" id="btnSubmit">Log In</a>
  69. </form>
  70. </div>
  71. </body>
  72. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement