<?php /** * EZCAST EZadmin * Copyright (C) 2014 Université libre de Bruxelles * * Written by Michel Jansens <*****@*****.**> * Arnaud Wijns <*****@*****.**> * Antoine Dewilde * Thibaut Roskam * * This software is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 3 of the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * @package ezcast.ezadmin.test */ require_once 'lib_various.php'; $user_name = "netid"; remove_admin_from_file($user_name); add_admin_to_file($user_name);
function create_user() { global $input; if ($input['create']) { $user_ID = $input['user_ID']; $surname = $input['surname']; $forename = $input['forename']; $des_seed = chr(rand(33, 126)) . chr(rand(33, 126)); $recorder_passwd = crypt($input['recorder_passwd'], $des_seed); $permissions = $input['permissions'] ? 1 : 0; $is_ezadmin = $input['is_ezadmin'] ? 1 : 0; $valid = false; if (empty($user_ID)) { $error = template_get_message('missing_user_ID', get_lang()); } else { if (empty($input['recorder_passwd'])) { $error = template_get_message('missing_recorder_passwd', get_lang()); } else { if (empty($forename)) { $error = template_get_message('missing_forename', get_lang()); } else { if (empty($surname)) { $error = template_get_message('missing_surname', get_lang()); } else { $valid = db_user_create($user_ID, $surname, $forename, $recorder_passwd, $permissions); if ($is_ezadmin) { add_admin_to_file($input['user_ID']); } else { remove_admin_from_file($input['user_ID']); } db_log(db_gettable('users'), 'Created user ' . $input['user_ID'], $_SESSION['user_login']); } } } } if ($valid) { $input['user_ID'] = $user_ID; global $statements; view_user_details(); return; } } notify_changes(); include template_getpath('div_main_header.php'); include template_getpath('div_create_user.php'); include template_getpath('div_main_footer.php'); }