noalyss  Version-6.7.2
 All Data Structures Namespaces Files Functions Variables Enumerations
login.php
Go to the documentation of this file.
00001 <?php
00002 /*
00003  *   This file is part of NOALYSS.
00004  *
00005  *   NOALYSS is free software; you can redistribute it and/or modify
00006  *   it under the terms of the GNU General Public License as published by
00007  *   the Free Software Foundation; either version 2 of the License, or
00008  *   (at your option) any later version.
00009  *
00010  *   NOALYSS is distributed in the hope that it will be useful,
00011  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  *   GNU General Public License for more details.
00014  *
00015  *   You should have received a copy of the GNU General Public License
00016  *   along with NOALYSS; if not, write to the Free Software
00017  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00018 */
00019 // Copyright Author Dany De Bontridder danydb@aevalys.eu
00020 require_once '../include/constant.php';
00021 
00022 include_once ("ac_common.php");
00023 require_once('constant.php');
00024 
00025 /*! \file
00026  * \brief Login page
00027  */
00028 
00029 require_once('class_database.php');
00030 // Verif if User and Pass match DB
00031     // if no, then redirect to the login page
00032 $rep=new Database();
00033 
00034 if (defined('MULTI') && MULTI == 0)
00035                 $version = $rep->get_value('select val from repo_version');
00036         else
00037                 $version = $rep->get_value('select val from version');
00038 
00039 if (  isset ($_POST["p_user"] ) )
00040 {
00041     $g_user=sql_string($_POST["p_user"]);
00042     $g_pass=$_POST["p_pass"];
00043     $_SESSION['g_user']=$g_user;
00044     $_SESSION['g_pass']=$g_pass;
00045 
00046 
00047     /*
00048      * Check repository version
00049      */
00050 
00051         if ($version != DBVERSIONREPO)
00052         {
00053                 echo alert(_('Version de base de données incorrectes, vous devez mettre à jour'));
00054                 echo "<META HTTP-EQUIV=\"REFRESH\" content=\"0;url=admin/setup.php\">";
00055                 exit();
00056         }
00057         include_once ("class_user.php");
00058     $User=new User($rep);
00059     $User->Check(false,'LOGIN');
00060     if ($g_captcha == true)
00061       {
00062         include("securimage/securimage.php");
00063         $img = new Securimage();
00064         $valid = $img->check($_POST['captcha_code']);
00065         if ( $valid == false )
00066           {
00067             echo alert(_('Code invalide'));
00068             echo "<META HTTP-EQUIV=\"REFRESH\" content=\"0;url=index.php\">";
00069             exit();
00070           }
00071       }
00072     echo "<META HTTP-EQUIV=\"REFRESH\" content=\"0;url=user_login.php\">";
00073 
00074 }
00075 else
00076 {
00077     $rep=new Database();
00078 
00079     /*
00080      * Check repository version
00081      */
00082 
00083     if ( $version != DBVERSIONREPO)
00084       {
00085         echo alert(_('Version de base de données incorrectes, vous devez mettre à jour'));
00086         echo "<META HTTP-EQUIV=\"REFRESH\" content=\"1;url=admin/setup.php\">";
00087         exit();
00088 
00089       }
00090 
00091     include_once ("class_user.php");
00092 
00093     $User=new User($rep);
00094     $User->Check();
00095 
00096     echo "<META HTTP-EQUIV=\"REFRESH\" content=\"0;url=user_login.php\">";
00097 }
00098 html_page_stop();
00099 ?>
 All Data Structures Namespaces Files Functions Variables Enumerations