fix 'su' on admin-traffic overview, thx Sephi

Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
This commit is contained in:
Michael Kaufmann (d00p)
2013-11-11 09:59:03 +01:00
parent a97c24634b
commit 101d972a14
5 changed files with 12 additions and 56 deletions

View File

@@ -55,55 +55,6 @@ $months = array(
if ($page == 'overview' || $page == 'customers') {
if ($action == 'su' && $id != 0) {
$result_stmt = Database::prepare("
SELECT * FROM `" . TABLE_PANEL_CUSTOMERS . "`
WHERE `customerid` = :id" .
($userinfo['customers_see_all'] ? '' : " AND `adminid` = :adminid")
);
$params = array('id' => $id);
if ($userinfo['customers_see_all'] == '0') {
$params['adminid'] = $userinfo['adminid'];
}
Database::pexecute($result_stmt, params);
$result = $result_stmt->fetch(PDO::FETCH_ASSOC);
if ($result['loginname'] != '') {
$result2_stmt = Database::prepare("
SELECT * FROM `" . TABLE_PANEL_SESSIONS . "`
WHERE `userid` = :id"
);
Database::pexecute($result2_stmt, array('id' => $userinfo['userid']));
$result2 = $result2_stmt->fetch(PDO::FETCH_ASSOC);
$s = md5(uniqid(microtime(), 1));
$ins_stmt = Database::prepare("
INSERT INTO `" . TABLE_PANEL_SESSIONS . "` SET
`hash` = :hash,
`userid` = :id,
`ipaddress` = :ip,
`useragent` = :ua,
`lastactivity` = :la,
`language` = :lang,
`adminsession` = '0'
");
$ins_data = array(
'hash' => $s,
'id' => $id,
'ip' => $result['ipaddress'],
'ua' => $result['useragent'],
'la' => time(),
'lang' => $result['language']
);
Database::pexecute($ins_stmt, $ins_data);
redirectTo('customer_traffic.php', array('s' => $s));
} else {
redirectTo('index.php', array('action' => 'login'));
}
}
$customerview = 1;
$stats_tables = '';
$minyear_stmt = Database::query("SELECT `year` FROM `". TABLE_PANEL_TRAFFIC . "` ORDER BY `year` ASC LIMIT 1");