Advertisement
Guest User

Panel logowania

a guest
Jun 6th, 2016
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.21 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <?php
  3. //include config
  4. require_once('config.php');
  5.  
  6. //check if already logged in move to home page
  7. if( $user->is_logged_in() ){ header('Location: lista_tematow.php'); }
  8.  
  9. //process login form if submitted
  10. if(isset($_POST['submit'])){
  11.  
  12. $username = $_POST['username'];
  13. $password = $_POST['password'];
  14.  
  15. if($user->login($username,$password)){
  16. $_SESSION['username'] = $username;
  17. header('Location: lista_tematow.php');
  18. exit;
  19.  
  20. } else {
  21. $error[] = 'Wrong username or password or your account has not been activated.';
  22. }
  23.  
  24. }//end if submit
  25.  
  26. //define page title
  27. //$title = 'Login';
  28.  
  29. //include header template
  30. //require('layout/header.php');
  31. ?>
  32. <html>
  33. <head>
  34. <link rel="stylesheet" type="text/css" href="style.css">
  35. <title>Jokasta</title>
  36. <meta charset="UTF-8">
  37. <meta name="description" content="Jokasta">
  38. <meta name="keywords" content="Jokasta, Politechnika, Opolska, Opole">
  39. <meta name="author" content="Katarzyna Cybulska, Daniel Baranowski">
  40. <script src="http://code.jquery.com/jquery-1.12.4.js"></script>
  41. </head>
  42. <body>
  43. <div id="login">
  44. <h1 style="font-size: 80px; margin-top: 30vh;"><a href="index.php">Jokasta</a></h1>
  45. <!--<form class="form" action="logowanie.php" method="post">-->
  46. <form class="form" role="form" method="post" action="" autocomplete="off">
  47. <?php
  48. //check for any errors
  49. if(isset($error)){
  50. foreach($error as $error){
  51. echo '<p class="bg-danger">'.$error.'</p>';
  52. }
  53. }
  54.  
  55. if(isset($_GET['action'])){
  56.  
  57. //check the action
  58. switch ($_GET['action']) {
  59. case 'active':
  60. echo "<h2 class='bg-success'>Your account is now active you may now log in.</h2>";
  61. break;
  62. case 'reset':
  63. echo "<h2 class='bg-success'>Please check your inbox for a reset link.</h2>";
  64. break;
  65. case 'resetAccount':
  66. echo "<h2 class='bg-success'>Password changed, you may now login.</h2>";
  67. break;
  68. }
  69.  
  70. }
  71. ?>
  72. <input type="text" name="username" id="username" placeholder="Login" value="<?php if(isset($error)){ echo $_POST['username']; } ?>"><br>
  73. <input type="password" name="password" id="password" placeholder="Hasło"><br>
  74. <input type="submit" name="submit" value="Zaloguj">
  75. </form>
  76. </div>
  77. </body>
  78. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement