noalyss Version-9
login.php
Go to the documentation of this file.
1<?php
2/*
3 * This file is part of NOALYSS.
4 *
5 * NOALYSS is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * NOALYSS is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with NOALYSS; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18*/
19// Copyright Author Dany De Bontridder danydb@aevalys.eu
20require_once '../include/constant.php';
21
22require_once NOALYSS_INCLUDE.'/lib/ac_common.php';
23MaintenanceMode("block.html");
24
25/*! \file
26 * \brief Login page
27 */
28
29
30// Verif if User and Pass match DB
31 // if no, then redirect to the login page
33
34if (defined('MULTI') && MULTI == 0)
35 $version = $rep->get_value('select val from repo_version');
36 else
37 $version = $rep->get_value('select val from version');
38
40
41if ( isset ($_POST["p_user"] ) )
42{
43 $http=new HttpInput();
44
45 // clean OLD session
46 Noalyss_user::clean_session($http->post("p_user"));
47 $User=new Noalyss_user($rep);
48 $User->Check(false,'LOGIN');
49
50
51 /*
52 * Check repository version
53 */
54
56 {
57 echo html_page_start();
58 echo h1(_("Version base de donneés incorrecte"));
59 echo span(_('Un instant svp'));
60 echo alert(_('Version de base de données incorrectes, vous devez mettre à jour'));
61 echo "<META HTTP-EQUIV=\"REFRESH\" content=\"3;url=admin-noalyss.php??action=upgrade&sb=database\">";
62 exit();
63 }
64 if (defined('NOALYSS_CAPTCHA') && NOALYSS_CAPTCHA==true)
65 {
66 include("securimage/securimage.php");
67 $img = new Securimage();
68 $valid = $img->check($_POST['captcha_code']);
69 if ( $valid == false )
70 {
71 echo alert(_('Code invalide'));
72 echo "<META HTTP-EQUIV=\"REFRESH\" content=\"0;url=index.php\">";
73 exit();
74 }
75 }
76 if ($User->get_access_mode()=='PC')
77 {
78 // force the nocache
79 $backurl='user_login.php?v='.microtime(true);
80 if ( isset ($_POST['backurl'])) {
81 $backurl=urldecode($_POST['backurl']);
82 }
83 echo "<META HTTP-EQUIV=\"REFRESH\" content=\"0;url={$backurl}\">";
84 exit();
85 } else {
86 echo "<META HTTP-EQUIV=\"REFRESH\" content=\"0;url=mobile.php\">";
87 exit();
88 }
89}
90else
91{
92 $rep=new Database();
93
94 /*
95 * Check repository version
96 */
97
98 if ( $version != DBVERSIONREPO)
99 {
100 echo html_page_start();
101 echo h1(_("Version base de donneés incorrecte"));
102 echo span(_('Un instant svp'));
103 echo alert(_('Version de base de données incorrectes, vous devez mettre à jour'));
104 echo "<META HTTP-EQUIV=\"REFRESH\" content=\"3;url=admin-noalyss.php?action=upgrade&sb=database\">";
105 exit();
106
107 }
108
109 $User=new Noalyss_user($rep);
110 $User->Check();
111
112 echo "<META HTTP-EQUIV=\"REFRESH\" content=\"0;url=user_login.php?v=".microtime(true)."\">";
113}
115?>
MaintenanceMode($p_file)
When you want to prevent users to connect, create a file in noalyss/ (NOALYSS_BASE) with the message ...
Definition: ac_common.php:1663
span($p_string, $p_extra='')
Definition: ac_common.php:43
html_page_stop()
end tag
Definition: ac_common.php:468
html_page_start($p_theme="", $p_script="", $p_script2="")
Default page header for each page.
Definition: ac_common.php:275
h1($p_string, $p_class="")
Definition: ac_common.php:72
alert($p_msg, $buffer=false)
alert in javascript
Definition: ac_common.php:738
contains the class for connecting to Noalyss
manage the http input (get , post, request) and extract from an array
const DBVERSIONREPO
Definition: constant.php:37
$_POST['ac']
Definition: do.php:310
$img
for($e=0; $e< count($afiche); $e++) exit
else $version
Definition: login.php:37
$http
Definition: login.php:39
if( $version !=DBVERSIONREPO) $User
Definition: login.php:109
$rep
Definition: login.php:32
Project: Securimage: A PHP class for creating and managing form CAPTCHA images File: securimage....
$valid
Definition: recover.php:57