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");
// 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) {
__("This page is restricted to authorized staff");
exit();
@ -52,6 +75,7 @@ if (!$r=$admin->get($id))
}
else
{
setcookie('oldid',$cuid,0,'/admin/');
if (!$mem->setid($id))
{
$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" />
</head>
<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">
<table>
<tr>

View File

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

View File

@ -256,7 +256,7 @@ CREATE TABLE IF NOT EXISTS sub_domaines (
valeur varchar(255) default NULL,
type varchar(30) NOT NULL default 'LOCAL',
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',
PRIMARY KEY (compte,domaine,sub,type)
-- ,FOREIGN KEY (type) REFERENCES (domaines_type)