edition de checkid

cf commit [1806],[1804]
This commit is contained in:
Camille Lafitte 2007-09-09 20:49:56 +00:00
parent 4be66099c0
commit 8d7c15e924
2 changed files with 17 additions and 3 deletions

View File

@ -66,12 +66,17 @@ if (ini_get("safe_mode")) {
exit();
}
$error = "";
/* PHPLIB inclusions : */
$root="/var/alternc/bureau/";
/* Server Domain Name */
$host=getenv("HTTP_HOST");
/* Custom PHP debugger */
require_once($root."class/error_handler.php");
$queryCount = 0;
/* Global variables (AlternC configuration) */
require_once($root."class/local.php");
@ -79,6 +84,8 @@ require_once($root."class/db_mysql.php");
require_once($root."class/functions.php");
require_once($root."class/variables.php");
$tempsDebut = microtimeFloat();
// Redirection si appel à https://(!fqdn)/
if ($_SERVER["HTTPS"]=="on" && $host!=$L_FQDN) {
header("Location: https://$L_FQDN/");
@ -143,7 +150,14 @@ $err=new m_err();
/* Check the User identity (if required) */
if (!defined('NOCHECK')) {
if (!$mem->checkid()) {
$fields = array (
"username" => array ("request", "string", ""),
"password" => array ("request", "string", ""),
"restrictip" => array ("request", "integer", 0),
);
getFields($fields);
if (!$mem->checkid($username,$password,$restrictip)) {
$error=$err->errstr();
include("index.php");
exit();

View File

@ -161,8 +161,8 @@ class m_mem {
* @global string $username/password le login/pass de l'utilisateur
* @return TRUE si la session est correcte, FALSE sinon.
*/
function checkid() {
global $db,$err,$session,$username,$password,$cuid,$restrictip;
function checkid($username, $password, $restrictip) {
global $db,$err,$session,$cuid;
if ($username && $password) {
return $this->login($username,$password,$restrictip);
}