Advertisement
adhieresthenes

Prolog.php

Jun 5th, 2017
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.93 KB | None | 0 0
  1. <?php
  2. include_once '../app/config/config.php';
  3. include_once '../app/general/Security.php';
  4. require("../app/securimage/Securimage.php");
  5.  
  6. $mysqli = new mysqli(HOST, USER, PASSWORD, DATABASE);
  7. if (mysqli_connect_errno()) {
  8.     printf("Error Connection\n", mysqli_connect_error());
  9.     exit;
  10. }
  11.  
  12.  
  13. sec_session_start(); // Our custom secure way of starting a PHP session.
  14.  
  15. if (isset($_POST['email'], $_POST['p'])) {
  16.     $email = $_POST['email'];
  17.     $password = $_POST['p']; // The hashed password.
  18.     $captcha = $_POST['captcha_code'];
  19.  
  20.     $img = new Securimage();
  21.  
  22.     if (login($email, $password, $mysqli) == true && $img->check($captcha) == true) {
  23.         // Login success
  24.         header('Location: ../admin/logged.php');
  25.     } else {
  26.         // Login failed
  27.         header('Location: index.php?error=1');
  28.     }
  29. } else {
  30.     // The correct POST variables were not sent to this page.
  31.     echo 'Invalid Request';
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement