</tbody> </table> <div class='col-lg-4'> <div class='well'> <form class="bs-example form-horizontal" action='user_list.php?list=user' method=post> <table id='exception'> <legend>Manage Account</legend> <tr> <td><label class='control-label'>Name of User</label></td> <td> <select class='form-control' name='updateUser'> <?php // $db=retrieveUsersDb(); $rs = listUsers($db); $nm = $rs->num_rows; for ($i = 0; $i < $nm; $i++) { $row = $rs->fetch_assoc(); ?> <option value="<?php echo $row['username']; ?> "><?php echo strtoupper($row['lastName']) . ", " . $row['firstName']; ?> </option> <?php } ?> </select>
listUsers(User::findAll()); $user2->delete(); echo "\n=DELETE Lucky Luke=\n\n"; listUsers(User::findAll()); $user1->setProp('lastname', 'Vader'); $user1->save(); echo "\n=UPDATE Skywalker -> Vader=\n\n"; listUsers(User::findAll()); $user3 = new User(); $user3->setProp('firstname', 'Darth'); $user3->setProp('lastname', 'Vader'); $user3->setProp('age', 350); $user3->setProp('date', new \DateTime('2000-01-01 00:00:00')); $user3->save(); echo "\n=ADD Darth Vader=\n\n"; listUsers(User::findAll()); echo '</pre>'; ?> <br> <br> <br> <div> <a href="logs/log.sql.txt">sqlLog</a> </div> <div> <a href="logs/log.err.txt">sqlErr</a> </div>
public function createAction() { if (Minz_Request::isPost() && Minz_Configuration::isAdmin(Minz_Session::param('currentUser', '_'))) { require_once APP_PATH . '/sql.php'; $new_user_language = Minz_Request::param('new_user_language', $this->view->conf->language); if (!in_array($new_user_language, $this->view->conf->availableLanguages())) { $new_user_language = $this->view->conf->language; } $new_user_name = Minz_Request::param('new_user_name'); $ok = $new_user_name != '' && ctype_alnum($new_user_name); if ($ok) { $ok &= strcasecmp($new_user_name, Minz_Configuration::defaultUser()) !== 0; //It is forbidden to alter the default user $ok &= !in_array(strtoupper($new_user_name), array_map('strtoupper', listUsers())); //Not an existing user, case-insensitive $configPath = DATA_PATH . '/' . $new_user_name . '_user.php'; $ok &= !file_exists($configPath); } if ($ok) { $passwordPlain = Minz_Request::param('new_user_passwordPlain', false); $passwordHash = ''; if ($passwordPlain != '') { Minz_Request::_param('new_user_passwordPlain'); //Discard plain-text password ASAP $_POST['new_user_passwordPlain'] = ''; if (!function_exists('password_hash')) { include_once LIB_PATH . '/password_compat.php'; } $passwordHash = password_hash($passwordPlain, PASSWORD_BCRYPT, array('cost' => self::BCRYPT_COST)); $passwordPlain = ''; $passwordHash = preg_replace('/^\\$2[xy]\\$/', '\\$2a\\$', $passwordHash); //Compatibility with bcrypt.js $ok &= $passwordHash != ''; } if (empty($passwordHash)) { $passwordHash = ''; } $new_user_email = filter_var($_POST['new_user_email'], FILTER_VALIDATE_EMAIL); if (empty($new_user_email)) { $new_user_email = ''; } else { $personaFile = DATA_PATH . '/persona/' . $new_user_email . '.txt'; @unlink($personaFile); $ok &= file_put_contents($personaFile, $new_user_name) !== false; } } if ($ok) { $config_array = array('language' => $new_user_language, 'passwordHash' => $passwordHash, 'mail_login' => $new_user_email); $ok &= file_put_contents($configPath, "<?php\n return " . var_export($config_array, true) . ';') !== false; } if ($ok) { $userDAO = new FreshRSS_UserDAO(); $ok &= $userDAO->createUser($new_user_name); } invalidateHttpCache(); $notif = array('type' => $ok ? 'good' : 'bad', 'content' => Minz_Translate::t($ok ? 'user_created' : 'error_occurred', $new_user_name)); Minz_Session::_param('notification', $notif); } Minz_Request::forward(array('c' => 'configure', 'a' => 'users'), true); }
private function _default_user(&$data, $value) { $user_list = listUsers(); if (in_array($value, $user_list)) { $data['default_user'] = $value; } }
function addUser() { if (!isset($_POST['submit'])) { print("<h2>Add new user</h2>"); print("<form action=\"admin.php?a=adduser\" method=\"post\">\n"); print("<label for=\"login\">Login</label><br />\n"); print("<input type=\"text\" size=\"50\" name=\"login\" id=\"login\" /><br />\n"); print("<label for=\"realname\">Real name</label><br />\n"); print("<input type=\"text\" size=\"50\" name=\"realname\" id=\"realname\" /><br />\n"); print("<label for=\"email\">E-Mail</label><br />\n"); print("<input type=\"text\" size=\"50\" name=\"email\" id=\"email\" /><br />\n"); print("<label for=\"password\">Password</label><br />\n"); print("<input type=\"text\" size=\"50\" name=\"password\" id=\"password\" value=\"initinit\" /><br />\n"); print("<input type=\"submit\" name=\"submit\" id=\"submit\" value=\"Save settings\" /><br />\n"); print("</form>\n"); } else { $result = $_SESSION['db']->addUser(trim($_POST['login']), trim($_POST['realname']), trim($_POST['email']), trim($_POST['password'])); if ($result) { listUsers(); } else { print("User already exists!\n"); } } }
function createUser($user) { $users = listUsers(); array_push($users, $user); writeUsers($users); }
$db->rq($query2); } } $query='DELETE FROM trades WHERE user_account_num="'.$uDetails['user_account_num'].'"'; $db->rq($query); $query='DELETE FROM transfers WHERE user_account_num="'.$uDetails['user_account_num'].'"'; $db->rq($query); $query='DELETE FROM users_logs WHERE user_account_num="'.$uDetails['user_account_num'].'"'; $db->rq($query); $query='DELETE FROM users WHERE user_uid="'.$_GET['uid'].'"'; $db->rq($query); addLog('Back-end','Accounts',''.$uDetails['user_firstname'].' '.$uDetails['user_lastname'].' ('.$uDetails['user_account_num'].')',''.$_SESSION['admin']['name'].' ('.$_SESSION['admin']['refnum'].')','User deleted'); $db->close(); header('Location: users.php'); exit(); } break; default : $page_content=listUsers(); break; } page_header(); echo $page_content; page_footer(); ?>
</div> </form> </div> <div class="listView"> <br><br><br> <?php listUsers(); ?> </div> <!-- Registration form to be output if the POST variables are not set or if the registration script caused an error. --> <?php } else { ?> <p> Du är ingen admin. Var god och logga in på ett konto med användarrättigheter för att se denna sida. </p> <p>Return to <a href="login.php">login page</a></p>
| http://www.formalms.org | | License http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt | | | | from docebo 4.0.5 CE 2008-2012 (c) docebo | | License http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt | \ ======================================================================== */ error_reporting(E_ALL ^ E_NOTICE); // check for remote file inclusion attempt ------------------------------- $list = array('GLOBALS', '_POST', '_GET', '_COOKIE', '_SESSION'); while (list(, $elem) = each($list)) { if (isset($_REQUEST[$elem])) { die('Request overwrite attempt detected'); } } // ------------------------------------------------------------------- require_once dirname(__FILE__) . "/header.php"; /*$last_msg_id=(int)importVar("lmi"); $getnew=haveNewMsg($last_msg_id); */ //$script.="parent.chatText.setTimeout('refreshPage()',1000);\n"; //$script.="parent.chatText.document.write('refreshPage');\n"; /*if (($last_msg_id > 0) && (count($txt_arr) > 0)) { foreach ($txt_arr as $key=>$val) { $script.="parent.chatText.appendMsg('".addslashes($val["text"])."');\n"; } }*/ $script = "\r\n\t<script type=\"text/javascript\">\r\n\t<!--\r\n\r\n\t\tfunction refreshPage() {" . "window.location.reload( false );\n" . "}\r\n\r\n\t\twindow.setTimeout('refreshPage()',10000);\r\n\r\n\t//-->\r\n\t</script>"; $out->add($script, "page_head"); //$out->add(date("H:i:s", time()), "content"); $out->add(listUsers($out, $lang), 'content'); require_once dirname(__FILE__) . "/footer.php"; // -------------------------------------------------------------------
} else { sendChatMsg(); } break; case "setroom": setRoom($out, $lang); break; } if (!isset($_SESSION["refreshrate"])) { $_SESSION["refreshrate"] = 0; } checkLogin(false); // Auto-reload is off in accessibility mode //--debug:--// echo("<pre>"); print_r($_SESSION); echo("</pre>"); $out->add("\n<div class=\"chatText\">"); $out->add(getMsgBuffer($lang, 25)); $out->add("</div>\n"); $out->add(listUsers($out, $lang)); $out->add(listRooms($out, $lang)); $out->add("\n<div class=\"nofloat\"> </div>\n"); $out->add(getWriteBox($out, $lang)); $backurl = getBackUrl(); if (!empty($backurl)) { $out->add("\n<noscript>\n"); $out->add("<a href=\"" . $backurl . "\">"); $out->add($lang->def("_BACK") . "</a>\n"); $out->add("\n</noscript>\n"); } // ------------------------------------------------------------------- require_once dirname(__FILE__) . "/footer.php"; // -------------------------------------------------------------------
/** * This action creates a new user. * * Request parameters are: * - new_user_language * - new_user_name * - new_user_passwordPlain * - new_user_email * - r (i.e. a redirection url, optional) * * @todo clean up this method. Idea: write a method to init a user with basic information. * @todo handle r redirection in Minz_Request::forward directly? */ public function createAction() { if (Minz_Request::isPost() && (FreshRSS_Auth::hasAccess('admin') || !max_registrations_reached())) { $db = FreshRSS_Context::$system_conf->db; require_once APP_PATH . '/SQL/install.sql.' . $db['type'] . '.php'; $new_user_language = Minz_Request::param('new_user_language', FreshRSS_Context::$user_conf->language); $languages = Minz_Translate::availableLanguages(); if (!isset($languages[$new_user_language])) { $new_user_language = FreshRSS_Context::$user_conf->language; } $new_user_name = Minz_Request::param('new_user_name'); $ok = $new_user_name != '' && ctype_alnum($new_user_name); if ($ok) { $default_user = FreshRSS_Context::$system_conf->default_user; $ok &= strcasecmp($new_user_name, $default_user) !== 0; //It is forbidden to alter the default user $ok &= !in_array(strtoupper($new_user_name), array_map('strtoupper', listUsers())); //Not an existing user, case-insensitive $configPath = join_path(DATA_PATH, 'users', $new_user_name, 'config.php'); $ok &= !file_exists($configPath); } if ($ok) { $passwordPlain = Minz_Request::param('new_user_passwordPlain', '', true); $passwordHash = ''; if ($passwordPlain != '') { Minz_Request::_param('new_user_passwordPlain'); //Discard plain-text password ASAP $_POST['new_user_passwordPlain'] = ''; if (!function_exists('password_hash')) { include_once LIB_PATH . '/password_compat.php'; } $passwordHash = password_hash($passwordPlain, PASSWORD_BCRYPT, array('cost' => self::BCRYPT_COST)); $passwordPlain = ''; $passwordHash = preg_replace('/^\\$2[xy]\\$/', '\\$2a\\$', $passwordHash); //Compatibility with bcrypt.js $ok &= $passwordHash != ''; } if (empty($passwordHash)) { $passwordHash = ''; } $new_user_email = filter_var($_POST['new_user_email'], FILTER_VALIDATE_EMAIL); if (empty($new_user_email)) { $new_user_email = ''; } else { $personaFile = join_path(DATA_PATH, 'persona', $new_user_email . '.txt'); @unlink($personaFile); $ok &= file_put_contents($personaFile, $new_user_name) !== false; } } if ($ok) { mkdir(join_path(DATA_PATH, 'users', $new_user_name)); $config_array = array('language' => $new_user_language, 'passwordHash' => $passwordHash, 'mail_login' => $new_user_email); $ok &= file_put_contents($configPath, "<?php\n return " . var_export($config_array, true) . ';') !== false; } if ($ok) { $userDAO = new FreshRSS_UserDAO(); $ok &= $userDAO->createUser($new_user_name); } invalidateHttpCache(); $notif = array('type' => $ok ? 'good' : 'bad', 'content' => _t('feedback.user.created' . (!$ok ? '.error' : ''), $new_user_name)); Minz_Session::_param('notification', $notif); } $redirect_url = urldecode(Minz_Request::param('r', false, true)); if (!$redirect_url) { $redirect_url = array('c' => 'user', 'a' => 'manage'); } Minz_Request::forward($redirect_url, true); }
function process_get() { global $page; global $MySelf; $ajax = 0; switch ($_GET['action']) { // Maintenance! case "maintenance": $page = maintenance(); break; // a specific run is requested. // a specific run is requested. case "show": $page = listRun(); $ajax = 20; break; // a profile is requested. // a profile is requested. case "profile": $page = profile(); break; // a profile change is requested. // a profile change is requested. case "modprofile": $page = modProfile(); break; // Admin request to delete an api key (NOT user deleting own!) // Admin request to delete an api key (NOT user deleting own!) case "delapi": $page = deleteAPIKey(); break; // Quick toggle of login capabilities. // Quick toggle of login capabilities. case "toggleLogin": $page = toggleLogin(); break; // Quick confirm an account. // Quick confirm an account. case "quickconfirm": $page = quickConfirm(); break; // Change of eMail requested // Change of eMail requested case "changeemail": $page = makeEmailChangeForm(); break; // Show corp hierarchy // Show corp hierarchy case "hierarchy": $page = showHierarchy(); break; // Browser solar Systems // Browser solar Systems case "browse": $page = browser(); break; // User wants to delete a run. // User wants to delete a run. case "deleterun": deleteRun(); break; // User wants to see the preferences page. // User wants to see the preferences page. case "preferences": $page = makePreferences(); break; // A banker wants to see the transaction log for a user. // A banker wants to see the transaction log for a user. case "showTransactions": $page = showTransactions(); break; // User wants to manage his cans. // User wants to manage his cans. case "cans": $page = makeCanPage(); break; // Print out fancy global statistics // Print out fancy global statistics case "globstats": $page = globalStatistics(); break; // User wants to re-validate his email. // User wants to re-validate his email. case "revalidate": validate(); break; // User wants to pop a can. // User wants to pop a can. case "popcan": $page = popCan(); break; // Kick a user. // Kick a user. case "kickban": $page = kick(); break; // User wants to toggle the empty/full setting of a can. // User wants to toggle the empty/full setting of a can. case "togglecan": $page = toggleCan(); break; // close a run. // close a run. case "endrun": endrun(); break; // Show ore values // Show ore values case "showorevalue": $page = showOreValue(); break; // Show ship values // Show ship values case "showshipvalue": $page = showShipValue(); break; // Show Corp Hierarchy // Show Corp Hierarchy case "hier": $page = showHierarchy(); break; // manage payouts // manage payouts case "payout": $page = payout(); break; // set/view the online time // set/view the online time case "onlinetime": $page = onlineTime(); break; // Mods a template // Mods a template case "edittemplate": $page = editTemplate(); break; // Some Admin wants to change the ore values. // Some Admin wants to change the ore values. case "changeow": $page = makeOreWorth(); break; // Some Admin wants to change the ore values. // Some Admin wants to change the ore values. case "changesv": $page = makeShipValue(); break; // Password change request. We wont touch that. // Password change request. We wont touch that. case "changepw": $page = makePWChangeForm(); break; // User wants to join the selected run. // User wants to join the selected run. case "joinrun": $page = joinRun(); break; // User wants to part the selected run. // User wants to part the selected run. case "partrun": $page = leaveRun(); break; // Password change request. We wont touch that. // Password change request. We wont touch that. case "lostpass": $page = makeLostPassForm(); break; // Lotto: Create group // Lotto: Create group case "lotto_createGroup": $page = lotto_createGroup(); break; // add ore from a haul to an open run. // add ore from a haul to an open run. case "addhaul": $page = addHaulPage(); break; // Edit site configuration // Edit site configuration case "configuration": $page = configuration(); break; // Add an event. // Add an event. case "addevent": $page = addEvent(); break; // Show all events. // Show all events. case "showevents": $page = showEvents(); break; // Join an Event // Join an Event case "joinevent": $page = joinEvent(); break; // Show an event. // Show an event. case "showevent": $page = showEvent(); break; // lists all ore runs. // lists all ore runs. case "list": $page = listRuns(); $ajax = 60; break; // Manage wallet // Manage wallet case "manageWallet": $page = manageWallet(); break; // Show current ranks // Show current ranks case "showranks": $page = showRanks(); break; // delete a rank // delete a rank case "deleterank": $page = delRank(); break; // delete an event from the database. // delete an event from the database. case "deleteevent": $page = deleteEvent(); break; // lists all users. // lists all users. case "editusers": $page = listUsers(); break; // lists one user. // lists one user. case "edituser": $page = listUser(); break; // prints the form for a new run. // prints the form for a new run. case "newrun": $page = makeNewOreRunPage(); break; // add a new user. // add a new user. case "newuser": $page = makeAddUserForm(); break; // Toggle the charity flag. // Toggle the charity flag. case "toggleCharity": toggleCharity(); break; /* Locking unlocking */ /* Locking unlocking */ case "lockrun": toggleLock(); break; // prints the main welcome page. // prints the main welcome page. default: $page = makeWelcome(); break; /* LOTTO STUFF */ /* LOTTO STUFF */ case "editLotto": $page = lotto_editLottery(); break; case "lotto": $page = lotto_playLotto(); break; case "claimTicket": lotto_claimTicket(); break; case "drawLotto": lotto_draw(); break; case "buycredits": $page = lotto_buyTickets(); break; case "style": $page = style(); break; case "getItemList": $page = getItemList(); break; case "switch": $MySelf = null; $_SESSION['MySelf'] = null; unset($_SERVER[QUERY_STRING]); makeLoginPage($SUPPLIED_USERNAME); break; } if ($ajax > 1) { $ajaxHtml = "<script>window.setTimeout(function(){\$.ajax({"; if (isset($_REQUEST['ajax'])) { $ajaxHtml .= "url: '?" . $_SERVER['QUERY_STRING'] . "',"; } else { $ajaxHtml .= "url: '?" . $_SERVER['QUERY_STRING'] . "&ajax',"; } $ajaxHtml .= "success: function(data) {\$('#content').html(data);}"; $ajaxHtml .= "});},(" . $ajax * 1000 . "));</script>"; $page .= $ajaxHtml; } if (isset($_REQUEST['ajax'])) { $html = new html(); $page = $html->clean($page); print $page; } else { // Clean & Print the page. $html = new html(); $html->addBody($page); print $html->flush(); } }
/** * Return if the maximum number of registrations has been reached. * * Note a max_regstrations of 0 means there is no limit. * * @return true if number of users >= max registrations, false else. */ function max_registrations_reached() { $system_conf = Minz_Configuration::get('system'); $limit_registrations = $system_conf->limits['max_registrations']; $number_accounts = count(listUsers()); return $limit_registrations > 0 && $number_accounts >= $limit_registrations; }
function listUserSelectFormat($idUser) { $val = ''; $val .= ' <select id="userList" name="userName"> <option value="0">Selecione un amigo!</option> '; foreach (listUsers($idUser) as $usr) { $val .= ' <option value="' . $usr['ID'] . '">' . $usr['NOMBRE'] . '</option> '; } $val .= ' </select> '; return $val; }
<?php require 'include/functions.php'; include 'include/head.html'; ?> <h2>List of users</h2> <table width='500px'> <thead> <tr> <th>Name</th> <th>Email address</th> <th>Phone number</th> </tr> </thead> <tbody> <?php $users = listUsers(); foreach ($users as $user) { echo "<tr align='center'>"; echo "<td><a href='view_user.php?id=" . $user['user_id'] . "'>" . $user['name'] . "</a></td>"; echo "<td><a href='view_user.php?id=" . $user['user_id'] . "'>" . $user['email'] . "</a></td>"; echo "<td><a href='view_user.php?id=" . $user['user_id'] . "'>" . $user['phone'] . "</a></td>"; } echo "</tr>"; ?> </tbody> </table> </body> </html>