public function update($id, $u) { $u = new user(); $result = $u->update($id); if ($result) { $this->dashboard(); } else { header('location:index.php?contrpller=use&action=update&id=' . $id); } }
private static function save($user_id, $username, $password) { if ($user_id * 1 === -1) { $user = new user(); $user->username = $username; $user->password = md5($password); $user->insert(); } else { $user = new user(); $user->id = $user_id; $user->username = $username; $user->password = md5($password); $user->update(); } }
public function saveUserSettings() { Flight::auth()->check(); if (Flight::request()->data->id != Flight::auth()->currentUser->id) { Flight::auth()->check(20); } $user = Flight::users()->getUserWithId(Flight::request()->data->id); $response = Flight::util()->validate('user', Flight::request()->data, true); if (is_array($response)) { Flight::util()->render('editUser', array("teams" => Flight::teams()->getAllTeams(), "user" => $user, "error" => $response)); return; } $user = new user(Flight::request()->data); $user->teams = Flight::request()->data->teams; if ($user->update()) { Flight::util()->render('editUser', array("teams" => Flight::teams()->getAllTeams(), "user" => $user, "flash" => array("word" => "User", "action" => "updated"))); } }
static function activate($uid, $karmalevel = 'pear.dev') { require_once 'Damblan/Karma.php'; global $dbh, $auth_user; $karma = new Damblan_Karma($dbh); $user = user::info($uid, null, 0); if (!isset($user['registered'])) { return false; } @($arr = unserialize($user['userinfo'])); include_once 'pear-database-note.php'; note::removeAll($uid); $data = array(); $data['registered'] = 1; $data['active'] = 1; /* $data['ppp_only'] = 0; */ if (is_array($arr)) { $data['userinfo'] = $arr[1]; } $data['created'] = gmdate('Y-m-d H:i'); $data['createdby'] = $auth_user->handle; $data['handle'] = $user['handle']; user::update($data, true); $karma->grant($user['handle'], $karmalevel); if ($karma->has($user['handle'], 'pear.dev')) { include_once 'pear-rest.php'; $pear_rest = new pearweb_Channel_REST_Generator(PEAR_REST_PATH, $dbh); $pear_rest->saveMaintainerREST($user['handle']); $pear_rest->saveAllMaintainersREST(); } include_once 'pear-database-note.php'; note::add($uid, "Account opened"); $msg = "Your PEAR account request has been opened.\n" . "To log in, go to http://" . PEAR_CHANNELNAME . "/ and click on \"login\" in\n" . "the top-right menu.\n"; $xhdr = 'From: ' . $auth_user->handle . '@php.net'; if (!DEVBOX) { mail($user['email'], "Your PEAR Account Request", $msg, $xhdr, '-f ' . PEAR_BOUNCE_EMAIL); } return true; }
} } elseif ($_REQUEST['cmd'] == "Delete Request" && !empty($_REQUEST['uid'])) { // Delete account request include_once 'pear-database-user.php'; if (is_array($_REQUEST['uid'])) { foreach ($_REQUEST['uid'] as $uid) { user::remove($uid); echo 'Account request deleted: ' . $uid . '<br />'; } } elseif (user::remove($_REQUEST['uid'])) { print "<p>Deleted account request for \"{$uid}\"...</p>"; } } elseif ($_REQUEST['cmd'] == 'Move' && !empty($_REQUEST['acreq']) && isset($_REQUEST['from_site']) && in_array($_REQUEST['from_site'], array('pear', 'pecl'))) { include_once 'pear-database-user.php'; $data = array('handle' => $_REQUEST['acreq'], 'from_site' => $_REQUEST['from_site']); $res = user::update($data); if (DB::isError($res)) { echo 'DB error: ' . $res->getMessage(); } else { $to = strtoupper($_REQUEST['from_site']); echo 'User has been moved to ' . $to; } } } // }}} // {{{ javascript functions ?> <script type="text/javascript"> <!-- function confirmed_goto(url, message) {
} $user = new user(); // insert some rows $user->insert(array("username" => "Pekka", "city" => "Helsinki", "sex" => "Yes please")); $user->insert(array("username" => "Simo", "city" => "Helsinki")); $user->insert(array("username" => "Jaana", "city" => "Tampere")); $user->insert(array("username" => "Bill", "city" => "Seattle")); // find single row $pekka = $user->findOne(array("username" => "Pekka")); echo '<p>Found ' . $pekka['username'] . ' from ' . $pekka['city'] . '</p>'; // fetch all rows $rows = $user->getAll(); echo '<p>Found ' . $rows->count() . ' rows</p>'; foreach ($rows as $row) { echo '<p>Found ' . $row['username'] . ' from ' . $row['city'] . '</p>'; } // sort users by username $rows->sort(array("username" => -1)); echo '<p>Sorting users</p>'; foreach ($rows as $row) { echo '<p>Found ' . $row['username'] . ' from ' . $row['city'] . '</p>'; } // Pekka moved to Espoo, update row $user->update(array("username" => "Pekka"), array("city" => "Espoo")); // remove pekka from collection $user->remove(array("username" => "Pekka")); // finally some other demonstrations // MongoHelper will return you MongoDB and MongoCollection classes also, which you can use how ever you like $collection = $user->collection; print_r($collection->find(array("city" => "Helsinki"))); $mongodb = $user->mongo->authenticate("Pekka", "Pouta");
$data->select("t1_games", "*", "none", "id DESC", "1"); if ($data->sel_count_row > 0) { $crnt_game_id = $data->select_res['id']; if ($game_id == $crnt_game_id) { $option = $puzzle_no . "_plrs"; if ($data->select_res[$option] != "") { $crnt_plrs = json_decode($data->select_res[$option], true); $crnt_plrs[] = array($user_id, $ans, $money); $new_plrs = $crnt_plrs; } else { $new_plrs = array(array($user_id, $ans, $money)); } $new_plrs_str = json_encode($new_plrs); $new_total_plrs = $data->select_res['crnt_plrs'] + 1; $new_total_money = $data->select_res['crnt_money'] + 1; $data->update("t1_games", "crnt_plrs='{$new_total_plrs}', crnt_money='{$new_total_money}', {$option}='{$new_plrs_str}'", "id='{$game_id}'", "1"); $data->update("users", "balance='{$new_bal}', game_status='{$game_status}'", "id='{$user_id}'", "1"); $res = "You have Joined the Game Successfully. Now Wait for result!"; } else { $res = "You have missed this game, because time is over. Please refresh the page for new game!"; } } else { $res = "SOME ERROR!"; } } else { $res = "Your balance is low!"; } } else { $res = "You have Joined this Game-Table already!"; } } else {
$user->setId($_REQUEST['i']); $tmp = $user->returnOneUser(); $user->setUsername($tmp['name']); if (!empty($_REQUEST['password']) && !empty($_REQUEST['confirm_password'])) { if ($_REQUEST['password'] == $_REQUEST['confirm_password']) { $user->setPassword($_REQUEST['password']); } else { print 'Passwords erradas'; } } else { if (empty($_REQUEST['password']) && empty($_REQUEST['confirm_password'])) { $user->setOldPassword($tmp['password']); } else { print 'ola'; } } $user->setEmail($_REQUEST['email']); $user->setRank($_REQUEST['rank']); if ($user->update()) { print 'sucess'; } else { print 'failure'; } } else { print 'Email invalido'; //print'<script type="text/javascript">setTimeout(goBack(),2000);</script>'; } } } else { print 'error'; }
<?php require_once '/opt/lampp/htdocs/MySpace/src/init.php'; $user = new user(); if (!$user->isLoggedIn()) { redirect::to('index.php'); } if (input::exists()) { if (token::check(input::get('token'))) { $validate = new validation(); $validation = $validate->check($_POST, array('Password' => array('required' => true, 'min' => 8), 'Npassword' => array('required' => true, 'min' => 8), 'Rpassword' => array('required' => true, 'min' => 8, 'matches' => 'Npassword'))); if ($validation->passed()) { if (hash::make(input::get('Password')) !== $user->data()->Password) { echo 'your old password did not match'; } else { if ($user->update(array('Password' => hash::make(input::get('Npassword'))))) { session::flash('home', 'Your password have been updated!!'); redirect::to('index.php'); } } } } } ?> <link href="<?php echo 'register.css'; ?> " rel='stylesheet' type='text/css'> <form action="" method="post"> <div class="field"> <label id="icon" for="Password"><i class="icon-shield"></i></label>
public static function createUserReferralCodes() { $user = new user(); while ($user->loadNext()) { $referralId = $user->get_variable("users_referralid"); $userName = $user->get_variable("users_username"); echo $userName . " :" . $referralId; if (!isset($referralId) || strlen($referralId) == 0) { $user->set_variable("users_referralid", md5($userName)); $user->update(); } } }
if (!$auth_user->isAdmin()) { if (empty($_POST['password_old']) || empty($_POST['password']) || empty($_POST['password2'])) { PEAR::raiseError('Please fill out all password fields.'); break; } if ($user['password'] != md5($_POST['password_old'])) { PEAR::raiseError('You provided a wrong old password.'); break; } } if ($_POST['password'] != $_POST['password2']) { PEAR::raiseError('The new passwords do not match.'); break; } $data = array('password' => md5($_POST['password']), 'handle' => $handle); $result = user::update($data); if ($result) { // TODO do the SVN push here $expire = !empty($_POST['PEAR_PERSIST']) ? 2147483647 : 0; setcookie('PEAR_PW', md5($_POST['password']), $expire, '/'); report_success('Your password was successfully updated.'); } } $dbh->setFetchmode(DB_FETCHMODE_ASSOC); $row = $dbh->getRow('SELECT * FROM users WHERE handle = ?', array($handle)); if ($row === null) { error_handler(htmlspecialchars($handle) . ' is not a valid account name.', 'Invalid Account'); } $csrf_token_value = create_csrf_token($csrf_token_name); $form = new HTML_QuickForm2('account-edit', 'post'); $form->removeAttribute('name');
<?php // Initialize global $template, $config; // Update user profile if (isset($_POST['submit']) && $_POST['submit'] == tr('Update User Profile')) { // Update user $client = new user($_POST['userid']); $client->update(); // User message if ($template->has_errors != 1) { $template->add_message("Successfully updated user profile"); } $_REQUEST['username'] = DB::queryFirstField("SELECT username FROM users WHERE id = %d", $_POST['userid']); } // Get user if (!($user_row = DB::queryFirstRow("SELECT * FROM users WHERE username = %s", $_REQUEST['username']))) { trigger_error("Username does not exist, {$_REQUEST['username']}", E_USER_ERROR); } $_POST['userid'] = $user_row['id']; $_POST['is_admin'] = $user_row['group_id'] == 1 ? 1 : 0; $_POST['is_active'] = $user_row['status'] == 'active' ? 1 : 0; // Go through custom fields $custom_fields = ''; $custom_values = unserialize($user_row['custom_fields']); $rows = DB::query("SELECT * FROM users_custom_fields ORDER BY id"); foreach ($rows as $row) { $var = 'custom' . $row['id']; $value = isset($custom_values[$var]) ? $custom_values[$var] : ''; $custom_fields .= "<tr><td>" . $row['display_name'] . ":</td><td>"; if ($row['form_field'] == 'text') {
$uploadOk = 0; } } // Check file size if ($_FILES["fileToUpload"]["size"] > 500000) { echo "Sorry, your file is too large."; $uploadOk = 0; } // Allow certain file formats if ($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg" && $imageFileType != "gif") { echo "Sorry, only JPG, JPEG, PNG & GIF files are allowed."; $uploadOk = 0; } // Check if $uploadOk is set to 0 by an error if ($uploadOk == 0) { echo "Sorry, your file was not uploaded."; // if everything is ok, try to upload file } else { if (move_uploaded_file($_FILES["fileToUpload"]["tmp_name"], $target_file)) { try { $user->update(array('filepath' => $target_file)); Session::flash('home', 'Your details have been updated.'); Redirect::to('index.php'); } catch (Exception $e) { die($e->getMessage()); } echo "The file " . basename($_FILES["fileToUpload"]["name"]) . " has been uploaded."; } else { echo "Sorry, there was an error uploading your file."; } }
function edituser($obj) { try { $user = new user(); $user->id = isset($obj->id) ? $obj->id : ''; $user->name = isset($obj->name) ? $obj->name : ''; $user->password = isset($obj->password) ? $obj->password : ''; $user->group_id = isset($obj->group_id) ? $obj->group_id : 0; $user->update(); return array("status" => "success", "msg" => "Update Successful"); } catch (Exception $e) { return array("status" => "warning", "msg" => $e->getMessage()); } }
$res = login_by_qq(); } elseif ($_POST['submit_login']) { $_user = user::login($_POST); } elseif ($_GET['app']) { if ($_GET['baidu_uid']) { set_cookie('baidu_uid', $_GET['baidu_uid']); } } $baidu_uid = $_COOKIE['baidu_uid']; //如果是新注册用户 if ($res == 'new_user') { $_module = 'user'; $_view = 'user_register'; } elseif ($_user && $baidu_uid && $_user->baidu_uid != $baidu_uid) { $_user->baidu_uid = $baidu_uid; user::update(array('baidu_uid' => $baidu_uid)); delete_cookie('baidu_uid'); } elseif (!$_user && $_module != 'article' && $_view != 'weibo_login' && $_view != 'qq_login') { //登录失败,而且不是第三方请求 include TEMPLATES_PATH . "index.html"; exit; } } if (!$_module) { $_module = 'msg'; } if (!is_file(VIEW_PATH . "{$_module}.php")) { $_module = 'article'; $_view = '404'; } include VIEW_PATH . "{$_module}.php";
<?php require_once '/opt/lampp/htdocs/MySpace/src/init.php'; $user = new user(); //echo $user->data()->node_id; if (!$user->isLoggedIn()) { redirect::to('index.php'); } if (input::exists()) { if (token::check(input::get('token'))) { //echo $user->data()->node_id; $validate = new validation(); $validation = $validate->check($_POST, array('FirstName' => array('required' => true, 'min' => 2, 'max' => 20), 'LastName' => array('required' => true, 'min' => 2, 'max' => 20), 'CurrentTown' => array('required' => true, 'min' => 2, 'max' => 20), 'Hometown' => array('required' => true, 'min' => 2, 'max' => 20))); if ($validation->passed()) { try { $user->update(array('FirstName' => input::get('FirstName'), 'LastName' => input::get('LastName'), 'CurrentTown' => input::get('CurrentTown'), 'Hometown' => input::get('Hometown'))); session::flash('home', 'Your details have been updated!!'); redirect::to('index.php'); } catch (Exception $e) { die($e->getMessage()); } } else { foreach ($validation->errors() as $error) { echo $error, '<br>'; } } } } ?> <!DOCTYPE Funspecified PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <link href="<?php
$fooBarId = $user->save($data); myPrint($fooBarId); // query: INSERT INTO user (id,login,name,surname) VALUES (<sequences>,"new","foo","bar") // // 11 // headline('updating using $user->save($data)'); $data = array('id' => $fooBarId, 'login' => 'NEW', 'name' => 'Mr. foo'); $res = $user->save($data); myPrint($res); // query: UPDATE user (id,login,name,surname) VALUES (<sequences>,"new","foo","bar") // // 12 // headline('updating using $user->update($data)'); $res = $user->update($data); myPrint($res); // query: UPDATE user (id,login,name,surname) VALUES (<sequences>,"new","foo","bar") // // 13 // headline("remove the entry \$user->remove({$fooBarId})"); $res = $user->remove($fooBarId); myPrint($res); // query: DELETE FROM "uuser" WHERE "id" = $fooBarId // // helper functions // function headline($string = '') { global $headlineCnt;
require_once 'includes/header.php'; require_once 'includes/user.php'; if (isset($_POST['submit'])) { $userModel = new user(); if ($_FILES['profile_image']['error'] === 0) { $userModel->profilePic = $_FILES['profile_image']['name']; move_uploaded_file($_FILES['profile_image']['tmp_name'], 'images/profile_images/' . $_FILES['profile_image']['name']); } else { $userModel->profilePic = $userSet['image_pic']; } $userModel->email = $_POST['email']; $userModel->username = $_POST['username']; $userModel->job = $_POST['job']; $userModel->gender = $_POST['gender']; $userModel->address = $_POST['address']; $result = $userModel->update($_SESSION['user_id']); if ($result) { echo "success"; } else { echo "failure"; } } ?> <div id="content"> <div class="container-fluid"> <div class="container-fluid"> <div class="data-container"> <div class="container-fluid"> <div class="row"> <div class="col-md-12">
function exponent_users_update($formvalues, $u = null) { $u = user::update($formvalues, $u); global $user; // Set the is_acting_admin flag. There a re a few ways that this should be done. // If the admin is editing or creating a user, solely check if isset() //If the user is editing themselves, don't set it. // If the user is signing up, set it to 0. if ($user->is_admin == 1) { $u->is_acting_admin = isset($formvalues['is_acting_admin']) ? 1 : 0; } else { if (!isset($u->id)) { $u->is_acting_admin = 0; } } return $u; }
<h1><?php echo $lang['common_users']; ?> </h1> <?php $userInst = new user(); ####################################################################### ## perform action $status = 1; if (tool::securePost('action') && tool::securePost('action') == "save" && tool::securePost('id') && tool::securePost('id') != "") { # fill user with submitted data $userInst->id = tool::securePost('id'); $userInst->fill(tool::securePostAll()); if (!DEMO_MODE) { $status = $userInst->update(); } else { $toolInst->errorStatus("not allowed in this demo. Sorry ;)"); } } elseif (tool::securePost('action') && tool::securePost('action') == "save") { $userInst->fill(tool::securePostAll()); $status = $userInst->insert(); } if (tool::securePost('action') && tool::securePost('action') == "delete" && tool::securePost('id') && tool::securePost('id') != "") { $userInst->id = tool::securePost('id'); if (!DEMO_MODE) { $userInst->delete(); } else { $toolInst->errorStatus("not allowed in this demo. Sorry ;)"); } }
function confirmRequest($handle, $password, $name) { $sql = 'SELECT handle FROM users WHERE handle = ?'; if ($handle == $this->dbh->getOne($sql, array($handle))) { $id = $this->dbh->nextId("karma"); $query = 'INSERT INTO karma VALUES (?, ?, ?, ?, NOW())'; $sth = $this->dbh->query($query, array($id, $this->handle, 'pear.bug', 'pearweb')); return true; } list($firstname, $lastname) = explode(' ', $name, 2); $data = array('handle' => $handle, 'firstname' => $firstname, 'lastname' => $lastname, 'email' => $this->email, 'purpose' => 'bug tracker', 'password' => $password, 'password2' => $password, 'purpose' => 'Open/Comment on bugs', 'moreinfo' => 'Automatic Account Request', 'homepage' => ''); include_once 'pear-database-user.php'; $useradd = user::add($data, true, true); if ($useradd !== true) { return $useradd; } $sql = 'SELECT handle from bug_account_request WHERE salt = ?'; $temphandle = $this->dbh->getOne($sql, array($this->salt)); // update all relevant records to the new handle $this->dbh->query('UPDATE bugdb_comments set reporter_name = ? WHERE handle = ?', array($name, $temphandle)); $this->dbh->query('UPDATE bugdb set reporter_name = ? WHERE handle = ?', array($name, $temphandle)); $this->dbh->query('UPDATE users set handle = ? WHERE handle = ?', array($handle, $temphandle)); $this->dbh->query('UPDATE bugdb set registered = 1, handle = ? WHERE handle = ?', array($handle, $temphandle)); $this->dbh->query('UPDATE bugdb_comments set handle = ? WHERE handle = ?', array($handle, $temphandle)); $this->dbh->query('UPDATE bugdb_patchtracker set developer = ? WHERE developer = ?', array($handle, $temphandle)); $this->handle = $handle; // activate the handle and grant karma // implicitly without human intervention // copied from the user class and Damblan_Karma include_once 'pear-database-user.php'; $user = user::info($handle, null, 0); if (!isset($user['registered'])) { return false; } @($arr = unserialize($user['userinfo'])); include_once 'pear-database-note.php'; note::removeAll($handle); $data = array(); $data['registered'] = 1; $data['password'] = $password; $data['name'] = $name; if (is_array($arr)) { $data['userinfo'] = $arr[1]; } $data['create'] = gmdate('Y-m-d'); $data['createBy'] = SITE . 'web'; $data['handle'] = $handle; user::update($data, true); $query = 'INSERT INTO karma VALUES (?, ?, ?, ?, NOW())'; $id = $this->dbh->nextId('karma'); $sth = $this->dbh->query($query, array($id, $this->handle, 'pear.bug', SITE . 'web')); $id = $this->dbh->nextId('karma'); $sth = $this->dbh->query($query, array($id, $this->handle, 'pear.voter', SITE . 'web')); if (!DB::isError($sth)) { require_once 'bugs/pear-bugs-utils.php'; $pbu = new PEAR_Bugs_Utils(); note::add($this->handle, 'Account opened', SITE . 'web'); $bugs = $this->dbh->getAll('SELECT * FROM bugdb WHERE handle = ?', array($this->handle), DB_FETCHMODE_ASSOC); foreach ($bugs as $bug) { $this->sendBugEmail($bug); } $patches = $this->dbh->getAll('SELECT bugdb.package_name, bugdb_patchtracker.* FROM bugdb_patchtracker, bugdb WHERE bugdb_patchtracker.developer = ? AND bugdb.id = bugdb_patchtracker.bugdb_id', array($this->handle), DB_FETCHMODE_ASSOC); foreach ($patches as $patch) { $pbu->sendPatchEmail($patch); } $bugs = $this->dbh->getAll('SELECT bugdb_comments.email,bugdb_comments.comment, bugdb_comments.reporter_name, bugdb.id, bugdb.bug_type,bugdb.package_name,bugdb.sdesc, bugdb.ldesc,bugdb.php_version, bugdb.php_os,bugdb.status, bugdb.assign,bugdb.package_version FROM bugdb_comments, bugdb WHERE bugdb.id = bugdb_comments.bug AND bugdb_comments.handle = ?', array($this->handle), DB_FETCHMODE_ASSOC); foreach ($bugs as $bug) { $this->sendBugCommentEmail($bug); } $msg = "Your PEAR bug tracker account has been opened.\n" . "Bugs you have opened will now be displayed, and you can\n" . "add new comments to existing bugs"; $xhdr = "From: " . PEAR_WEBMASTER_EMAIL; if (!DEVBOX) { mail($user['email'], "Your PEAR Bug Tracker Account Request", $msg, $xhdr, "-f " . PEAR_BOUNCE_EMAIL); } $this->deleteRequest(); return true; } return false; }
public function save_change_password() { global $user, $db; if (!$user->isAdmin() && $this->params['uid'] != $user->id) { flash('error', gt('You do not have permissions to change this users password.')); expHistory::back(); } if (!$user->isAdmin() && (empty($this->params['password']) || $user->password != md5($this->params['password']))) { flash('error', gt('The current password you entered is not correct.')); expHistory::returnTo('editable'); } //eDebug($user); $u = new user($this->params['uid']); $ret = $u->setPassword($this->params['new_password1'], $this->params['new_password2']); //eDebug($u, true); if (is_string($ret)) { flash('error', $ret); expHistory::returnTo('editable'); } else { $u->update(); $user->password = $u->password; } if ($this->params['uid'] != $user->id) { flash('message', gt('Your password for') . ' ' . $u->username . ' ' . gt('been changed.')); } else { flash('message', gt('Your password has been changed.')); } expHistory::back(); }
if (record_exists('user_info_data', 'userid', $USER->id, 'fieldid', $id)) { set_field('user_info_data', 'data', $fd, 'userid', $USER->id, 'fieldid', $id); } else { $dataobj = new object(); $dataobj->userid = $USER->id; $dataobj->fieldid = $id; $dataobj->data = $fd; insert_record('user_info_data', $dataobj); } } } } else { $incomplete = true; } } $u->update(); $usernew = get_record('user', 'id', $USER->id); foreach ((array) $usernew as $variable => $value) { $USER->{$variable} = $value; } if (!is_survey_taken($USER->id, $instanceid) && empty($incomplete)) { $dataobject = new object(); $dataobject->blockinstanceid = $instanceid; $dataobject->userid = $USER->id; insert_record('block_enrol_survey_taken', $dataobject); } if (!empty($formdata->save_exit)) { redirect($CFG->wwwroot . '/course/view.php?id=' . $COURSE->id); } } }
function processValidLogin(&$db, &$resp) { require_once PATH_CORE . '/classes/user.class.php'; $userObj = new user($db); $userInfo = unserialize($resp[items][0][userinfo]); // look up local user id $localInfo = $userObj->lookupUserId($userInfo->uid); if ($localInfo === false) { // if they don't exist, then register them locally $newUserData = $userObj->serialize(0, $userInfo->uid, $userInfo->memberName, $email, 0, $userInfo->votePower, $userInfo->remoteStatus); $userInfo->userid = $userObj->update($newUserData); } else { // if they do exist, update them locally $userInfo->userid = $localInfo->userid; } // sync NewsCloud member info $ui = new stdClass(); $ui->userid = $userInfo->userid; $ui->ncUid = $userInfo->uid; $ui->name = $userInfo->memberName; $ui->votePower = $userInfo->votePower; $userObj->updateNewsCloudInfo($ui); $userObj->setLoginSession($ui); }
<?php //Include the PS_Pagination class require_once 'php/db_interface/autoload.php'; $login = new login(true); if (!empty($_POST)) { foreach ($_POST as $key => $date) { if (!empty($date) && strpos($key, 'date') !== false) { $uid = intval(str_replace("date", "", $key)); $user = new user(); $user->set_variable('users_id', $uid); if ($user->load()) { $user->set_variable('users_manualexpdate', date('Y-m-d', strtotime($date))); $user->update(); } } } } $users = user::getAllUserInfo(); $expiredUsers = array(); if (isset($users['expired'][user::EXP_TYPE_TRIAL])) { $expiredUsers = array_merge($expiredUsers, $users['expired'][user::EXP_TYPE_TRIAL]); } if (isset($users['expired'][user::EXP_TYPE_PAID])) { $expiredUsers = array_merge($expiredUsers, $users['expired'][user::EXP_TYPE_PAID]); } if (isset($users['expired'][user::EXP_TYPE_MANUAL])) { $expiredUsers = array_merge($expiredUsers, $users['expired'][user::EXP_TYPE_MANUAL]); } $trialUsers = $users['valid'][user::EXP_TYPE_TRIAL]; $paidUsers = $users['valid'][user::EXP_TYPE_MANUAL];
protected function maintainReactivatedTeams() { // permanently delete new teams which did not match in last 2 months $two_months_in_past = strtotime('-2 months'); $two_months_in_past = strftime('%Y-%m-%d %H:%M:%S', $two_months_in_past); $teamIds = team::getNewTeamIds(); foreach ($teamIds as $teamid) { $team = new team($teamid); if (($lastMatch = $team->getNewestMatchTimestamp()) && $lastMatch < $two_months_in_past) { $uids = $team->getUserIds(); foreach ($uids as $userid) { $user = new user($userid); $user->removeTeamMembership($teamid); $user->update(); } $team->delete(); } } }
} else { $user_pass = $_POST['user_pass_hidden']; } if (!empty($_POST['user_email'])) { $user_email = $_POST['user_email']; } else { $user_email = $_POST['user_email_hidden']; } $user_passwd = $_POST['user_passwd']; if (!empty($_POST['transfer_enable'])) { $transfer_enable = $togb * $_POST['transfer_enable']; } else { $transfer_enable = $_POST['transfer_enable_hidden']; } $n = new user($user_uid); $query = $n->update($user_name, $user_email, $user_pass, $user_passwd, $transfer_enable); if ($query) { echo ' <script>alert("更新成功!")</script> '; echo " <script>window.location='user.php';</script> "; } var_dump($query); } if (!empty($_GET)) { //获取id $uid = $_GET['uid']; $sql = "SELECT * FROM `user` WHERE uid = '{$uid}' "; $query = $dbc->query($sql); $rs = $query->fetch_array(); } ?> <!-- Right side column. Contains the navbar and content of the page -->
<?php require_once '../Core/init.php'; $dbh = null; $user = new user(null, $_log); $_db = db::getInstance(); if (!$user->isLoggedIn()) { redirect::to('../index.php'); } if (input::exists()) { if (token::check(input::get('token'))) { $validate = new validate(); $validation = $validate->check($_POST, array('Name' => array('required' => true, 'min' => 2, 'max' => 50))); if ($validation->passed()) { try { $user->update(array('Name' => input::get('Name'))); session::flash('home', 'Your details have been updated. '); redirect::to('index.php'); } catch (Exception $e) { die($e->getMessage()); } } else { foreach ($validation->errors() as $error) { echo $error, '<br>'; } } } } // if (!isset($_POST["didsave"])) { // $_POST["didsave"] = 0; // }
$qc = new QC(); $qc->qq_login(); exit; } if (isset($_POST['email']) || isset($_POST['password'])) { if (isset($_POST['email'])) { if (!$_POST['email_notify']) { $_POST['email_notify'] = 'off'; } } if (isset($_POST['app_notify_pin'])) { if (!$_POST['app_notify']) { $_POST['app_notify'] = 'off'; } } $result = user::update($_POST); switch ($result) { case 'email': $_notice = array('title' => '您已申请修改邮箱', 'content' => '请尽快进入您的邮箱激活', 'button' => '点击这里回首页', 'url' => '/'); break; case 'email_exist': $_notice = array('title' => '邮箱已存在', 'content' => '请您重新设置帐户信息', 'button' => '返回我的帐户', 'url' => '/user/edit'); break; case false: $_notice = array('title' => '您填写的信息有误', 'content' => '请重新填写', 'button' => '返回我的帐户', 'url' => '/user/edit'); break; default: $_notice = array('title' => '您的账户信息已经更新', 'content' => '', 'button' => '点击这里回首页', 'url' => '/'); break; } $template = 'notice.html';
function confirmRequest($salt) { if (!$this->find($salt)) { return PEAR::raiseError('cannot find request'); } // activate the handle and grant karma // implicitly without human intervention // copied from the user class and Damblan_Karma include_once 'pear-database-user.php'; $user = user::info($this->handle, null, 0); if (!isset($user['registered'])) { return PEAR::raiseError('Error - user request was deleted, please try again'); } include_once 'pear-database-note.php'; note::removeAll($this->handle); $data = array(); $data['handle'] = $user['handle']; $data['registered'] = 1; $data['created'] = gmdate('Y-m-d'); $data['createdby'] = SITE . 'web'; $e = user::update($data, true); if (PEAR::isError($e) || !$e) { return $e; } $query = 'INSERT INTO karma VALUES (?, ?, ?, ?, NOW())'; $id = $this->dbh->nextId('karma'); $sth = $this->dbh->query($query, array($id, $this->handle, 'pear.voter', SITE . 'web')); $id = $this->dbh->nextId('karma'); $sth = $this->dbh->query($query, array($id, $this->handle, 'pear.bug', SITE . 'web')); if (!DB::isError($sth)) { note::add($this->handle, 'Account opened', SITE . 'web'); $msg = "Your PEAR voter account has been opened.\n" . "You can now participate in the elections by going to\n" . " http://" . PEAR_CHANNELNAME . "/election/"; $xhdr = "From: " . PEAR_WEBMASTER_EMAIL; if (!DEVBOX) { mail($user['email'], "Your PEAR Account Request", $msg, $xhdr, "-f " . PEAR_BOUNCE_EMAIL); } $this->deleteRequest(); return true; } return false; }