3 # Copyright (C) 2008 Jason Woofenden
5 # This program is free software: you can redistribute it and/or modify
6 # it under the terms of the GNU Affero General Public License as published by
7 # the Free Software Foundation, either version 3 of the License, or
8 # (at your option) any later version.
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU Affero General Public License for more details.
15 # You should have received a copy of the GNU Affero General Public License
16 # along with this program. If not, see <http://www.gnu.org/licenses/>.
18 require_once('code/wfpl/format.php');
21 # If you log in to the admin account, you can su to a customer account and still have access to su back to admin. That's why we're checking for admin not "contractor" here.
22 if(!logged_in_as_admin()) {
23 $GLOBALS['url'] = this_url();
24 message('You must be logged in as an administrator to access that function');
32 tem_show('main_body');
36 $client_id = format_int($_REQUEST['as']);
38 session_set('auth_username', $client_id);
39 message('Switched Login');
43 $rows = db_get_rows('people', 'id,name,username', 'order by name');
45 if($rows) foreach($rows as $row) {
46 list($id, $name, $username) = $row;
47 tem_set('client_id', $id);
48 tem_set('client_name', $name);
49 tem_set('client_username', $username);