function create_main() { global $argc, $argv; global $gbl, $sgbl, $login, $ghtml; $opt = parse_opt($argv); if (file_exists('/usr/local/lxlabs/.git')) { $opt['development_found'] = '1'; } lxfile_mkdir("{$sgbl->__path_program_etc}/conf"); lxfile_mkdir("{$sgbl->__path_program_root}/pid"); lxfile_mkdir("{$sgbl->__path_program_root}/log"); lxfile_mkdir("{$sgbl->__path_httpd_root}"); os_create_program_service(); if (isset($opt['admin-password'])) { $admin_pass = $opt['admin-password']; } else { $admin_pass = '******'; } if ($opt['install-type'] == 'master') { if (!isset($opt['development_found'])) { create_mysql_db('master', $opt, $admin_pass); create_database(); create_general(); add_admin($admin_pass); create_servername(); lxshell_return("__path_php_path", "../bin/collectquota.php"); } else { print "Development GIT version found. Skipping creation from scratch of HyperVM-NG.\n"; } print "Updating the system. Will take a while\n"; system("/usr/local/lxlabs/ext/php/php ../bin/common/updatecleanup-main.php --type=master"); } else { if ($opt['install-type'] == 'slave') { if (!isset($opt['development_found'])) { init_slave($admin_pass); } else { print "Development GIT version found. Skipping creation from scratch of HyperVM-NG.\n"; } print "Updating the system. Will take a while\n"; system("/usr/local/lxlabs/ext/php/php ../bin/common/updatecleanup-main.php --type=slave"); } else { print "Unknown Install type\n"; flush(); } } system("rm -f /etc/sysconfig/network-scripts/ifcfg-*-range*"); //system("$sgbl->__path_php_path ../bin/misc/fixcentos5xen.php"); //os_fix_some_permissions(); system("cp ../sbin/lxxen ../sbin/lxopenvz /usr/bin"); system("chmod 4755 /usr/bin/lxxen /usr/bin/lxopenvz"); //os_set_iis_ftp_root_path(); }
function init_main($admin_pass) { global $gbl, $sgbl, $login, $ghtml; try { add_admin($admin_pass); initProgram("admin"); create_servername(); //create_default_template(); $login->was(); createDnsTemplate(); Ticket::createWelcomeTicket(); /* if (lxfile_exists("__path_program_etc/license.txt")) { decodeAndStoreLicense(); $login->license_o->write(); $login->write(); } */ } catch (Exception $e) { print $e->getMessage(); print "\\n\n\n\n\n\n\n\n\n\nn\n"; } print "\n"; }
case 'delete': check_demo(); if ($err = delete_admin()) { fatal_error($err . ". <a href='admins.php'>Continue</a>", 0, 1); } else { admin_html_redirect("admins.php", $title = 'Admin record removed', $text = 'Admin record removed'); } break; case 'add_save': if (!$_POST['action']) { die("POST request expected"); } check_demo(); if ($err = validate_form($vars)) { admins_add_form($err); } elseif ($err = add_admin($vars)) { admins_add_form($err); } else { admin_html_redirect("admins.php", $title = 'Admin record added', $text = 'Admin record added'); } break; case 'edit_save': if (!$_POST['action']) { die("POST request expected"); } check_demo(); if ($err = validate_form($vars)) { admins_edit_form($err); } elseif ($err = edit_admin($vars)) { admins_edit_form($err); } else {
<?php // --- AJOUT if (!empty($_POST) && isset($_POST["add_servers"]) && $_POST["add_servers"] == "1") { $type = 0; // UNUSED FOR THE MOMENT - WILL BE FOR AN OPTION FOR SOMETHING ELSE $servers = addslashes($_POST["servers"]); add_admin($db, $servers, $type, "servers"); } // --- SUPPRESSION if (!empty($_POST) && isset($_POST["del_servers"]) && $_POST["del_servers"] == "1") { $id = $_POST["id"]; delete($db, $id, "servers"); } // --- UP_LIST if (!empty($_POST) && isset($_POST["up_list"]) && $_POST["up_list"] == "1") { $order_list_actual = intval($_POST["order_list"]); order_list($db, $order_list_actual, "servers", "up", 0); unset($_POST); } // ------------- // --- DOWN_LIST if (!empty($_POST) && isset($_POST["down_list"]) && $_POST["down_list"] == "1") { $max_line = intval($_POST["max_line"]); $order_list_actual = intval($_POST["order_list"]); order_list($db, $order_list_actual, "servers", "down", $max_line); unset($_POST); } // ------------- // --- MODIFICATION if (!empty($_POST) && isset($_POST["update_servers"]) && $_POST["update_servers"] == "1") { $id = intval($_POST["id"]);
} if (is_team_admin($user, $team)) { error_page(tra("%1 is already an admin of %2", $email_addr, $team->name)); } $now = time(); $ret = BoincTeamAdmin::insert("(teamid, userid, create_time) values ({$team->id}, {$user->id}, {$now})"); if (!$ret) { error_page(tra("Couldn't add admin")); } } $user = get_logged_in_user(); $teamid = get_int('teamid'); $team = BoincTeam::lookup_id($teamid); if (!$team) { error_page(tra("No such team")); } require_founder_login($user, $team); $action = get_str('action', true); switch ($action) { case 'remove': check_tokens($user->authenticator); remove_admin($team); Header("Location: team_admins.php?teamid={$teamid}"); exit; case 'add': check_tokens($user->authenticator); add_admin($team); Header("Location: team_admins.php?teamid={$teamid}"); exit; } show_admins($user, $teamid);
<?php // --- AJOUT if (!empty($_POST) && isset($_POST["add_antivirus"]) && $_POST["add_antivirus"] == "1") { $type = 0; // UNUSED FOR THE MOMENT - WILL BE FOR AN OPTION FOR SOMETHING ELSE $antivirus = addslashes($_POST["antivirus"]); add_admin($db, $antivirus, $type, "antivirus"); } // --- SUPPRESSION if (!empty($_POST) && isset($_POST["del_antivirus"]) && $_POST["del_antivirus"] == "1") { $id = $_POST["id"]; delete($db, $id, "antivirus"); } // --- UP_LIST if (!empty($_POST) && isset($_POST["up_list"]) && $_POST["up_list"] == "1") { $order_list_actual = intval($_POST["order_list"]); order_list($db, $order_list_actual, "antivirus", "up", 0); unset($_POST); } // ------------- // --- DOWN_LIST if (!empty($_POST) && isset($_POST["down_list"]) && $_POST["down_list"] == "1") { $max_line = intval($_POST["max_line"]); $order_list_actual = intval($_POST["order_list"]); order_list($db, $order_list_actual, "antivirus", "down", $max_line); unset($_POST); } // ------------- // --- MODIFICATION if (!empty($_POST) && isset($_POST["update_antivirus"]) && $_POST["update_antivirus"] == "1") { $id = intval($_POST["id"]);
//echo "admin_id: ".$admin_id."<br />"; switch ($dml) { case 'ajax_agregar': echo agregar_curso($admin_id); break; case 'ajax_eliminar': echo eliminar_curso($admin_id); break; case 'view_cursos': echo view_cursos($admin_id); break; case 'view_admin_cursos': echo view_admin_cursos($admin_id); break; case 'I': echo add_admin(); break; case 'U': echo edit_admin($admin_id); break; case 'D': echo delete_admin($admin_id); break; case 'changeUser': echo changeUser($admin_id); break; case 'changePass': echo changePass($admin_id); break; } function add_admin()
case 'list_roles': $assigned_roles = get_assigned_roles(); $users = get_users(); $roles = get_roles(); $teacherList = get_teacher_list(); include __DIR__ . "/view.php"; break; case 'modify_admin': $choice = filter_input(INPUT_POST, 'choice'); if ($choice == "Back") { header("Location: .."); } if ($choice == "Add Admin") { $usr_id = filter_input(INPUT_POST, 'user_drop'); $usr_role_cde = filter_input(INPUT_POST, 'role_drop'); add_admin($usr_id, $app_cde, $usr_role_cde); } $assigned_roles = get_assigned_roles(); $users = get_users(); $roles = get_roles(); include __DIR__ . "/view.php"; break; case 'delete_admin': $usr_id = filter_input(INPUT_GET, 'usrID'); $usr_role_cde = filter_input(INPUT_GET, 'roleID'); delete_admin($usr_id, $usr_role_cde); $assigned_roles = get_assigned_roles(); $users = get_users(); $roles = get_roles(); include __DIR__ . "/view.php"; break;
// and a "login" action is when the user refreshed the page. In that case, // we redraw the page with the last information saved in the session variables. case 'login': redraw_page(); break; case 'view_logs': view_logs(); break; case 'edit_config': edit_config(); break; case 'edit_admins': edit_admins(); break; case 'add_admin': add_admin(); break; case 'remove_admin': remove_admin(); break; case 'push_changes': push_changes(); break; case 'create_user': create_user(); break; case 'remove_user': remove_user(); break; case 'view_users': view_users();
<?php // --- AJOUT if (!empty($_POST) && isset($_POST["add_type_interv"]) && $_POST["add_type_interv"] == "1") { $type = 0; // UNUSED FOR THE MOMENT - WILL BE FOR AN OPTION FOR SOMETHING ELSE $type_interv = addslashes($_POST["type_interv"]); add_admin($db, $type_interv, $type, "type_interv"); } // --- SUPPRESSION if (!empty($_POST) && isset($_POST["del_type_interv"]) && $_POST["del_type_interv"] == "1") { $id = $_POST["id"]; delete($db, $id, "type_interv"); } // --- UP_LIST if (!empty($_POST) && isset($_POST["up_list"]) && $_POST["up_list"] == "1") { $order_list_actual = intval($_POST["order_list"]); order_list($db, $order_list_actual, "type_interv", "up", 0); unset($_POST); } // ------------- // --- DOWN_LIST if (!empty($_POST) && isset($_POST["down_list"]) && $_POST["down_list"] == "1") { $max_line = intval($_POST["max_line"]); $order_list_actual = intval($_POST["order_list"]); order_list($db, $order_list_actual, "type_interv", "down", $max_line); unset($_POST); } // ------------- // --- MODIFICATION if (!empty($_POST) && isset($_POST["update_type_interv"]) && $_POST["update_type_interv"] == "1") { $id = intval($_POST["id"]);
</input>   <?php if (get_get_email($dbc, $_SERVER['HTTP_QUEENSU_NETID']) != 0) { echo '<input type="hidden" name="checked_value" value="1">'; } else { echo '<input type="hidden" name="checked_value" value="0">'; } ?> <button class="btn btn-primary" name='get_email' value='1'>Save</button> </td> </tr> </form> </table> <?php if (isset($_POST['submit']) and $_POST['submit'] == 1) { $result = add_admin($dbc, $_POST['adminQuery']); if ($result == 1) { echo "<br>Admin successfully added."; } else { echo "<br>Unable to add admin."; } } if (isset($_POST['submit']) and $_POST['submit'] == 2) { $result = remove_admin($dbc, $_POST['adminQuery']); if ($result == 1) { echo "<br>Admin successfully removed."; } else { echo "<br>Unable to remove admin."; } } if (isset($_POST['get_email'])) {
<?php // --- AJOUT if (!empty($_POST) && isset($_POST["add_type_hardware"]) && $_POST["add_type_hardware"] == "1") { $type = 0; // UNUSED FOR THE MOMENT - WILL BE FOR AN OPTION FOR SOMETHING ELSE $type_hardware = addslashes($_POST["type_hardware"]); add_admin($db, $type_hardware, $type, "type_hardware"); } // --- SUPPRESSION if (!empty($_POST) && isset($_POST["del_type_hardware"]) && $_POST["del_type_hardware"] == "1") { $id = $_POST["id"]; delete($db, $id, "type_hardware"); } // --- UP_LIST if (!empty($_POST) && isset($_POST["up_list"]) && $_POST["up_list"] == "1") { $order_list_actual = intval($_POST["order_list"]); order_list($db, $order_list_actual, "type_hardware", "up", 0); unset($_POST); } // ------------- // --- DOWN_LIST if (!empty($_POST) && isset($_POST["down_list"]) && $_POST["down_list"] == "1") { $max_line = intval($_POST["max_line"]); $order_list_actual = intval($_POST["order_list"]); order_list($db, $order_list_actual, "type_hardware", "down", $max_line); unset($_POST); } // ------------- // --- MODIFICATION if (!empty($_POST) && isset($_POST["update_type_hardware"]) && $_POST["update_type_hardware"] == "1") { $id = intval($_POST["id"]);
<?php // --- AJOUT if (!empty($_POST) && isset($_POST["add_tech"]) && $_POST["add_tech"] == "1") { $type = 0; // UNUSED FOR THE MOMENT - WILL BE FOR AN OPTION FOR SOMETHING ELSE $tech = addslashes($_POST["tech"]); add_admin($db, $tech, $type, "techs"); } // --- SUPPRESSION if (!empty($_POST) && isset($_POST["del_tech"]) && $_POST["del_tech"] == "1") { $id = $_POST["id"]; delete($db, $id, "techs"); } // --- UP_LIST if (!empty($_POST) && isset($_POST["up_list"]) && $_POST["up_list"] == "1") { $order_list_actual = intval($_POST["order_list"]); order_list($db, $order_list_actual, "techs", "up", 0); unset($_POST); } // ------------- // --- DOWN_LIST if (!empty($_POST) && isset($_POST["down_list"]) && $_POST["down_list"] == "1") { $max_line = intval($_POST["max_line"]); $order_list_actual = intval($_POST["order_list"]); order_list($db, $order_list_actual, "techs", "down", $max_line); unset($_POST); } // ------------- // --- MODIFICATION if (!empty($_POST) && isset($_POST["update_tech"]) && $_POST["update_tech"] == "1") { $id = intval($_POST["id"]);
</td> <td> <input type="submit" name='add' value="Create"/> <input type="submit" name='delete' value="Delete"/> </td> </tr> </table> </form> <br><br><br> <br><br><br> <br><br><br> <?php if ($_SERVER['REQUEST_METHOD'] == 'POST') { # Determines whether to add or delete the entered admin name if (isset($_POST['add'])) { $result = add_admin($dbc, $_SESSION['username'], $_POST['target_admin']); echo $result . '<br>'; } elseif (isset($_POST['delete'])) { $result = delete_admin($dbc, $_SESSION['username'], $_POST['target_admin']); echo $result . '<br>'; } } ?> <br><br><br> <br><br><br> <a href='/admin/home.php'>Back</a> </div> <?php include '../footer.php'; ?> </body>
} switch ($action) { case 'reset': // Reset values for variables $first_name = ''; $last_name = ''; $password = ''; $email = ''; // Load view include 'register.php'; break; case 'register': // Copy form values to local variables $first_name = trim(filter_input(INPUT_POST, 'first_name')); $last_name = trim(filter_input(INPUT_POST, 'last_name')); $password = trim(filter_input(INPUT_POST, 'password')); $email = trim(filter_input(INPUT_POST, 'email')); // Validate form data $validate->text('first_name', $first_name); $validate->text('last_name', $last_name); $validate->password('password', $password); $validate->email('email', $email); add_admin($first_name, $last_name, $email, $password); // Load appropriate view based on hasErrors if ($fields->hasErrors()) { include 'register.php'; } else { include 'success.php'; } break; }
<?php // --- AJOUT if (!empty($_POST) && isset($_POST["add_type_os"]) && $_POST["add_type_os"] == "1") { $type = 0; // UNUSED FOR THE MOMENT - WILL BE FOR AN OPTION FOR SOMETHING ELSE $type_os = addslashes($_POST["type_os"]); add_admin($db, $type_os, $type, "type_os"); } // --- SUPPRESSION if (!empty($_POST) && isset($_POST["del_type_os"]) && $_POST["del_type_os"] == "1") { $id = $_POST["id"]; delete($db, $id, "type_os"); } // --- UP_LIST if (!empty($_POST) && isset($_POST["up_list"]) && $_POST["up_list"] == "1") { $order_list_actual = intval($_POST["order_list"]); order_list($db, $order_list_actual, "type_os", "up", 0); unset($_POST); } // ------------- // --- DOWN_LIST if (!empty($_POST) && isset($_POST["down_list"]) && $_POST["down_list"] == "1") { $max_line = intval($_POST["max_line"]); $order_list_actual = intval($_POST["order_list"]); order_list($db, $order_list_actual, "type_os", "down", $max_line); unset($_POST); } // ------------- // --- MODIFICATION if (!empty($_POST) && isset($_POST["update_type_os"]) && $_POST["update_type_os"] == "1") { $id = intval($_POST["id"]);
<?php // --- AJOUT if (!empty($_POST) && isset($_POST["add_shop"]) && $_POST["add_shop"] == "1") { $type = 0; // UNUSED FOR THE MOMENT - WILL BE FOR AN OPTION FOR SOMETHING ELSE $shop = addslashes($_POST["shop"]); add_admin($db, $shop, $type, "shop"); } // --- SUPPRESSION if (!empty($_POST) && isset($_POST["del_shop"]) && $_POST["del_shop"] == "1") { $id = $_POST["id"]; delete($db, $id, "shop"); } // --- UP_LIST if (!empty($_POST) && isset($_POST["up_list"]) && $_POST["up_list"] == "1") { $order_list_actual = intval($_POST["order_list"]); order_list($db, $order_list_actual, "shop", "up", 0); unset($_POST); } // ------------- // --- DOWN_LIST if (!empty($_POST) && isset($_POST["down_list"]) && $_POST["down_list"] == "1") { $max_line = intval($_POST["max_line"]); $order_list_actual = intval($_POST["order_list"]); order_list($db, $order_list_actual, "shop", "down", $max_line); unset($_POST); } // ------------- // --- MODIFICATION if (!empty($_POST) && isset($_POST["update_shop"]) && $_POST["update_shop"] == "1") { $id = intval($_POST["id"]);
if ($fields->hasErrors()) { include 'admin/account/account_view.php'; break; } if (is_valid_admin_email($email)) { $email_message = 'This email is already in use.'; include 'admin/account/account_view.php'; break; } if ($password_1 !== $password_2) { $password_message = 'Passwords do not match.'; include 'admin/account/account_view.php'; break; } // Add admin user $admin_id = add_admin($email, $first_name, $last_name, $password_1); // Set admin user in session if (!isset($_SESSION['admin'])) { $_SESSION['admin'] = get_admin($admin_id); } redirect('.'); break; case 'view_edit': // Get admin user data $admin_id = filter_input(INPUT_POST, 'admin_id', FILTER_VALIDATE_INT); $admin = get_admin($admin_id); $first_name = $admin['firstName']; $last_name = $admin['lastName']; $email = $admin['emailAddress']; $password_message = ''; // Display Edit page
$lName = ''; //check if button submit is clicked $message = ''; if (isset($_POST['submit'])) { $photo = $_FILES['photo']; if ($photo && !$photo['error']) { $name = $photo['name']; $type = $photo['type']; $path = $photo['tmp_name']; $bytes = file_get_contents($path); $fName = trim($_POST['fName']); $mName = trim($_POST['mName']); $lName = trim($_POST['lName']); $id = trim($_POST['id']); $pass = trim($_POST['pass']); add_admin($id, $fName, $mName, $lName, 1); add_account($id, $pass, 'admin'); add_photo($id, $name, $type, $bytes, 'admin', 1); $target = "../uploadedPhotos/"; $target = $target . basename($_FILES['photo']['name']); if (move_uploaded_file($_FILES['photo']['tmp_name'], $target)) { //echo "The file ". basename( $_FILES['photo']['name']). " has been uploaded, and your information has been added to the directory"; } $message = "<div class = 'alert alert-success' style = 'width: 265px;'>Successfully added.</div>"; echo "<script>"; //go back to viewPhotos page after 3 seconds. echo "setTimeout(function(){ document.location = '?p=manageAdmin/viewAdmin'; }, 2000);"; echo "</script>"; } else { $message = "<div class = 'alert alert-warning' style = 'width: 265px;'>Photo is invalid!</div>"; }
<input id="addAdmin" type="button" value="Add Admin"></input> <?php $result = mysql_query("select * from user where admin=1"); if (mysql_num_rows($result) >= 1) { while ($row = mysql_fetch_assoc($result)) { ?> <div> <span class="username"><?php echo $row['username']; ?> </span> <input class="removeAdmin" type="button" value="Remove Admin"></input> </div> <?php } } ?> </body> </html> <?php } else { if ($method == "add") { add_admin($username); return "{message:'{$username} added to admin list.'}"; } else { if ($method == "remove") { remove_admin($username); return "{message:'{$username} removed from admin list.'}"; } } }
<?php // --- AJOUT if (!empty($_POST) && isset($_POST["add_software"]) && $_POST["add_software"] == "1") { $type = 0; // UNUSED FOR THE MOMENT - WILL BE FOR AN OPTION FOR SOMETHING ELSE $software = addslashes($_POST["software"]); add_admin($db, $software, $type, "software"); } // --- SUPPRESSION if (!empty($_POST) && isset($_POST["del_software"]) && $_POST["del_software"] == "1") { $id = $_POST["id"]; delete($db, $id, "software"); } // --- UP_LIST if (!empty($_POST) && isset($_POST["up_list"]) && $_POST["up_list"] == "1") { $order_list_actual = intval($_POST["order_list"]); order_list($db, $order_list_actual, "software", "up", 0); unset($_POST); } // ------------- // --- DOWN_LIST if (!empty($_POST) && isset($_POST["down_list"]) && $_POST["down_list"] == "1") { $max_line = intval($_POST["max_line"]); $order_list_actual = intval($_POST["order_list"]); order_list($db, $order_list_actual, "software", "down", $max_line); unset($_POST); } // ------------- // --- MODIFICATION if (!empty($_POST) && isset($_POST["update_software"]) && $_POST["update_software"] == "1") { $id = intval($_POST["id"]);