public function Update() { global $obj, $model, $param1; include_once 'Model/user.php'; $model = new User(); $model->Id = $param1; if (isset($_POST['btnSubmit'])) { foreach ($_POST as $key => $value) { try { $model->{$key} = $value; } catch (Exception $ex) { } } $model->Image = $_FILES['Image']['name']; if ($model->Update()) { if ($_FILES['Image']['name'] != "") { $sp = $_FILES['Image']['tmp_name']; $dp = "images/user_images/" . $model->Id . $_FILES['Image']['name']; move_uploaded_file($sp, $dp); } print '<span class="success">User Updated</span>'; } else { print '<span class="error">' . $model->Error . '</span>'; } } else { $model->SelectById(); } include_once 'View/User/update.php'; }
/** * Authenticates this session's User, and returns its object. * @return User */ public static function Authenticate() { global $lang; if (array_key_exists('CurrentUser', $_SESSION)) { /* @var $User User */ $User = unserialize($_SESSION['CurrentUser']); $Users = User::GetUsers(new UserSearchParameters($User->getID(), FALSE, FALSE, $User->getPassword())); if ($Users) { $User = $Users[0]; $User->setLastActive(time()); User::Update($User, $User); $lang->setLanguages(array($User->getLanguage())); if ($User->hasPermission(RIGHT_ACCOUNT_LOGIN)) { return $User; } else { $e = new Error(RIGHTS_ERR_USERNOTALLOWED); Error::AddError($e); header('location:login.php#2'); exit; } } else { header('location:login.php#1'); exit; } } else { global $argv, $argc; if (isset($argv) && $argc > 0) { foreach ($argv as $arg) { $kv = explode('=', $arg); if (count($kv) > 1) { $_GET[$kv[0]] = $kv[1]; } unset($kv); } /* Authenticate on the commandline as Default User */ $Users = User::GetUsers(new UserSearchParameters(CMDLINE_USERID)); if ($Users) { $User = $Users[0]; return $User; } else { return NULL; } } else { /* If not on the commandline, the Session expired */ header('location:login.php?url=' . urlencode($_SERVER['REQUEST_URI'])); exit; } } }
public function __construct() { $this->Infos['Title'] = Language::Get('com.sbb.page.profile'); // If logged in, redirect to start page if (!User::LoggedIn()) { header("Location: index.php"); } $Message = ''; if (isset($_POST['Submit'])) { if (User::CheckUpdate($_POST)) { User::Update(array('Homepage' => $_POST['Homepage'], 'Signatur' => $_POST['Signature'])); $Message = Language::Get('com.sbb.profile.success'); } else { $Message = '<b>' . Language::Get('com.sbb.error') . ':</b><ul><li>' . implode('</li><li>', Register::GetError()) . '</li></ul>'; } } // Füllt die Variablen im TPL SBB::Template()->Assign(array('Homepage' => User::Get('Homepage'), 'Signature' => User::Get('Signatur'), 'Message' => $Message, 'Page' => 'Profile')); }
<?php include_once 'user.php'; $object = new User(); if ($object->isLoggedIn() && isset($_POST['submit'])) { $firstname = $_POST['firstname']; $lastname = $_POST['lastname']; $email = $_POST['email']; $username = $_POST['username']; $password = $_POST['password']; $object->Update(); } else { echo "Something is wrong"; } $object->getUser(); echo " Put into your updated details\n\n<html>\n<body>\n<form method=\"post\" action=\"index.php\">\nFirstname: <input type=\"text\" name=\"firstname\"/><br><br>\nLastname: <input type=\"text\" name=\"lastname\"/><br><br>\nEmail: <input type=\"text\" name=\"email\"/><br><br>\nUsername: <input type=\"text\" name=\"username\"/><br><br>\nPassword: <input type=\"text\" name=\"password\"/><br><br>\n<button class=\"btn btn-large btn-danger\" id=\"alertMe\" input type=\"submit\" name=\"submit\" value=\"update\">Update</button>\n\n</form>\n</body>\n</html>";
} Viewer::AddData("title", I18n::L("Password recovery")); Viewer::UseTemplate("password_recovery.tpl"); $action = "password_recovery"; } } elseif ((!RESTRICT_ALL || User::Logged()) && !isset($_GET["recover"])) { $id = (int) $_SERVER["QUERY_STRING"]; $user = User::GetById($id); if (!empty($id) && $user) { //remove user if (isset($_GET["removeuser"])) { if (User::$current->IsAdmin() && !empty($user->user_email)) { $user->user_password = User::GeneratePassword(8); $user->user_email = ""; $user->user_name = $user->user_name . "_removed"; if (!User::Update($user)) { $error_message = I18n::L("Cannot update user."); $user = User::GetById($id); } else { header("Location:" . PREFIX . "/profile?" . $user->user_id); exit; } } else { header("Location:" . PREFIX . "/profile?" . $user->user_id); exit; } } Viewer::AddData("user", $user); Viewer::AddData("title", I18n::L("Title %s's profile", array($user->user_name))); Viewer::AddData("ideas_count", Ideas::GetByUser($user) ? sizeof(Ideas::GetByUser($user)) : 0); Viewer::AddData("comments_count", Comments::GetByUser($user) ? sizeof(Comments::GetByUser($user)) : 0);
if (file_exists($ci->getFilenameOnDisk(FALSE, TRUE))) { rename($ci->getFilenameOnDisk(FALSE, TRUE), $ci->getFilenameOnDisk(FALSE, FALSE)); } } else { if (file_exists($ci->getFilenameOnDisk(TRUE))) { rename($ci->getFilenameOnDisk(TRUE), $ci->getFilenameOnDisk(FALSE)); } } } /* Give the admin-user full rights */ $admUser = User::GetUsers(new UserSearchParameters(CMDLINE_USERID)); /* @var $admUser User */ if ($admUser) { $admUser = $admUser[0]; $admUser->setRights(Rights::getTotalRights()); User::Update($admUser, $admUser); } /* Introduce CANDYPATH constant and write to config */ if (defined('CANDYIMAGEPATH') && !defined('CANDYPATH')) { if (($configfile = file_get_contents('config.php')) !== FALSE) { $configfile = str_replace('CANDYIMAGEPATH', 'CANDYPATH', $configfile); if (file_put_contents('config.php', $configfile) === FALSE) { $e = new Error(NULL, $lang->g('ErrorSetupWritingConfig')); Error::AddError($e); $NoError = FALSE; } } else { $e = new Error(NULL, $lang->g('ErrorSetupWritingConfig')); Error::AddError($e); $NoError = FALSE; }
if ($_POST['txtBirthDate'] && $_POST['txtBirthDate'] != 'YYYY-MM-DD' && strtotime($_POST['txtBirthDate']) !== FALSE) { $User->setBirthDate(strtotime($_POST['txtBirthDate'])); } else { $User->setBirthDate(-1); } if (!$PasswordError || $DeleteUser) { if (Utils::ValidateEmail($User->getEmailAddress()) || $DeleteUser) { if ($User->getID()) { if ($DeleteUser) { if (User::Delete($User, $CurrentUser)) { session_regenerate_id(TRUE); header('location:user.php'); exit; } } else { if (User::Update($User, $CurrentUser)) { if ($User->getID() == $CurrentUser->getID()) { $_SESSION['CurrentUser'] = serialize($User); } session_regenerate_id(TRUE); header('location:user.php'); exit; } } } else { if (User::Insert($User, $CurrentUser)) { session_regenerate_id(TRUE); header('location:user.php'); exit; } }
$body_text .= TPL('emails/body_text_footer', array('username' => $user['username']), true); $body_html .= TPL('emails/body_html_footer', array('username' => $user['username']), true); $mail = new PHPMailer(); $mail->FromName = 'TwitApps'; $mail->From = '*****@*****.**'; $mail->Sender = '*****@*****.**'; $mail->AddReplyTo('*****@*****.**', 'TwitApps'); $mail->Subject = 'Follower changes on Twitter for ' . $user['username'] . ' (' . ($delta > 0 ? '+' : '') . $delta . ')'; $mail->Body = $body_html; $mail->AltBody = $body_text; $mail->IsHTML(true); $mail->WordWrap = 79; $mail->AddAddress($user['email']); //$mail->AddBCC('*****@*****.**'); //file_put_contents('/tmp/twitapps_'.getmypid().'.txt', 'Sending email to "'.$user['username'].'"'."\nBody...\n\n".$body_text."\n\n-------------------------------------------------------------------------------\n\n"); if ($mail->Send()) { // Sent the email so update the user data User::Update($user['username'], $updatedata); @$GLOBALS['apihits']['follows_emails']++; } } } else { // Didn't send the email, but update the user anyway User::Update($user['username'], $updatedata); } User::Release(); } if ($sleep) { sleep(60); } }
} else { switch ($updatedata['frequency']) { case 'weekly': if (!in_array($updatedata['when'], array('monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday', 'sunday'))) { $dm = 'Invalid value "' . $updatedata['when'] . '". Please see http://twitapps.com/follows for valid values.'; } break; case 'monthly': $updatedata['when'] = intval($updatedata['when']); if ($updatedata['when'] < 0 or $updatedata['when'] > 28) { $dm = 'Invalid value "' . $updatedata['when'] . '". Please see http://twitapps.com/follows for valid values.'; } break; } if ($dm === false) { if (User::Update($info['headers']['x-twittersenderscreenname'], $updatedata)) { $hour = 'at or shortly after ' . ($updatedata['hour'] > 12 ? $updatedata['hour'] - 12 . 'pm' : ($updatedata['hour'] == 0 ? 'midnight' : $updatedata['hour'] . ($updatedata['hour'] == 12 ? 'pm' : 'am'))) . ' UTC'; switch ($updatedata['frequency']) { case 'daily': $dm = 'Success! I\'ll now send you a daily update by email ' . $hour . '.'; break; case 'weekly': $dm = 'Success! I\'ll now send you a weekly update by email every ' . ucfirst($updatedata['when']) . ' ' . $hour . '.'; break; case 'monthly': $dm = 'Success! I\'ll now send you a monthly update by email on the ' . date('jS', strtotime('2010-01-' . (strlen($updatedata['when']) == 1 ? '0' : ''))) . ' ' . $hour; break; } } else { $dm = 'An unhandled error occurred when setting the frequency preference. Try again or contact @twitapps.'; }
<?php require_once __DIR__ . '/autoload.php'; try { $data = User::findAll(); $n = new User(); $n->DeleteById(62); $n->Update('5555', '63'); //$data = User::findOne(); //Подстановка //$sth= $dbh->prepare('SELECT * FROM new_news WHERE id=:id'); //$sth->execute([':id' => 2]); //$sth= $dbh->prepare('SELECT count(*) FROM new_news '); //$sth->execute(); //$res = $sth->fetchOne(); //$res = $sth->fetchAll(PDO::FETCH_OBJ); //var_dump($res['0']['title']); //$res = $sth->fetchALL(PDO::FETCH_CLASS, User::class); //var_dump($data); } catch (PDOException $e) { echo $e->getMessage(); } echo $data['0']->avtor;
Flag::FlagDecision($user->user_id, 'user', true); break; // Handle "Pending" or "New" action // Handle "Pending" or "New" action case 'new': case 'pending': $user->UpdateContentStatus($data['status']); break; } } if (isset($data['password'])) { $data['password'] = md5($data['password']); } $message = 'Member has been updated.'; $message_type = 'success'; $user->Update($data); } else { $message = 'The following errors were found. Please correct them and try again.'; $message .= '<br /><br /> - ' . implode('<br /> - ', $errors); $message_type = 'error'; } } // Output Header include 'header.php'; ?> <div id="members-edit"> <h1>Update Member</h1> <?php
if (!empty($_REQUEST['oauth_token'])) { // Create TwitterOAuth object with app key/secret and token key/secret from default phase $to = new TwitterOAuth(config('oauth', 'consumer_key'), config('oauth', 'consumer_secret'), User::cGet('ort'), User::cGet('orts')); // Request access tokens from twitter $tok = $to->getAccessToken(); // Save the access tokens User::cSet('oat', $tok['oauth_token']); User::cSet('oats', $tok['oauth_token_secret']); // Create TwitterOAuth with app key/secret and user access key/secret $to = new TwitterOAuth(config('oauth', 'consumer_key'), config('oauth', 'consumer_secret'), User::cGet('oat'), User::cGet('oats')); // Run request on twitter API as user to get their user details $user = json_decode($to->OAuthRequest('https://twitter.com/account/verify_credentials.json', array(), 'GET'), true); // Store the user ID in the cookie User::cSet('id', $user['id']); // Now save the user in the DB User::Update($user, true); // Tell me about it //@mail('*****@*****.**', 'TwitApps signin: '.$user['screen_name'], print_r($user, true)); // Take them to the account page Redirect('/account/'); } else { $to = new TwitterOAuth(config('oauth', 'consumer_key'), config('oauth', 'consumer_secret')); $tok = $to->getRequestToken(); User::cSet('ort', $tok['oauth_token']); User::cSet('orts', $tok['oauth_token_secret']); Redirect($to->getAuthorizeURL($tok['oauth_token'])); } } User::cReset(); Layout('Sign In', 'account'); TPL('account/signin');
<?php include 'configs/configs.php'; //---Thuc hien cap nhat, goi ham cap nhat va gan cac gia tri if (isset($_POST['Name'])) { echo $pass = $_POST['Pass']; echo $ID = $_POST['ID']; echo $email = $_POST['eMail']; echo $isAdmin = $_POST['isAdmin']; echo $name = $_POST['Name']; $newUser = new User(); $newUser->ID = $ID; $newUser->userName = $name; $newUser->passWord = $pass; $newUser->eMail = $email; $newUser->isAdmin = $isAdmin; $newUser->Update(); header('location: manageuser.php'); } else { //--Nếu tồn tại giá trị của user thì hiện ra bảng sửa thông tin người dùng, $name = $_POST['search']; $newUser = User::getByName($name); //print_r($newUser); //$a=$newUser[0]->userName; //echo $a; $smarty->assign('newUser', $newUser); $smarty->display('edituser.tpl'); }
$message = "Problemas na operação."; } } } if ($action == 3) { $user = new User(); $user->SetDatabase($database); $user->SetId($user_id); $user->SetUsername($user_username); $user->SetPassword($user_password1); $user->SetActive($user_active); $user->Encrypt(); if ($user_password1 != $user_password2) { $message = "Senhas não conferem."; } else { if ($user->Update()) { $message = $screen_module_name . " alterado com sucesso."; $user_password1 = ""; $user_password2 = ""; } else { $message = "Problemas na operação."; } } } if ($action == 4) { $user = new User(); $user->SetDatabase($database); $user->SetId($user_id); if ($user->Delete()) { $message = $screen_module_name . " excluído com sucesso."; $user_id = "";
public function modifyUser($empid, $uname, $role, $access) { if (User::Update($empid, $uname, $role, $access)) { echo 1; } else { echo 0; } }
require '../../' . $WEB_SITE . 'src/cdGuardian.php'; $screen_module_name = "Usuário(s)"; if (isset($_POST["p_action"])) { $action = $_POST["p_action"]; $message = ""; if ($action == 1) { $user_id = $_POST["p_user_id"]; $length = count($user_id); if ($length > 0) { for ($i = 0; $i < $length; $i++) { $user = new User(); $user->SetDatabase($database); $user->SetId($user_id[$i]); $user->SelectById(); $user->SetActive(1); $user->Update(); } $message = $screen_module_name . " ativado(s) com sucesso."; } else { $message = "Não há usuários para serem ativados."; } } } ?> <html> <head> <title>Schifer's</title> <link rel="stylesheet" type="text/css" href="/schifers/css/schifers.css"> <script language="Javascript">
} ### Validate image data $handle = fopen($_FILES['upload']['tmp_name'], 'r'); $image_data = fread($handle, filesize($_FILES['upload']['tmp_name'])); if (!@imagecreatefromstring($image_data)) { throw new Exception(Language::GetText('error_uploadify_extension')); } ### Change permissions on avatar & delete previous IF/APP try { Filesystem::Open(); $avatar_path = UPLOAD_PATH . '/avatars'; $save_as = Avatar::CreateFilename($extension); Avatar::SaveAvatar($_FILES['upload']['tmp_name'], $extension, $save_as); // Check for existing avatar if (!empty($user->avatar)) { Avatar::Delete($user->avatar); } Filesystem::SetPermissions("{$avatar_path}/{$save_as}", 0644); Filesystem::Close(); } catch (Exception $e) { App::Alert('Error During Avatar Upload', $e->getMessage()); throw new Exception(Language::GetText('error_uploadify_system', array('host' => HOST))); } ### Update User $user->Update(array('avatar' => $save_as)); Plugin::Trigger('update_profile.update_avatar'); // Output success message exit(json_encode(array('result' => 1, 'msg' => (string) Language::GetText('success_avatar_updated'), 'other' => $user->avatar_url))); } catch (Exception $e) { exit(json_encode(array('result' => 0, 'msg' => $e->getMessage()))); }
$UserName = $_POST['txtUserName']; $Password = $_POST['txtPassword']; $ReturnURL = array_key_exists('url', $_GET) && isset($_GET['url']) ? $_GET['url'] : NULL; $Users = User::GetUsers(new UserSearchParameters(FALSE, FALSE, $UserName)); if ($Users) { /* @var $User User */ $User = $Users[0]; if ($User->hasPermission(RIGHT_ACCOUNT_LOGIN)) { if (Utils::HashString($Password, $User->getSalt()) == $User->getPassword()) { $User->setPreLastLogin($User->getLastLogin()); $User->setLastLogin(time()); // By resetting the user's Salt and Password-hash upon login, // existing reset-URLs and concurrent loginsessions become invalid. $User->setSalt(Utils::GenerateGarbage(20)); $User->setPassword(Utils::HashString($Password, $User->getSalt())); User::Update($User, $User); $_SESSION['CurrentUser'] = serialize($User); session_regenerate_id(TRUE); if (isset($ReturnURL)) { header('location:' . urldecode($ReturnURL)); } else { header('location:index.php'); } exit; } else { $e = new LoginError(LOGIN_ERR_PASSWORDINCORRECT); Error::AddError($e); } } else { $e = new Error(RIGHTS_ERR_USERNOTALLOWED); Error::AddError($e);
$searchresults = Twitter::Search($searchterm, $user['last_id']); if ($searchresults === false) { // Search failed, do nothing } else { list($user['last_id'], $replies) = $searchresults; if (count($replies) > 0) { //echo "Got ".count($replies)." results for ".$user['username']."\n"; foreach ($replies as $reply) { Queue::Add($user['username'], $reply['id'], strtotime($reply['created_at']), $reply); } } $num = Queue::Num($user['username']); if ($num > 0 and ($num >= $user['max_queued'] or $user['last_email_at'] < time() - $user['min_interval'])) { if (!Queue::SendEmail($user['username'], $user['email'])) { // Message NOT sent echo 'Failed to send the email to "' . $user['username'] . '"' . "\n"; } else { $user['last_email_at'] = time(); @$GLOBALS['apihits']['replies_emails']++; } } } User::Update($user['username'], $user); User::Release(); // Sleep for half a second usleep(500000); } if ($sleep) { sleep(10); } }
$data = $userData->data; $userObj = new User(); $response = $userObj->Update($id, $data); if ($response == null || $response == FAILED) { handleErrorResponse($response); } echoResponse(SUCCESS_CODE, $response); }); // // ServiceAPIUtils::CallAPIService( $dataArray,"/User/Delete/123", "json" ); $app->post("/User/UpdateLoginTime/:id", function () use($app) { require "../src/services/User.php"; //TODO: check this later include_once dirname(__FILE__) . '../../include/Config.php'; // verifyRequiredParams(array("loginname", "password", "deviceid", "ipaddress", "gpscoordinates")); // $userID = $app->request->post("userid"); $request = $app->request(); $userData = json_decode($request->post('data')); $id = $userData->id; $data = $userData->data; $userObj = new User(); $response = $userObj->Update($id, $data); if ($response == null || $response == FAILED) { handleErrorResponse($response); } echoResponse(SUCCESS_CODE, $response); }); $app->run(); ?>
} } else { $dm = 'Invalid value "' . $bits[1] . '" for replies_only option. Please use "on" or "off".'; } break; case 'frequency': $updatedata = array('min_interval' => $bits[1], 'max_queued' => $bits[2]); if (!is_numeric($updatedata['min_interval'])) { $dm = 'Invalid value "' . $updatedata['min_interval'] . '". Please see http://twitapps.com/replies for valid values.'; } else { $updatedata['min_interval'] = intval($updatedata['min_interval']) * 60; if (!is_numeric($updatedata['max_queued'])) { $dm = 'Invalid value "' . $updatedata['max_queued'] . '". Please see http://twitapps.com/replies for valid values.'; } else { $updatedata['max_queued'] = intval($updatedata['max_queued']); if (User::Update($headers['x-twittersenderscreenname'], $updatedata)) { if ($updatedata['min_interval'] == 0 or $updatedata['max_queued'] <= 1) { $dm = 'Success! I\'ll now send you an email as soon as I see that you\'ve had a reply. Please see http://twitapps.com/replies for why this may not always be instant.'; } else { $dm = 'Success! I\'ll now send you an email every ' . $updatedata['min_interval'] / 60 . ' minute' . ($updatedata['min_interval'] == 60 ? '' : 's') . ' or when you\'ve had ' . $updatedata['max_queued'] . ' replies, whichever occurs sooner.'; } } else { $dm = 'An unhandled error occurred when setting the frequency preference. Try again or contact @twitapps.'; } } } break; default: $dm = 'Unknown option "' . $bits[0] . '". Please see http://twitapps.com/replies for valid options.'; break; }
switch ($type) { case 'video': $video = new Video($_GET['ban']); if ($video->found) { Flag::FlagDecision($video->video_id, $type, true); $video->Update(array('status' => 'banned')); $message = 'Video has been banned'; $message_type = 'success'; } break; case 'member': $user = new User($_GET['ban']); if ($user->found) { Flag::FlagDecision($user->user_id, $type, true); $user->UpdateContentStatus('banned'); $user->Update(array('status' => 'banned')); $message = 'Member has been banned'; $message_type = 'success'; } break; case 'comment': $comment = new Comment($_GET['ban']); if ($comment->found) { Flag::FlagDecision($comment->comment_id, $type, true); $comment->Update(array('status' => 'banned')); $message = 'Comment has been banned'; $message_type = 'success'; } break; } } else {