linea21-core
[ class tree: linea21-core ] [ index: linea21-core ] [ all elements ]

Source for file login.php

Documentation is available at login.php

  1. <?php
  2. /**
  3.  * @package linea21.core
  4.  * @subpackage admin
  5.  * @author linea21 <info@linea21.com>
  6.  * @version $id SVN
  7.  * @access public
  8.  * @license http://opensource.org/licenses/gpl-3.0.html
  9.  */
  10.  
  11. include_once("../config/define.php");
  12. include_once("../lib/no_cache.php");
  13. include_once('../languages/' U_L '/lang_common.'CHARSET .'.php');
  14. include_once("../class/system/class." SQL ".php");
  15.  
  16.  
  17. include_once(SQL ".inc.php");
  18.  
  19. // if page var is not empty we pass the reference to the form
  20. if(isset($_REQUEST['page'])) $page $_REQUEST['page'];
  21. else $page 'index.php';
  22.  
  23. // check if session is not expired
  24. // do comment for more security
  25. if($l21auth->isActive()) {
  26.     header("Location: ".$page);
  27. }
  28.  
  29. // ////////////////////////////////////
  30. // TENTATIVE D'AUTHENTIFICATION
  31. // ////////////////////////////////////
  32. if (isset($_POST['valid'])) {
  33.     
  34.     if(isset($_POST['rememberme'])) {
  35.         $rememberme true;
  36.     else {
  37.         $rememberme false;
  38.     }
  39.  
  40.   $auth_res $l21auth->logIn($_POST['login']$_POST['password']'ADMIN'$rememberme);
  41.  
  42.   if ($auth_res === true{
  43.     // if page var is not empty we reconnect to the given page
  44.     if(!empty($_POST['page'])) {
  45.       $goto $_POST['page'];
  46.       header("Location: ".$goto);
  47.       exit();
  48.     }
  49.  
  50.     // else we reconnect to the last page (stored in cookie)
  51.     if(isset($_COOKIE['linea21_lastactivity']&& $_POST['login'== $_COOKIE['linea21_lastuser']{
  52.       $goto $_COOKIE['linea21_lastpage'];
  53.       // up to 3 hours of inactivity, we send the user to the latest consulted page
  54.       $lastcon_date = (integer) date("YmdGi"$_COOKIE['linea21_lastactivity']);
  55.       $buffer_date $lastcon_date (60);
  56.  
  57.       $current_date = (integer) date('YmdGi'time());
  58.       if($current_date $buffer_date && isset($_COOKIE['linea21_lastpage'])) {
  59.         header("Location: ".$goto);
  60.         exit();
  61.       else {
  62.         header("Location: index.php");
  63.         exit();
  64.       }
  65.     }
  66.     else {
  67.       header("Location: index.php");
  68.       exit();
  69.     }
  70.   }
  71.  
  72. }
  73.  
  74. include_once(THEME_ADMIN_PATH."login.php");
  75.  
  76. $sql_object -> DBClose();
  77. if(isset($Dbg)) $Dbg->display();
  78. ?>

Documentation generated on Thu, 20 Mar 2014 16:48:43 +0100 by phpDocumentor 1.4.1