<?php
/*
This file belongs to the Webinterface of schokokeks.org Hosting
Written by schokokeks.org Hosting, namely
Bernd Wurst <bernd@schokokeks.org>
Hanno Böck <hanno@schokokeks.org>
This code is published under a 0BSD license.
Nevertheless, in case you use a significant part of this code, we ask (but not require, see the license) that you keep the authors' names in place and return your changes to the public. We would be especially happy if you tell us what you're going to do with this code.
*/
require_once('inc/base.php');
require_once('inc/security.php');
require_once('inc/debug.php');
require_once('session/start.php');
require_once('su.php');
require_role(ROLE_CUSTOMER);
if (isset($_GET['uid'])) {
$uid = (int) $_GET['uid'];
$token = $_GET['token'];
$cid = (int) $_SESSION['customerinfo']['customerno'];
$users = find_users_for_customer($cid);
$found = false;
foreach ($users as $u) {
if ($uid == $u['uid']) {
$found = true;
}
}
if (!$found) {
system_failure('Unerlaubter Useraccount');
}
if (!isset($_SESSION['su_customer_timestamp']) || $_SESSION['su_customer_timestamp'] < time() - 30) {
system_failure("Aus Sicherheitsgründen muss die Auswahl auf dieser Seite innerhalb von 30 Sekunden getroffen werden.");
}
if (!isset($_SESSION['su_customer_token']) || $_SESSION['su_customer_token'] != $token) {
system_failure("Ungültige Reihenfolge der Aufrufe");
}
su('u', $uid);
}
title("Benutzer wechseln");
output('<p>Hiermit können Sie das Webinterface mit den Rechten eines beliebigen anderen Benutzers aus Ihrem Kundenaccount benutzen.</p>