Advertisement
Guest User

Untitled

a guest
Jul 30th, 2015
216
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.50 KB | None | 0 0
  1. <?php
  2.  
  3.  
  4.  
  5. /*
  6.  
  7. * Copyright (C) 2013 peredur.net
  8.  
  9. *
  10.  
  11. * This program is free software: you can redistribute it and/or modify
  12.  
  13. * it under the terms of the GNU General Public License as published by
  14.  
  15. * the Free Software Foundation, either version 3 of the License, or
  16.  
  17. * (at your option) any later version.
  18.  
  19. *
  20.  
  21. * This program is distributed in the hope that it will be useful,
  22.  
  23. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  24.  
  25. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  26.  
  27. * GNU General Public License for more details.
  28.  
  29. *
  30.  
  31. * You should have received a copy of the GNU General Public License
  32.  
  33. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  34.  
  35. */
  36.  
  37.  
  38.  
  39. include_once 'db_connect.php';
  40.  
  41. include_once 'functions.php';
  42.  
  43.  
  44.  
  45. sec_session_start(); // Our custom secure way of starting a PHP session.
  46.  
  47.  
  48.  
  49. if (isset($_POST['email'], $_POST['p'])) {
  50.  
  51. $email = filter_input(INPUT_POST, 'email', FILTER_SANITIZE_EMAIL);
  52.  
  53. $password = $_POST['p']; // The hashed password.
  54.  
  55.  
  56.  
  57. if (login($email, $password, $mysqli) == true) {
  58.  
  59. // Login success
  60.  
  61. header("Location: ../protected_page.php");
  62.  
  63. exit();
  64.  
  65. } else {
  66.  
  67. // Login failed
  68.  
  69. header('Location: ../index.php?error=1');
  70.  
  71. exit();
  72.  
  73. }
  74.  
  75. } else {
  76.  
  77. // The correct POST variables were not sent to this page.
  78.  
  79. header('Location: ../error.php?err=Could not process login');
  80.  
  81. exit();
  82.  
  83. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement