public function create() { try { $profileId = UserHelper::getProfileId(); $msg = new Msg(); $msg->setSender($profileId); $msg->setContent(trim(fRequest::get('msg-content'))); $re = trim(fRequest::get('dest', 'integer')); $x = new Profile($re); $msg->setReceiver($re); if (strlen($msg->getContent()) < 1) { throw new fValidationException('信息长度不能少于1个字符'); } if (strlen($msg->getContent()) > 140) { throw new fValidationException('信息长度不能超过140个字符'); } $msg->store(); //Activity::fireNewTweet(); fMessaging::create('success', 'create msg', '留言成功!'); } catch (fNotFoundException $e) { fMessaging::create('failure', 'create msg', '该用户名不存在!'); } catch (fException $e) { fMessaging::create('failure', 'create msg', $e->getMessage()); } fURL::redirect(SITE_BASE . '/profile/' . $re . '/msgs'); }
function ensureLogin() { global $user; if (!isset($user)) { fURL::redirect("/login.php?forward={$_SERVER['REQUEST_URI']}"); } }
/** * Upload an image file for avatar */ public function upload() { try { if (self::isImage($_FILES['avatar-file']) && move_uploaded_file($_FILES['avatar-file']['tmp_name'], $this->uploadfile)) { fURL::redirect(SITE_BASE . '/avatar/edit'); } else { throw new fValidationException('上传图片失败'); } } catch (Exception $e) { fMessaging::create('failure', 'upload avatar', $e->getMessage()); fURL::redirect(SITE_BASE . '/profile/' . UserHelper::getProfileId()); } }
public function upload() { $uploadfile = UPLOAD_DIR . basename($_FILES['userfile']['name']); try { if (self::validFile($uploadfile) && move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) { fURL::redirect(SITE_BASE . '/manage'); } else { throw new fValidationException('上传失败'); } } catch (Exception $e) { fMessaging::create('failure', 'upload file', $e->getMessage()); fURL::redirect(SITE_BASE . '/manage'); } }
public function show($id) { $this->cache_control('private', 2); try { $this->record = new Record($id); if (!$this->record->isReadable()) { throw new fAuthorizationException('You are not allowed to read this record.'); } $this->nav_class = 'status'; $this->render('record/show'); } catch (fExpectedException $e) { fMessaging::create('warning', $e->getMessage()); fURL::redirect(Util::getReferer()); } catch (fUnexpectedException $e) { fMessaging::create('error', $e->getMessage()); fURL::redirect(Util::getReferer()); } }
public function reply($id) { try { $tweet = new Tweet($id); $comment = new TweetComment(); $comment->setTweetId($tweet->getId()); $comment->setProfileId(UserHelper::getProfileId()); $comment->setContent(trim(fRequest::get('tweet-comment'))); if (strlen($comment->getContent()) < 1) { throw new fValidationException('回复长度不能少于1个字符'); } if (strlen($comment->getContent()) > 140) { throw new fValidationException('回复长度不能超过140个字符'); } $comment->store(); } catch (fException $e) { // TODO } fURL::redirect(SITE_BASE . '/profile/' . $tweet->getProfileId() . '#tweet/' . $tweet->getId()); }
public function create() { try { $profileId = UserHelper::getProfileId(); $mail = new Mail(); $mail->setSender($profileId); $mail->setContent(trim(fRequest::get('mail-content'))); $re = trim(fRequest::get('dest')); if (empty($re)) { $re = trim(fRequest::get('destre', 'integer')); $pa = trim(fRequest::get('parent', 'integer', -1)); $x = new Profile($re); $mail->setReceiver($re); $mail->setParent($pa); } else { //$receiver=fRecordSet::build('Profile',array('login_name=' => $re ),array())->getRecord(0); $receiver = fRecordSet::build('Profile', array('login_name=' => $re), array()); if ($receiver->count()) { $receiver = $receiver->getRecord(0); } else { throw new fNotFoundException('user doesn\'t exist'); } $mail->setReceiver($receiver->getId()); } if (strlen($mail->getContent()) < 1) { throw new fValidationException('信息长度不能少于1个字符'); } if (strlen($mail->getContent()) > 140) { throw new fValidationException('信息长度不能超过140个字符'); } $mail->store(); //Activity::fireNewTweet(); fMessaging::create('success', 'create mail', '信息发送成功!'); } catch (fNotFoundException $e) { fMessaging::create('failure', 'create mail', '该用户名不存在,或该用户没有创建个人资料!'); } catch (fException $e) { fMessaging::create('failure', 'create mail', $e->getMessage()); } fURL::redirect(SITE_BASE . '/inbox'); }
public function show($id) { if (fAuthorization::checkLoggedIn()) { $this->cache_control('private', 30); } else { $this->cache_control('private', 60); } try { $this->problem = new Problem($id); if ($this->problem->isSecretNow()) { if (!User::can('view-any-problem')) { throw new fAuthorizationException('Problem is secret now.'); } } $this->nav_class = 'problems'; $this->render('problem/show'); } catch (fExpectedException $e) { fMessaging::create('warning', $e->getMessage()); fURL::redirect(Util::getReferer()); } catch (fUnexpectedException $e) { fMessaging::create('error', $e->getMessage()); fURL::redirect(Util::getReferer()); } }
<?php $title = 'Project Storage'; require './header.php'; $cards = fRecordSet::build('Card', array('uid=' => $_GET['cardid'])); if ($cards->count() == 0) { fURL::redirect("/kiosk/addcard.php?cardid=" . $_GET['cardid']); } $card = $cards->getRecord(0); $user = new User($card->getUserId()); $user->load(); if (isset($_POST['print'])) { $project = new Project($_POST['print']); $project->load(); if ($project->getUserId() != $user->getId()) { print "Incorrect project ID"; exit; } $data = array('storage_id' => $project->getId(), 'name' => $project->getName(), 'ownername' => $user->getFullName(), 'more_info' => $project->getDescription(), 'completion_date' => $project->getToDate()->format('Y/m/d'), 'max_extention' => "14"); $data_string = json_encode($data); $ch = curl_init('http://kiosk.london.hackspace.org.uk:12345/print/dnh'); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST"); curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json', 'Content-Length: ' . strlen($data_string))); $result = curl_exec($ch); curl_close($ch); echo "<p>Your sticker is being printed now.</p>"; } $projects = fRecordSet::build('Project', array('state_id!=' => array('6', '7'), 'user_id=' => $user->getId())); ?>
/** * Checks to see if any values (search or sort) were loaded from the session, and if so redirects the user to the current URL with those values added * * @return void */ public static function redirectWithLoadedValues() { // If values were reset, redirect to the plain URL if (self::wasResetRequested()) { fURL::redirect(fURL::get() . fURL::removeFromQueryString('reset')); } $query_string = fURL::replaceInQueryString(array_keys(self::$loaded_values), array_values(self::$loaded_values)); $url = fURL::get() . $query_string; if ($url != fURL::getWithQueryString() && $url != fURL::getWithQueryString() . '?') { fURL::redirect($url); } }
foreach ($subscriptions as $sub) { $user_id = $sub['user_id']; if (!in_array($user_id, $alt_ids) && $user_id != $id_user_session) { $user = new User($sub['user_id']); $recipients[] = array("mail" => $user->getEmail(), "name" => $user->getUsername()); } } if (!empty($recipients)) { // Send the mail to everybody notify_multiple_users($user_session, $recipients, $subject_mail, $content_mail); fMessaging::create('success', fURL::get(), 'The mail "' . $subject_mail . '" was successfully sent to all the users who subscribe to "' . $check->getName() . '"'); } else { fMessaging::create('error', fURL::get(), "Nobody subscribe to this check"); } } } } catch (fNotFoundException $e) { fMessaging::create('error', $manage_url, 'The check requested, ' . fHTML::encode($check_id) . ', could not be found'); fURL::redirect($manage_url); } catch (fExpectedException $e) { fMessaging::create('error', fURL::get(), $e->getMessage()); } $page_num = fRequest::get('page', 'int', 1); $url_redirect = CheckResult::makeURL('list', $check) . "&page=" . $page_num; fURL::redirect($url_redirect); } else { $page_num = fRequest::get('page', 'int', 1); $check_results = CheckResult::findAll($check_id, false, $GLOBALS['PAGE_SIZE'], $page_num); include VIEW_PATH . '/list_check_results.php'; } }
/** * Overrides the value of `'action'` in the `DELETE`/`PUT` post data, `$_POST` or `$_GET` superglobals based on the `'action::{action_name}'` value * * This method is primarily intended to be used for hanlding multiple * submit buttons. * * @param string $redirect The url to redirect to if the action is overriden. `%action%` will be replaced with the overridden action. * @return void */ public static function overrideAction($redirect = NULL) { self::initPutDelete(); $found = FALSE; $globals = array(&$_GET, &$_POST, &self::$put_delete); foreach ($globals as &$global) { foreach ($global as $key => $value) { if (substr($key, 0, 8) == 'action::') { $found = (bool) ($global['action'] = substr($key, 8)); unset($global[$key]); } } } if ($redirect && $found) { fURL::redirect(str_replace('%action%', $found, $redirect)); } }
try { $user->populate(); } catch (fExpectedException $e) { fMessaging::create('error', fURL::get(), $e - getMessage()); } } include VIEW_PATH . '/add_edit_user_settings.php'; } elseif ('delete' == $action) { try { $user = new User($user_id); if (fRequest::isPost()) { fRequest::validateCSRFToken(fRequest::get('token')); $user->delete(); fMessaging::create('success', User::makeUrl('edit', $user), 'The user ' . $user->getName() . ' was successfully deleted'); fURL::redirect(User::makeUrl('edit', $user)); } } catch (fNotFoundException $e) { fMessaging::create('error', User::makeUrl('edit', $user), 'The line requested could not be found'); fURL::redirect(User::makeUrl('edit', $user)); } catch (fExpectedException $e) { fMessaging::create('error', fURL::get(), $e->getMessage()); } include VIEW_PATH . '/delete.php'; } else { if (!fAuthorization::checkAuthLevel('admin')) { fURL::redirect(User::makeURL('edit', fSession::get('user_id'))); } else { $users = User::findAll(); include VIEW_PATH . '/list_users.php'; } }
$page = 'cards'; $title = 'Add card'; $desc = ''; require '../header.php'; if (!isset($user)) { fURL::redirect('/login.php?forward=/members/cards.php'); } if (isset($_POST['submit'])) { try { fRequest::validateCSRFToken($_POST['token']); $card = new Card(); $card->setUserId($user->getId()); $card->setAddedDate(time()); $card->setUid($_POST['uid']); $card->store(); fURL::redirect('/members/cards.php'); exit; } catch (fValidationException $e) { echo "<p>" . $e->printMessage() . "</p>"; } catch (fSQLException $e) { echo "<p>An unexpected error occurred, please try again later</p>"; trigger_error($e); } } ?> <h2>Add card</h2> <form method="POST"> <input type="hidden" name="token" value="<?php echo fRequest::generateCSRFToken(); ?>
// Get objects matching the printer/consumable $consumable = new Consumable($consumable_id); // Update cost if present if ($cost) { $consumable->setCost($cost); $consumable->store(); } // Update consumable $updated = $consumable->increaseStockBy($qty); #die(var_export($updated)); // Check status of installation if ($updated == FALSE) { fMessaging::create('error', $redirect, $consumable->err); fURL::redirect($redirect); } else { fMessaging::create('success', $redirect, sprintf('The consumable stock for %s has been updated.', $consumable->getName())); fURL::redirect($redirect); } } catch (fNotFoundException $e) { fMessaging::create('error', $redirect, 'The requested object with ID ' . $id . ', could not be found.'); fURL::redirect($redirect); } } else { // Get consumable object from ID if ($consumable_id != NULL) { $c = Consumable::getOne($consumable_id); } // No POSTed data, show form (based on request method) $view = fRequest::isAjax() ? 'ajax.php' : 'simple.php'; include 'views/stock/' . $view; }
<?php $title = 'Membership Management'; $page = 'main'; require './header.php'; $cardid = strtoupper($_GET['cardid']); $cards = fRecordSet::build('Card', array('uid=' => $cardid)); if ($cards->count() == 0) { fURL::redirect("/kiosk/addcard.php?cardid=" . $cardid); } $card = $cards->getRecord(0); $user = new User($card->getUserId()); $user->load(); if ($user->isMember()) { $result = fRecordSet::build('Transaction', array('user_id=' => $user->getId(), 'timestamp>' => new fDate('2009-01-01'), 'timestamp<' => new fDate('now')), array('timestamp' => 'desc')); if (sizeof($result) > 1) { $expires = strtotime($result[0]->getTimestamp()); # 30 days ~= a month # we don't include the 14 days grace period here. $expires += 30 * 24 * 60 * 60; $expires = date('d F Y', $expires); } else { # This is a special case for Russ, whose payments don't get # automatically recognised due to issues with payments between # barclays accounts on the same login $expires = null; } } ?> <?php
header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Content-Type: application/force-download"); header("Content-Type: application/octet-stream"); header("Content-Type: application/download"); header("Content-Disposition: attachment; filename=\"" . $json_name . "\""); header("Content-Transfer-Encoding: binary"); echo $json_to_send, "\n"; } } elseif ('import' == $action) { if (isset($_FILES['uploadedfile']['tmp_name']) && $_FILES['uploadedfile']['error'] == UPLOAD_ERR_OK) { $file = $_FILES['uploadedfile']['tmp_name']; $content = fread(fopen($file, "r"), filesize($file)); $filter_group_id = $_POST['filter_group_id']; if ($filter_group_id < 0) { $result_ok = Dashboard::import_from_json_to_group($content); } else { $result_ok = Dashboard::import_from_json_to_group($content, $filter_group_id); } if ($result_ok) { fMessaging::create('success', "/" . Dashboard::makeUrl('list'), 'The Dashboard was successfully imported'); } } fURL::redirect(Dashboard::makeUrl('list', $filter_group_id)); } else { if ($filter_group_id == -1) { $dashboards = Dashboard::findAll(); } else { $dashboards = Dashboard::findAllByFilter($filter_group_id); } include VIEW_PATH . '/list_dashboards.php'; }
<?php require_once( $_SERVER['DOCUMENT_ROOT'] . '/../lib/init.php'); if (!isset($user)) { fURL::redirect('/login.php?forward=/members/egm-2016-01-13-transcript.php'); } if ($user->isMember() && isset($_GET['dl']) && $_GET['dl'] == 'pdf') { header('Content-Type: application/pdf'); header('Content-Disposition: inline'); echo file_get_contents('../../var/LondonHackspaceEGM2016-v1.0.pdf'); } else if ($user->isMember() && isset($_GET['dl']) && $_GET['dl'] == 'html') { header('Content-Type: text/html'); echo file_get_contents('../../var/LondonHackspaceEGM2016-v1.0.html'); } else { if ($user->isMember()) { $page = 'transcript'; $title = "Transcript"; $desc = ''; require('../header.php'); ?> <h2>Transcript of 2016 EGM</h2> <p>Please treat this as confidential and do not pass it on to non-members, if in doubt please direct them to this page.</p> <p>Select a format:
$validator->addEmailFields('email'); $validator->validate(); if ($_POST['newpassword'] != '') { if ($_POST['newpassword'] != $_POST['newpasswordconfirm']) { throw new fValidationException('Passwords do not match'); } $user->setPassword(fCryptography::hashPassword($_POST['newpassword'])); } $user->setEmail(strtolower(trim($_POST['email']))); $user->setFullName(trim($_POST['fullname'])); $user->setAddress(trim($_POST['address'])); $user->setSubscriptionPeriod($_POST['length']); $user->setEmergencyName(trim($_POST['emergency_name'])); $user->setEmergencyPhone(trim($_POST['emergency_phone'])); $user->store(); fURL::redirect('?saved'); exit; } catch (fValidationException $e) { echo "<p>" . $e->printMessage() . "</p>"; } catch (fSQLException $e) { echo "<p>An unexpected error occurred, please try again later</p>"; trigger_error($e); } } if (isset($_GET['saved'])) { echo "<div class=\"alert alert-success\"><p>Details saved.</p></div>"; } ?> <p><a href="http://www.legislation.gov.uk/ukpga/2006/46/part/8/chapter/2/crossheading/general">UK law</a> requires us to store the full name and address of all our members. If you don't provide these details, you won't receive membership privileges.</p>
/* * For a card-adding station return a page that can be filled in with the scanned UID * * There are two ways to use this page (the second is preferable on a shared machine) * * - start a browser with the UID in the querystring (with --incognito or equivalent) * - download temporarily, replace {0} with the UID, and point a browser at that file * * This page will only be served over SSL and will redirect the user to a login page. * */ require_once $_SERVER['DOCUMENT_ROOT'] . '/../lib/init.php'; if ($user) { fSession::destroy(); fURL::redirect(); } $uid = isset($_GET['uid']) ? htmlentities($_GET['uid']) : '{0}'; ?> <!DOCTYPE html> <html> <head> <title>Add card redirect</title> <style type="text/css"> form {display: none} </style> </head> <body> <p>Redirecting, please wait...</p> <form name="addcard" action="<?php echo fURL::getDomain();
if ($users->count() == 0) { throw new fValidationException('Invalid username or password.'); } $rec = $users->getRecords(); $user = $rec[0]; if (!fCryptography::checkPasswordHash($_POST['password'], $user->getPassword())) { throw new fValidationException('Invalid username or password.'); } fSession::set('user', $user->getId()); if (fRequest::get('persistent_login', 'boolean')) { fSession::enablePersistence(); } if (isset($_POST['forward'])) { fURL::redirect('http://' . $_SERVER['SERVER_NAME'] . $_POST['forward']); } else { fURL::redirect('/members'); } exit; } catch (fValidationException $e) { echo "<p>" . $e->printMessage() . "</p>"; } catch (fSQLException $e) { echo "<p>An unexpected error occurred, please try again later</p>"; trigger_error($e); } } ?> <h2>Log In</h2> <form method="post"> <input type="hidden" name="token" value="<?php echo fRequest::generateCSRFToken(); ?>
fMessaging::create('success', $manage_url, 'The Graph ' . $graph->getName() . ' was successfully created'); fURL::redirect(Graph::makeUrl('edit', $graph)); } catch (fExpectedException $e) { fMessaging::create('error', fURL::get(), $e->getMessage()); } } include VIEW_PATH . '/add_edit_graph.php'; } elseif ('delete' == $action) { $class_name = 'Graph'; try { $obj = new Graph($graph_id); $dashboard = new Dashboard($obj->getDashboardId()); $delete_text = 'Are you sure you want to delete the graph : <strong>' . $obj->getName() . '</strong>?'; if (fRequest::isPost()) { fRequest::validateCSRFToken(fRequest::get('token')); $obj->delete(); $lines = Line::findAll($graph_id); foreach ($lines as $line) { $line->delete(); } fMessaging::create('success', Dashboard::makeUrl('edit', $dashboard), 'The graph for ' . $dashboard->getName() . ' was successfully deleted'); fURL::redirect(Dashboard::makeUrl('edit', $dashboard)); } } catch (fNotFoundException $e) { fMessaging::create('error', Dashboard::makeUrl('edit', $dashboard), 'The line requested could not be found'); fURL::redirect(Dashboard::makeUrl('edit', $dashboard)); } catch (fExpectedException $e) { fMessaging::create('error', fURL::get(), $e->getMessage()); } include VIEW_PATH . '/delete.php'; }
// Get list of models $models = Model::getSimple($db); // Get types if (feature('consumable_types')) { $types = Tag::get_by_type('consumable_type'); } include 'views/consumables/addedit.php'; } /** * Delete a consumable */ if ($action == 'delete') { // Get ID $id = fRequest::get('id', 'integer'); try { $c = new Consumable($id); if (fRequest::isPost()) { $c->delete(); fMessaging::create('success', fURL::get(), 'The consumable ' . $c->getName() . ' was successfully deleted.'); fURL::redirect(fURL::get()); } } catch (fNotFoundException $e) { fMessaging::create('error', fURL::get(), 'The consumable requested, ID ' . $id . ', could not be found.'); fURL::redirect($manage_url); } catch (fExpectedException $e) { fMessaging::create('error', fURL::get(), $e->getMessage()); } catch (fSQLException $e) { fMessaging::create('error', fURL::get(), 'Database error: ' . $e->getMessage()); } include 'views/consumables/delete.php'; }
/** * Redirects the user to the login page * * @return void */ private static function redirect() { self::setRequestedURL(fURL::getWithQueryString()); fURL::redirect(self::$login_page); }
<?php $page = 'members'; require '../header.php'; if (!$user) { fURL::redirect('/login.php?forward=/members'); } ?> <h2>Members Area</h2> <?php if ($user->getAddress() == '') { ?> <h4>More Details Required</h4> <p>UK Law requires that we store our members' real name and address. Since you haven't provided these details you will be unable to gain membership privileges until you do.</p> <p>Please <a href="/members/edit.php">provide your details</a> to continue.</p> <?php } else { if ($user->isMember()) { ?> <p>You're currently a member of London Hackspace, thanks for your support!</p> <h3>Your Recent Payments</h3> <table> <tr> <th>Date</th> <th>Amount</th> </tr>
if (isset($_POST['type'])) { if ($_POST['type'] == "logout") { fAuthorization::destroyUserInfo(); } else { if ($_POST['type'] == "login") { try { $user = new User($_POST['username']); } catch (fException $e) { fURL::redirect(URL_ROOT . "authentication.php"); } if (sha1($_POST['password']) == $user->getPassword()) { fAuthorization::setUserAuthLevel($user->getLevel()); fAuthorization::setUserToken($_POST['username']); fURL::redirect(fAuthorization::getRequestedUrl(true, URL_ROOT . "inventory.php")); } else { fURL::redirect(URL_ROOT . "authentication.php"); } } } } else { if (isset($_GET['type']) == "logout") { fAuthorization::destroyUserInfo(); } } $tmpl->place('header'); $tmpl->place('menu'); ?> <div class="span-24 last"> <span id="statusbar"></span> <form id="loginForm" action="authentication.php" method="post" accept-charset="utf-8"> <div id="loginBox">
if ($newStatus != $project->getState() && $project->canTransitionStates($project->getState(), $newStatus)) { $project->setState($newStatus); $project->store(); if ($reason != '') { $reason = ' with the reason \'' . $reason . "'"; } // log the update $project->submitLog('Status changed to ' . $project->getState() . $reason, $user->getId()); if ($project->getState() != 'Archived') { // send to mailing list $project->submitMailingList('Status changed to ' . $project->getState() . $reason . " by " . htmlspecialchars($user->getFullName())); // inform the owner $project->submitEmailToOwner("Dear {$projectUser->getFullName()},<br/><br/>" . "This is an automatic email to let you know your project {$project->getName()} has been updated with status {$project->getState()}{$reason}.<br/><br/>" . "If you have any questions or concerns regarding this change you can discuss this with members on the <a href=\"{$project->getMailingListURL()}\">Mailing List</a>.<br/><br/>" . "Best,<br/>Monkeys in the machine"); } } fURL::redirect("/storage/list.php"); } catch (fValidationException $e) { echo $e->printMessage(); } catch (fSQLException $e) { echo '<div class="alert alert-danger">An unexpected error occurred, please try again later</div>'; } } ?> <?php if ($user->getId() == $project->getUserId() && ($project->getState() == 'Pending Approval' || $project->getState() == 'Unapproved')) { ?> <small class="edit_bttn"> <a href="/storage/edit/<?php echo $project->getId(); ?>
<?php $page = 'retention'; require '../header.php'; if (!isset($user)) { fURL::redirect('/login.php?forward=/stats/interests.php'); } if (!$user->isMember()) { fURL::redirect('/members/index.php'); } ?> <div class="stats-page"> <h2>Member Interests</h2> <?php $graph = array(); $totalQuery = $db->translatedQuery("SELECT COUNT(user_id) FROM users, users_profiles p WHERE users.id = p.user_id AND disabled_profile = 0 AND subscribed = 1"); $total = $totalQuery->fetchScalar(); $query = $db->translatedQuery("SELECT COUNT(user_id) AS total, name, category FROM users_interests, interests WHERE users_interests.interest_id = interests.interest_id GROUP BY name HAVING total > 2 ORDER BY total DESC;"); $cats = $db->translatedQuery("SELECT COUNT(DISTINCT user_id) AS total, category FROM users_interests, interests WHERE users_interests.interest_id = interests.interest_id GROUP BY category HAVING total > 2 ORDER BY total DESC;"); ?> <p>From a total of <?php echo $total; ?> completed profiles.</p> <div id="chartCats_div" style="width: 1000px; height: 200px;"></div> <br/> <table class="calc-numbers"> <thead> <tr> <th>Count Members</th>
<?php include './resources/init.php'; fURL::redirect("authentication.php");
$errmsg = ''; if (fRequest::isPost()) { $old_password = fRequest::get('old-password'); $new_password = fRequest::get('new-password'); $confirm_password = fRequest::get('confirm-password'); $token = fAuthorization::getUserToken(); $username = $token['name']; $user_id = $token['id']; if (empty($old_password) or empty($new_password) or empty($confirm_password)) { $errmsg = '密码不能为空'; } else { if ($new_password != $confirm_password) { $errmsg = '两次输入的新密码不一致'; } else { if (login_check_credential($db, $username, $old_password) == false) { $errmsg = '旧密码错误'; } else { if (login_change_password($db, $user_id, $new_password)) { fURL::redirect(fSession::delete('change-password-referer', SITE_BASE)); } else { $errmsg = '修改密码失败'; } } } } } else { if (fSession::get('change-password-referer') == null) { fSession::set('change-password-referer', login_get_referer(SITE_BASE)); } } include __DIR__ . '/tpl/change-password.php';