Advertisement
Guest User

Untitled

a guest
Apr 17th, 2018
187
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.53 KB | None | 0 0
  1. <?php
  2. session_start();
  3.  
  4. $userinfo = array(
  5.                 'admin'=>'admin',
  6.                 'user2'=>'password2',
  7.                 'Kek'=>'Lol'
  8.                 );
  9.  
  10. if(isset($_GET['logout'])) {
  11.     $_SESSION['username'] = '';
  12.     header('Location:  ' . $_SERVER['PHP_SELF']);
  13. }
  14.  
  15. if(isset($_POST['username'])) {
  16.     if($userinfo[$_POST['username']] == $_POST['password']) {
  17.         $_SESSION['username'] = $_POST['username'];
  18.     }else {
  19.        
  20.     }
  21. }
  22. ?>
  23. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  24.         "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  25. <html xmlns="http://www.w3.org/1999/xhtml">
  26. <head>
  27.     <meta charset="utf-8">
  28.     <link rel="stylesheet" type="text/css" href="../css/sign.css">
  29.     <link rel="stylesheet" type="text/css" href="../css/bootstrap.min.css">
  30.     <title>Login</title>
  31. </head>
  32.     <body>
  33.  
  34.         <?php if($_SESSION['username']): ?>
  35.             <h2 class="yomama" ">Результат</h2>
  36.             <h2 class="yomama"><a href="?logout=1">Logout</a></h2>
  37.            
  38.         <?php endif; ?>
  39.  
  40.  
  41.  
  42.        
  43.  
  44.  
  45. <form name="Login" class="form-signin" action="" method="post">
  46.                <input type="text" class="form-control" name="username" placeholder="Username" required="" autofocus="" value="" />
  47.  
  48.               <input type="password" class="form-control" name="password" placeholder="Password" required="" value="" />
  49.             <input class="btn btn-lg btn-primary btn-block" type="submit"
  50.             value="Submit" />
  51.  
  52.         </form>
  53.     </body>
  54. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement