Corrige un bug

Ajoute le "retour en arriere" lorsqu'on usurpe un compte utilisateur.
This commit is contained in:
Alan Garcia 2011-03-04 12:29:37 +00:00
parent b17ab07b99
commit d5783b5c57
4 changed files with 34 additions and 1 deletions

View File

@ -29,6 +29,29 @@
*/ */
require_once("../class/config.php"); require_once("../class/config.php");
// If we just want to return to our previous session
$oldid=intval($_COOKIE['oldid']);
if ($oldid) {
setcookie('oldid','',0,'/admin/');
$db->query("select lastip from membres where uid='$oldid';");
$db->next_record();
if ($db->f("lastip") != getenv("REMOTE_ADDR") ) {
die('Error : bad IP address');
}
if (!$mem->setid($oldid))
{
$oldid=null;
$error=$err->errstr();
include("index.php");
exit();
}
$oldid=null;
include_once("main.php");
exit();
}
if (!$admin->enabled) { if (!$admin->enabled) {
__("This page is restricted to authorized staff"); __("This page is restricted to authorized staff");
exit(); exit();
@ -52,6 +75,7 @@ if (!$r=$admin->get($id))
} }
else else
{ {
setcookie('oldid',$cuid,0,'/admin/');
if (!$mem->setid($id)) if (!$mem->setid($id))
{ {
$error=$err->errstr(); $error=$err->errstr();

View File

@ -43,6 +43,14 @@ if (!$charset) $charset="iso-8859-1";
<link href="js/jquery_ui/css/smoothness/jquery-ui-1.8.6.custom.css" rel="stylesheet" type="text/css" /> <link href="js/jquery_ui/css/smoothness/jquery-ui-1.8.6.custom.css" rel="stylesheet" type="text/css" />
</head> </head>
<body> <body>
<?
$oldid=intval($_COOKIE['oldid']);
if ($oldid && $oldid!=$cuid) {
echo "<div align=center><p class='error'>";
__("Invited session. Clic <a href='adm_login.php'>here</a> to return to your previous session.");
echo "</p></div>";
}
?>
<div id="global"> <div id="global">
<table> <table>
<tr> <tr>

View File

@ -250,6 +250,7 @@ class m_mem {
$err->log("mem","del_session"); $err->log("mem","del_session");
$_COOKIE["session"]=addslashes($_COOKIE["session"]); $_COOKIE["session"]=addslashes($_COOKIE["session"]);
setcookie("session","",0,"/"); setcookie("session","",0,"/");
setcookie("oldid","",0,"/admin/");
if ($_COOKIE["session"]=="") { if ($_COOKIE["session"]=="") {
$err->error=0; $err->error=0;
return true; return true;

View File

@ -256,7 +256,7 @@ CREATE TABLE IF NOT EXISTS sub_domaines (
valeur varchar(255) default NULL, valeur varchar(255) default NULL,
type varchar(30) NOT NULL default 'LOCAL', type varchar(30) NOT NULL default 'LOCAL',
web_action enum ('OK','UPDATE','DELETE') NOT NULL default 'UPDATE', web_action enum ('OK','UPDATE','DELETE') NOT NULL default 'UPDATE',
dns_result varchar(255) not null default '', web_result varchar(255) not null default '',
enable enum ('ENABLED', 'ENABLE', 'DISABLED', 'DISABLE') NOT NULL DEFAULT 'ENABLED', enable enum ('ENABLED', 'ENABLE', 'DISABLED', 'DISABLE') NOT NULL DEFAULT 'ENABLED',
PRIMARY KEY (compte,domaine,sub,type) PRIMARY KEY (compte,domaine,sub,type)
-- ,FOREIGN KEY (type) REFERENCES (domaines_type) -- ,FOREIGN KEY (type) REFERENCES (domaines_type)