当前位置: 首页>>代码示例>>PHP>>正文


PHP user::update方法代码示例

本文整理汇总了PHP中user::update方法的典型用法代码示例。如果您正苦于以下问题:PHP user::update方法的具体用法?PHP user::update怎么用?PHP user::update使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在user的用法示例。


在下文中一共展示了user::update方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: update

 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);
     }
 }
开发者ID:jnaroogheh,项目名称:darvishi,代码行数:10,代码来源:UserController.php

示例2: save

 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();
     }
 }
开发者ID:hurricanetx,项目名称:holmes-bi,代码行数:15,代码来源:user.php

示例3: saveUserSettings

 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")));
     }
 }
开发者ID:happyoniens,项目名称:Club,代码行数:18,代码来源:userController.php

示例4: activate

 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;
 }
开发者ID:stof,项目名称:pearweb,代码行数:39,代码来源:pear-database-user.php

示例5: elseif

        }
    } 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) {
开发者ID:stof,项目名称:pearweb,代码行数:31,代码来源:index.php

示例6: user

}
$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");
开发者ID:xx161450,项目名称:MongoHelper,代码行数:31,代码来源:user.php

示例7: array

             $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 {
开发者ID:jstoppo,项目名称:pazlet.com,代码行数:31,代码来源:join-game.php

示例8:

            $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';
}
开发者ID:DaniJCV,项目名称:BO2-BOxygen,代码行数:31,代码来源:user_edit.php

示例9: user

<?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>
开发者ID:pediredla,项目名称:SocialNetwork,代码行数:31,代码来源:changepassword.php

示例10: createUserReferralCodes

 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();
         }
     }
 }
开发者ID:patfeldman,项目名称:TechBounce,代码行数:13,代码来源:user.class.php

示例11: array

    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');
开发者ID:stof,项目名称:pearweb,代码行数:31,代码来源:account-edit.php

示例12: user

<?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') {
开发者ID:nachatate,项目名称:synala,代码行数:31,代码来源:manage2.php

示例13: catch

        $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.";
    }
}
开发者ID:s-gto,项目名称:HonoursProject,代码行数:31,代码来源:imageupload.php

示例14: edituser

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());
    }
}
开发者ID:eldianmartin,项目名称:TaskTrack,代码行数:14,代码来源:index.php

示例15: login_by_qq

        $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";
开发者ID:questionlin,项目名称:pickcat,代码行数:31,代码来源:index.php


注:本文中的user::update方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。