$phone = !empty($_POST["phone"]) ? $_POST["phone"] : ''; $mobile = !empty($_POST["mobile"]) ? $_POST["mobile"] : ''; $fax = !empty($_POST["fax"]) ? $_POST["fax"] : ''; $email = !empty($_POST["email"]) ? $_POST["email"] : ''; $admin = empty($_POST["admin"]) ? 0 : $_POST["admin"]; $guest = empty($_POST["guest"]) ? 0 : $_POST["guest"]; $reservation = empty($_POST["reservation"]) ? 0 : $_POST["reservation"]; $booking = empty($_POST["booking"]) ? 0 : $_POST["booking"]; $agents = empty($_POST["agents"]) ? 0 : $_POST["agents"]; $rooms = empty($_POST["rooms"]) ? 0 : $_POST["rooms"]; $billing = empty($_POST["billing"]) ? 0 : $_POST["billing"]; $billing = empty($_POST["advbilling"]) ? $billing : $_POST["advbilling"]; $rates = empty($_POST["rates"]) ? 0 : $_POST["rates"]; $lookup = empty($_POST["lookup"]) ? 0 : $_POST["lookup"]; $reports = empty($_POST["reports"]) ? 0 : $_POST["reports"]; $userid = modify_user($userid, $fname, $sname, $loginname, $pass, $phone, $mobile, $fax, $email, 0, $admin, $guest, $reservation, $booking, $agents, $rooms, $billing, $rates, $lookup, $reports); if (!$userid) { echo "<div align=\"center\"><h1>" . $_L['ADM_error'] . "</h1></div>"; } else { if ($action == $_L['BTN_update']) { echo "<div align=\"center\"><h1>" . $_L['ADM_updatesuccess'] . "</h1></div>"; } else { echo "<div align=\"center\"><h1>" . $_L['ADM_addsuccess'] . "</h1></div>"; } } } break; case $_L['BTN_list']: break; } }
$title = $cv . "\n"; create_file($title); break; case "-a": case "--add-user": $params = explode(" ", $cv); $login = $params[0]; $passwd = $params[1]; add_user($login, $passwd); break; case "-m": case "--modify-user": $params = explode(" ", $cv); $login = $params[0]; $passwd = $params[1]; modify_user($login, $passwd); break; default: echo "unknown argument : " . $_SERVER["argv"][$a] . ", try --help\n"; break; } } } } function gen_salt() { $random = 0; $rand64 = ""; $salt = ""; $random = rand(); $rand64 = "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
* User processing functions * If this gets too complicated include in a separate file. */ /* Default to user action if formtype not specified */ if ($form_attrs['ftype'] == "user") { /* Basic sanity check of form values */ if ($form_attrs['userid'] && $form_attrs['action'] != "new" && $form_attrs['action'] != "add") { $forms = make_form("users.xml", $form_attrs, ""); } /* * Identify and process any recognised actions, giving an error if an * unknown action is requested */ if ($form_attrs['action'] == "update") { /* process the form data */ $rc = modify_user($form_attrs); /* Check for what needs to be done with errors */ echo $errors[status]; list_users("users.xml", $form_attrs); if ($rc) { /* Re-display the form */ include "templates/user_table.php"; } } elseif ($form_attrs['surname']) { list_users("users.xml", $form_attrs); } elseif ($form_attrs['action'] == "add") { /* process the form data */ $rc = add_user($form_attrs); /* Check for what needs to be done with errors */ if ($rc) { /* Re-display the form */
if (!create_user($udata, $s_sysdba_pw)) { // on error show the create user form again $user_add_flag = TRUE; } else { $users = get_user(); } } // the Modify button on the User panel was pushed if (isset($_POST['usr_user_mod']) && !empty($_POST['usr_user_mname'])) { $s_user_name = get_request_data('usr_user_mname'); $udata = array('uname' => $s_user_name, 'fname' => $users[$s_user_name]['FIRST_NAME'], 'mname' => $users[$s_user_name]['MIDDLE_NAME'], 'lname' => $users[$s_user_name]['LAST_NAME']); } // modify the user from the form values if (isset($_POST['usr_user_mod_doit'])) { $udata = get_posted_user_data(); if (modify_user($udata, $s_sysdba_pw)) { // on success don't show the modify user form again unset($s_user_name); $users = get_user(); } } // modifying an index was canceled if (isset($_POST['usr_user_mod_cancel'])) { unset($s_user_name); } } } // // roles initialisations and form handling // if (have_panel_permissions($s_login['user'], 'usr_role', TRUE)) {