From e1ceb050e19c7574bca146a8da7047ee4ff456b5 Mon Sep 17 00:00:00 2001
From: Marius Burkard <m.burkard@pixcept.de>
Date: Sun, 10 Jul 2016 05:02:35 -0400
Subject: [PATCH] Merge branch 'stable-3.1'
---
interface/web/login/login_as.php | 19 ++++++++++---------
1 files changed, 10 insertions(+), 9 deletions(-)
diff --git a/interface/web/login/login_as.php b/interface/web/login/login_as.php
index ed2dc9e..4b78c6c 100644
--- a/interface/web/login/login_as.php
+++ b/interface/web/login/login_as.php
@@ -54,13 +54,13 @@
$backlink = 'admin/users_list.php';
} else {
$client_id = $app->functions->intval($_GET['cid']);
- $tmp_client = $app->db->queryOneRecord("SELECT username, parent_client_id FROM client WHERE client_id = $client_id");
- $tmp_sys_user = $app->db->queryOneRecord("SELECT userid FROM sys_user WHERE username = '".$app->db->quote($tmp_client['username'])."'");
+ $tmp_client = $app->db->queryOneRecord("SELECT username, parent_client_id FROM client WHERE client_id = ?", $client_id);
+ $tmp_sys_user = $app->db->queryOneRecord("SELECT userid FROM sys_user WHERE username = ?", $tmp_client['username']);
$userId = $app->functions->intval($tmp_sys_user['userid']);
/* check if this client belongs to reseller that tries to log in, if we are not admin */
if($_SESSION["s"]["user"]["typ"] != 'admin') {
$client_group_id = $app->functions->intval($_SESSION["s"]["user"]["default_group"]);
- $client = $app->db->queryOneRecord("SELECT client.client_id FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
+ $client = $app->db->queryOneRecord("SELECT client.client_id FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = ?", $client_group_id);
if(!$client || $tmp_client["parent_client_id"] != $client["client_id"]) {
die("You don't have the right to login as this user!");
}
@@ -76,7 +76,7 @@
* Get the data to login as user x
*/
$dbData = $app->db->queryOneRecord(
- "SELECT username, passwort FROM sys_user WHERE userid = " . $userId);
+ "SELECT username, passwort FROM sys_user WHERE userid = ?", $userId);
/*
* Now generate the login-Form
@@ -92,13 +92,14 @@
'.$wb['login_2_txt'].'<br />
<div style="visibility:hidden">
<input type="text" name="username" value="' . $dbData['username'] . '" />
- <input type="password" name="passwort" value="' . $dbData['passwort'] .'" />
+ <input type="password" name="password" value="' . $dbData['passwort'] .'" />
</div>
- <input type="hidden" name="s_mod" value="login" />
- <input type="hidden" name="s_pg" value="index" />
+ <input type="hidden" name="s_mod" value="dashboard" />
+ <input type="hidden" name="s_pg" value="dashboard" />
+ <input type="hidden" name="login_as" value="1" />
<div class="wf_actions buttons">
- <button class="positive iconstxt icoPositive" type="button" value="'.$wb['btn_yes_txt'].'" onclick="submitLoginForm(' . "'pageForm'" . ');"><span>'.$wb['btn_yes_txt'].'</span></button>
- <button class="negative iconstxt icoNegative" type="button" value="'.$wb['btn_back_txt'].'" onclick="loadContent('. "'$backlink'" . ');"><span>'.$wb['btn_back_txt'].'</span></button>
+ <button class="btn btn-default formbutton-success" type="button" value="'.$wb['btn_yes_txt'].'" data-submit-form="pageForm" data-form-action="/login/index.php"><span>'.$wb['btn_yes_txt'].'</span></button>
+ <button class="btn btn-default formbutton-default" value="'.$wb['btn_back_txt'].'" data-load-content="'.$backlink.'"><span>'.$wb['btn_back_txt'].'</span></button>
</div>
';
?>
--
Gitblit v1.9.1