auth->check_module_permissions('admin');
/* for security reasons ONLY the admin can login as other user */
if ($_SESSION["s"]["user"]["typ"] != 'admin') {
die ("You don't have the right to login as other user!");
}
/* get the id of the user (must be int!) */
if (!isset($_GET['id'])){
die ("No user selected!");
}
$userId = intval($_GET['id']);
/*
* Get the data to login as user x
*/
$dbData = $app->db->queryOneRecord(
"SELECT username, passwort FROM sys_user WHERE userid = " . $userId);
/*
* Now generate the login-Form
*/
echo '
Do you want to login as user ' . $dbData['username'] . '?
If you do so, you can "go back" by clicking at logout.