modules/su/su.php
d4b2da87
 <?php
 
 require_once('inc/debug.php');
 
 require_once('session/start.php');
 require_once('su.php');
 
 require_role(ROLE_SYSADMIN);
 
 if (isset($_POST['submit']))
 {
   check_form_token('su_su');
   $id = (int) $_POST['destination'];
   $role = find_role($id, '', True);
   setup_session($role, $id);
 
63a0529b
   header('Location: ../../go/index/index');
d4b2da87
   die();
 }
 
 
 
 $title = "Benutzer wechseln";
 
 output('<h3>Benutzer wechseln</h3>
 <p>Hiermit können Sie (als Admin) das Webinterface mit den Rechten eines beliebigen anderen Benutzers benutzen.</p>
fbb3a834
 ');
d4b2da87
 
 $users = list_system_users();
 $options = '';
 foreach ($users as $user)
 {
   $options .= "  <option value=\"{$user->uid}\">{$user->username} ({$user->uid})</option>\n";
 }
 
63a0529b
 output(html_form('su_su', 'su', '', '<p>Benutzer auswählen:
fbb3a834
 <select name="destination" size="1">
d4b2da87
 '.$options.'
 </select>
 <input type="submit" name="submit" value="zum Benutzer wechseln" />
fbb3a834
 </p>
d4b2da87
 '));
 
 $customers = list_customers();
 $options = '';
 foreach ($customers as $customer)
 {
   $options .= "  <option value=\"{$customer->id}\">{$customer->id} - {$customer->name}</option>\n";
 }
 
63a0529b
 output(html_form('su_su', 'su', '', '<p>Kunde auswählen:
fbb3a834
 <select name="destination" size="1">
d4b2da87
 '.$options.'
 </select>
 <input type="submit" name="submit" value="zum Kunden wechseln" />
fbb3a834
 </p>
d4b2da87
 '));
 
 
 
 ?>