<?php
require_once('inc/base.php');
require_once('inc/debug.php');
require_once('session/start.php');
require_once('su.php');
require_role(ROLE_SYSADMIN);
if (isset($_GET['type']))
{
check_form_token('su_su_ajax', $_GET['formtoken']);
$role = NULL;
$admin_user = $_SESSION['userinfo']['username'];
if ($_GET['type'] == 'customer') {
$role = find_role($_GET['id'], '', True);
setup_session($role, $_GET['id']);
} elseif ($_GET['type'] == 'systemuser') {
$role = find_role($_GET['uid'], '', True);
setup_session($role, $_GET['uid']);
} else {
system_failure('unknown type');
}
$_SESSION['admin_user'] = $admin_user;
header('Location: ../../go/index/index');
die();
}
if (isset($_POST['submit']))
{
check_form_token('su_su');
$id = (int) $_POST['destination'];
$role = find_role($id, '', True);
setup_session($role, $id);
header('Location: ../../go/index/index');
die();
}
title("Benutzer wechseln");
output('<p>Hiermit können Sie (als Admin) das Webinterface mit den Rechten eines beliebigen anderen Benutzers benutzen.</p>
');
$debug = '';
if ($debugmode)
$debug = 'debug&';
html_header('<script type="text/javascript" src="'.$prefix.'js/ajax.js" ></script>