function cleanup() { $Users = get_users(); $now = time(); foreach ($Users as $u) { $then = $u->last; if ($now - $then > 60 * 5) { try { remove_user($u->name); echo "removed" . $u->name . "\n"; } catch (Exception $e) { // sqlite doesn't like multiple users (as stated on their front page) } } } }
/** * Processes multi-edit actions. * * Accessing requires 'admin.edit' privileges. */ function admin_multi_edit() { global $txp_user; require_privs('admin.edit'); $selected = ps('selected'); $method = ps('edit_method'); $changed = array(); $msg = ''; if (!$selected or !is_array($selected)) { return author_list(); } $names = safe_column('name', 'txp_users', "name IN (" . join(',', quote_list($selected)) . ") AND name != '" . doSlash($txp_user) . "'"); if (!$names) { return author_list(); } switch ($method) { case 'delete': $assign_assets = ps('assign_assets'); if (!$assign_assets) { $msg = array('must_reassign_assets', E_ERROR); } elseif (in_array($assign_assets, $names)) { $msg = array('cannot_assign_assets_to_deletee', E_ERROR); } elseif (remove_user($names, $assign_assets)) { $changed = $names; callback_event('authors_deleted', '', 0, $changed); $msg = 'author_deleted'; } break; case 'changeprivilege': if (change_user_group($names, ps('privs'))) { $changed = $names; $msg = 'author_updated'; } break; case 'resetpassword': foreach ($names as $name) { $passwd = generate_password(PASSWORD_LENGTH); if (change_user_password($name, $passwd)) { $email = safe_field('email', 'txp_users', "name = '" . doSlash($name) . "'"); if (send_new_password($passwd, $email, $name)) { $changed[] = $name; $msg = 'author_updated'; } else { return author_list(array(gTxt('could_not_mail') . ' ' . txpspecialchars($name), E_ERROR)); } } } break; } if ($changed) { return author_list(gTxt($msg, array('{name}' => txpspecialchars(join(', ', $changed))))); } author_list($msg); }
// Force all logout operations, even if we list user as not logged in break; // Just stop node // Just stop node case "stop-node": stop_node($username, false); // Force all logout operations, even if we list user as not logged in break; // Remove user from system // Remove user from system case "remove": if (array_key_exists($username, $users)) { if ($users[$username]["status"] == "active") { deactivate_user($username); } remove_user($username); } if ($is_control_node) { write_nginx_config(); } write_files(); break; // Add a user with local authentication (htpasswd) // Add a user with local authentication (htpasswd) case "add-local-user": $password_esa = escapeshellarg($argv[3]); // This is a different path from $userdata['htpasswd'] ! $htpasswd = $conf_base_path . "/localusers/" . $userdata['efn']; exec("htpasswd -bc {$htpasswd} " . $userdata['esa'] . " {$password_esa} 2>&1"); exec("chown www-data {$htpasswd}"); print "Created local user {$username}\n";
if (isset($_SESSION['option'])) { $option = $_SESSION['option']; } //if we've been to a previous site before if (isset($option)) { //if we logged off if (isset($_POST['logoff'])) { echo "Successfully Logged Off. <br/>"; unset($_SESSION["option"]); unset($_SESSION["info"]); session_destroy(); } elseif (isset($_POST['add'])) { add_user(); log_out(); } elseif (isset($_POST['remove'])) { remove_user($db); $_SESSION['option'] = "removed_user"; log_out(); } elseif (isset($_FILES['uploadedfile']['tmp_name']) && is_uploaded_file($_FILES['uploadedfile']['tmp_name'])) { $file = $_FILES['uploadedfile']['tmp_name']; //gpa array for incoming courses $gpas = array("A+" => 4.0, "A" => 4.0, "A-" => 3.75, "B+" => 3.25, "B" => 3.0, "B-" => 2.75, "C+" => 2.25, "C" => 2.0, "C-" => 1.75, "D+" => 1.25, "D" => 1.0, "D-" => 0.75, "F" => 0.0); $courses = file($file); //see how many courses $result = $db->query("select * from Courses"); $courseid = $result->num_rows + 1; $badfile = false; //add courses for ($i = 0; $i < count($courses) && $badfile == false; $i++) { $courseString = $courses[$i]; rtrim($courseString);
function removeuser($dir) { // Remove User $user = stripslashes($GLOBALS['__POST']["user"]); if ($user == $GLOBALS['__SESSION']["s_user"]) { show_error($GLOBALS["error_msg"]["miscselfremove"]); } if (!remove_user($user)) { show_error($user . ": " . $GLOBALS["error_msg"]["deluser"]); } header("location: " . make_link("admin", $dir, NULL)); }
$user = $_POST["user"]; $res = $fun->borrar("supervisores", "su_id", $user); if ($res) { $res = true; $mes = $msg->get_msg("e004"); } else { $res = false; $mes = $msg->get_msg("e020"); } $response->res = $res; $response->mes = $mes; echo json_encode($response); } //validamos si es una petición ajax if (isset($_POST['action']) && !empty($_POST['action'])) { $action = $_POST['action']; switch ($action) { case 'save': add_usuario(); break; case 'edit': edt_usuario(); break; case 'change_pass': change_usuario(); break; case 'del_user': remove_user(); break; } }
function removeuser($dir) { // Remove User $user = stripslashes($GLOBALS['__POST']["user"]); if ($user == $GLOBALS['__SESSION']["s_user"]) { ext_Result::sendResult('removeuser', false, $GLOBALS["error_msg"]["miscselfremove"]); } if (!remove_user($user)) { ext_Result::sendResult('removeuser', false, $user . ": " . $GLOBALS["error_msg"]["deluser"]); } ext_Result::sendResult('removeuser', true, $user . " was successfully removed."); }
/** * Processes multi-edit actions. * * Accessing requires 'admin.edit' privileges. */ function admin_multi_edit() { global $txp_user; require_privs('admin.edit'); $selected = ps('selected'); $method = ps('edit_method'); $changed = array(); $msg = ''; if (!$selected or !is_array($selected)) { return author_list(); } $clause = ''; if ($method === 'resetpassword') { $clause = " AND last_access IS NOT NULL"; } elseif ($method === 'resendactivation') { $clause = " AND last_access IS NULL"; } $names = safe_column("name", 'txp_users', "name IN (" . join(',', quote_list($selected)) . ") AND name != '" . doSlash($txp_user) . "'" . $clause); if (!$names) { return author_list(); } switch ($method) { case 'delete': $assign_assets = ps('assign_assets'); if (!$assign_assets) { $msg = array('must_reassign_assets', E_ERROR); } elseif (in_array($assign_assets, $names)) { $msg = array('cannot_assign_assets_to_deletee', E_ERROR); } elseif (remove_user($names, $assign_assets)) { $changed = $names; callback_event('authors_deleted', '', 0, $changed); $msg = 'author_deleted'; } break; case 'changeprivilege': if (change_user_group($names, ps('privs'))) { $changed = $names; $msg = 'author_updated'; } break; case 'resetpassword': foreach ($names as $name) { send_reset_confirmation_request($name); $changed[] = $name; } $msg = 'password_reset_confirmation_request_sent'; break; case 'resendactivation': foreach ($names as $name) { send_account_activation($name); $changed[] = $name; } $msg = 'resend_activation_request_sent'; break; } if ($changed) { return author_list(gTxt($msg, array('{name}' => txpspecialchars(join(', ', $changed))))); } author_list($msg); }
<?php include 'database.php'; if (isset($_GET['email'])) { remove_user($_GET['email']); } ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="shortcut icon" href="../images/icon.ico"> <title>AllStyle Homes - Remove Employee</title> <!-- Bootstrap --> <link href="../css/bootstrap.css" rel="stylesheet"> <link href="../css/style.css" rel="stylesheet"> <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries --> <!-- WARNING: Respond.js doesn't work if you view the page via file:// --> <!--[if lt IE 9]> <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script> <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script> <![endif]-->
function add_user($timestamp, $user) { $users = get_user_array(); if (!($handle = fopen(USER_FILE, "w+"))) { die("Konnte User-Datei nicht anlegen!"); } if (!chmod(USER_FILE, 0700)) { die("Konnte User-Datei nicht schützen!"); } //check if user exists foreach ($users as $name) { $chunks = explode("\t", $name); if (trim($chunks[1]) == trim($user)) { $msg = "<h3 class='error'>Benutzer ist bereits eingeloggt!</h3>"; $_SESSION['auth'] = false; } else { //remove idled out users if (microtime_float() - $chunks[0] > 20.0) { remove_user($chunks[1]); } else { //write existing users back to file fwrite($handle, $name); } } } if ($_SESSION['auth'] == true) { // if he is (still) authenticated, add him to user file fwrite($handle, $timestamp . "\t" . $user . "\n"); //write_message($timestamp, "-----", "Teilnehmer $user hat den Chat betreten\n"); } fclose($handle); }
$groestl_input = ""; } else { $groestl_hashrate = $_POST["groestl"]; $groestl_input = $groestl_hashrate; } if (is_numeric($_POST["qubit"]) == false or empty($_POST["qubit"])) { $qubit_hashrate = 1; $qubit_input = ""; } else { $qubit_hashrate = $_POST["qubit"]; $qubit_input = $qubit_hashrate; } calculate_profit($sha_hashrate, $scrypt_hashrate, $skein_hashrate, $groestl_hashrate, $qubit_hashrate); if ($sha_hashrate != $users[$user_position_in_array]->get_sha_hashrate() or $scrypt_hashrate != $users[$user_position_in_array]->get_scrypt_hashrate() or $skein_hashrate != $users[$user_position_in_array]->get_skein_hashrate() or $groestl_hashrate != $users[$user_position_in_array]->get_groestl_hashrate() or $qubit_hashrate != $users[$user_position_in_array]->get_qubit_hashrate()) { if (search_ip_address($filename, $users, $ip) >= 0) { remove_user($filename, $users, $user_position_in_array); file_put_contents($filename, "ip: " . $ip . "\n" . "sha: " . $sha_hashrate . "\n" . "scrypt: " . $scrypt_hashrate . "\n" . "skein: " . $skein_hashrate . "\n" . "groestl: " . $groestl_hashrate . "\n" . "qubit: " . $qubit_hashrate . "\n" . $separator . "\n", FILE_APPEND); } } else { } if ($_POST["refresh_values"]) { scrape("http://birdonwheels5.no-ip.org:3000/status", "scrape.html"); $diff = getDifficulties("scrape.html"); $sha_diff = number_format($diff[0], 2, '.', ','); $sha_net_hashrate = number_format($diff[0] / 34.92331797 / 1000, 2, '.', ','); $scrypt_diff = number_format($diff[1], 2, '.', ','); $scrypt_net_hashrate = number_format($diff[1] / 34.92331797, 2, '.', ','); $skein_diff = number_format($diff[2], 2, '.', ','); $skein_net_hashrate = number_format($diff[2] / 34.92331797, 2, '.', ','); $groestl_diff = number_format($diff[3], 2, '.', ','); $groestl_net_hashrate = number_format($diff[3] / 34.92331797, 2, '.', ',');
<?php include "designtemplate.php"; include "database.php"; include "validation.php"; connect(); verify_authorization('admin'); ?> <?php if (isset($_POST['accept_button'])) { remove_user_from_requests($_REQUEST['username']); } if (isset($_POST['reject_button'])) { remove_user_from_requests($_REQUEST['username']); remove_user($_REQUEST['username']); } ?> <html> <head> <title>Requests</title> </head> <body> <form name = "requests_form" method = "post"> <?php $result = mysql_query("select * from requests"); $record = mysql_fetch_assoc($result);
$firstname = $_POST["new_firstname"]; $lastname = $_POST["new_lastname"]; $email = $_POST["new_email"]; if (empty($user_id)) { $user_id = $_SESSION["user_id"]; } switch ($action) { // case 'subscribe': echo "Action: " . $action . " title: " . $title;//subscribe($title); case 'subscribe': subscribe($title, $mysqli); break; case 'remove_user': remove_user($user_id, $mysqli); break; case 'remove_all_users': remove_user("", $mysqli); break; case 'unsubscribe': unsubscribe($title, $mysqli, $user_id); break; case 'query_series': db_query_series_json($mysqli, $title); break; case 'edit_profile': edit_user_profile($mysqli, $user_id); break; case 'update_profile': update_user_profile($mysqli, $user_id, $firstname, $lastname, $email); break; case 'remove_series': remove_series($mysqli, $title);
dateFormShow($mysqli); break; case "add_user_form": add_user_form($mysqli); break; case "showAllUsers": showAllUsers($mysqli); break; case "add_access": add_access($mysqli); break; case "remove_access": remove_access($mysqli); break; case "remove_user": remove_user($mysqli); break; case "select_city_user": select_city_user($mysqli); break; case "select_user_once": select_user_once($mysqli); break; case "form_upadte_user": form_upadte_user($mysqli); break; case "add_actionFace": add_actionFace($mysqli); break; case "showAll_actionFace": showAll_actionFace($mysqli);