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


PHP user_update函数代码示例

本文整理汇总了PHP中user_update函数的典型用法代码示例。如果您正苦于以下问题:PHP user_update函数的具体用法?PHP user_update怎么用?PHP user_update使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: _login

function _login($forward = '')
{
    global $_GPC, $_W;
    load()->model('user');
    $member = array();
    $username = trim($_GPC['username']);
    if (empty($username)) {
        message('请输入要登录的用户名');
    }
    $member['username'] = $username;
    $member['password'] = $password = $_GPC['password'];
    if (empty($member['password'])) {
        message('请输入密码');
    }
    $record = user_single($member);
    if (!empty($record)) {
        /*if($record['status'] == 1) {
        			message('您的账号正在审核或是已经被系统禁止,请联系网站管理员解决!');
        		}*/
        $founders = explode(',', $_W['config']['setting']['founder']);
        $_W['isfounder'] = in_array($record['uid'], $founders);
        if ($_W['siteclose'] && !$_W['isfounder']) {
            $settings = setting_load('copyright');
            message('站点已关闭,关闭原因:' . $settings['copyright']['reason']);
        }
        $cookie = array();
        $cookie['uid'] = $record['uid'];
        $cookie['lastvisit'] = $record['lastvisit'];
        $cookie['lastip'] = $record['lastip'];
        $cookie['hash'] = md5($record['password'] . $record['salt']);
        $session = base64_encode(json_encode($cookie));
        isetcookie('__session', $session, !empty($_GPC['rember']) ? 7 * 86400 : 0);
        $status = array();
        $status['uid'] = $record['uid'];
        $status['lastvisit'] = TIMESTAMP;
        $status['lastip'] = CLIENT_IP;
        user_update($status);
        if (empty($forward)) {
            $forward = $_GPC['forward'];
        }
        if (empty($forward)) {
            $forward = './index.php?c=index&a=index';
        }
        $_W['user'] = $record;
        if (cly_isAdmin()) {
            message('', url('admin/index'));
        } else {
            message('', $forward);
        }
        //message("欢迎回来,{$record['username']}。", $forward);
    } else {
        message('登录失败,请检查您输入的用户名和密码!');
    }
}
开发者ID:kwdwkiss,项目名称:report,代码行数:54,代码来源:login.ctrl.php

示例2: guest_agree_delete

function guest_agree_delete($sid, $pid, $touid, $tid)
{
    $pid = intval($pid);
    $sid = addslashes($sid);
    $r = db_exec("DELETE FROM `bbs_guest_agree` WHERE sid='{$sid}' AND pid='{$pid}'");
    if ($r !== FALSE) {
        user_update($touid, array('agrees-' => 1));
        post_update($pid, array('agrees-' => 1));
        $tid and thread_update($tid, array('agrees-' => 1));
        // 改变用户组
        user_update_group($touid);
        return TRUE;
        // 0
    } else {
        return FALSE;
    }
}
开发者ID:xianyuxmu,项目名称:alinkagarden-xiuno,代码行数:17,代码来源:guest_agree.func.php

示例3: myagree_delete

function myagree_delete($uid, $pid, $isfirst)
{
    $agree = myagree_read($pid, $uid);
    if (empty($agree)) {
        return 0;
    }
    $fromuid = $agree['uid'];
    $touid = $agree['touid'];
    $tid = $agree['tid'];
    $r = db_exec("DELETE FROM `bbs_myagree` WHERE uid='{$uid}' AND pid='{$pid}' LIMIT 1");
    db_exec("DELETE FROM `bbs_post_agree` WHERE pid='{$pid}' AND uid='{$uid}' LIMIT 1");
    if ($r !== FALSE) {
        user_update($fromuid, array('myagrees-' => 1));
        user_update($touid, array('agrees-' => 1));
        post_update($pid, array('agrees-' => 1));
        $isfirst and thread_update($tid, array('agrees-' => 1));
        // 改变用户组
        user_update_group($touid);
        return $r;
        // 0
    } else {
        return FALSE;
    }
}
开发者ID:xianyuxmu,项目名称:alinkagarden-xiuno,代码行数:24,代码来源:myagree.func.php

示例4: switch

if (isset($_GET["action"])) {
    switch ($_GET["action"]) {
        case "check":
            user_check();
            break;
        case "login":
            user_login();
            break;
        case "register":
            user_register();
            break;
        case "remind":
            user_remind();
            break;
        case "update":
            user_update();
            break;
        case "logout":
            user_logout();
            break;
    }
}
function user_check()
{
    if ($_SESSION['LoggedIn'] == 1) {
        echo '{"response":"Yes", "username":"' . $_SESSION['Username'] . '"}';
    } else {
        echo '{"response":"No"}';
    }
}
function user_login()
开发者ID:katjaq,项目名称:braincatalogue,代码行数:31,代码来源:login.php

示例5: edituser

/**
 * edit user
 */
function edituser($dir)
{
    // Determine the user name from the post data
    $user = stripslashes($GLOBALS['__POST']["user"]);
    // try to find the user
    $data = user_find($user, NULL);
    if ($data == NULL) {
        show_error($user . ": " . $GLOBALS["error_msg"]["miscnofinduser"]);
    }
    if ($self = $user == $GLOBALS['__SESSION']["s_user"]) {
        $dir = "";
    }
    if (isset($GLOBALS['__POST']["confirm"]) && $GLOBALS['__POST']["confirm"] == "true") {
        $nuser = stripslashes($GLOBALS['__POST']["nuser"]);
        if ($nuser == "" || $GLOBALS['__POST']["home_dir"] == "") {
            show_error($GLOBALS["error_msg"]["miscfieldmissed"]);
        }
        if (isset($GLOBALS['__POST']["chpass"]) && $GLOBALS['__POST']["chpass"] == "true") {
            if ($GLOBALS['__POST']["pass1"] != $GLOBALS['__POST']["pass2"]) {
                show_error($GLOBALS["error_msg"]["miscnopassmatch"]);
            }
            $pass = md5(stripslashes($GLOBALS['__POST']["pass1"]));
        } else {
            $pass = $data[1];
        }
        if ($self) {
            $GLOBALS['__POST']["active"] = 1;
        }
        // determine the user permissions
        $permissions = _eval_permissions();
        // determine the new user data
        $data = array($nuser, $pass, stripslashes($GLOBALS['__POST']["home_dir"]), stripslashes($GLOBALS['__POST']["home_url"]), $GLOBALS['__POST']["show_hidden"], stripslashes($GLOBALS['__POST']["no_access"]), $permissions, $GLOBALS['__POST']["active"]);
        if (!user_update($user, $data)) {
            show_error($user . ": " . $GLOBALS["error_msg"]["saveuser"]);
        }
        if ($self) {
            user_activate($nuser, NULL);
        }
        header("location: " . make_link("admin", $dir, NULL));
        return;
    }
    show_header($GLOBALS["messages"]["actadmin"] . ": " . sprintf($GLOBALS["messages"]["miscedituser"], $data[0]));
    // Javascript functions:
    include "./_include/js_admin3.php";
    echo "<CENTER><FORM name=\"edituser\" action=\"" . make_link("admin", $dir, NULL) . "&action2=edituser\" method=\"post\">\n";
    echo "<INPUT type=\"hidden\" name=\"confirm\" value=\"true\"><INPUT type=\"hidden\" name=\"user\" value=\"" . $data[0] . "\">\n";
    echo "<BR><TABLE width=\"450\">\n";
    echo "<TR><TD>" . $GLOBALS["messages"]["miscusername"] . ":</TD>\n";
    echo "<TD align=\"right\"><INPUT type\"text\" name=\"nuser\" size=\"30\" value=\"";
    echo $data[0] . "\"></TD></TR>\n";
    echo "<TR><TD>" . $GLOBALS["messages"]["miscconfpass"] . ":</TD>\n";
    echo "<TD align=\"right\"><INPUT type=\"password\" name=\"pass1\" size=\"30\"></TD></TR>\n";
    echo "<TR><TD>" . $GLOBALS["messages"]["miscconfnewpass"] . ":</TD>\n";
    echo "<TD align=\"right\"><INPUT type=\"password\" name=\"pass2\" size=\"30\"></TD></TR>\n";
    echo "<TR><TD>" . $GLOBALS["messages"]["miscchpass"] . ":</TD>\n";
    echo "<TD align=\"right\"><INPUT type=\"checkbox\" name=\"chpass\" value=\"true\"></TD></TR>\n";
    echo "<TR><TD>" . $GLOBALS["messages"]["mischomedir"] . ":</TD>\n";
    echo "<TD align=\"right\"><INPUT type=\"text\" name=\"home_dir\" size=\"30\" value=\"";
    echo $data[2] . "\"></TD></TR>\n";
    echo "<TR><TD>" . $GLOBALS["messages"]["mischomeurl"] . ":</TD>\n";
    echo "<TD align=\"right\"><INPUT type=\"text\" name=\"home_url\" size=\"30\" value=\"";
    echo $data[3] . "\"></TD></TR>\n";
    echo "<TR><TD>" . $GLOBALS["messages"]["miscshowhidden"] . ":</TD>";
    echo "<TD align=\"right\"><SELECT name=\"show_hidden\">\n";
    echo "<OPTION value=\"0\">" . $GLOBALS["messages"]["miscyesno"][1] . "</OPTION>";
    echo "<OPTION value=\"1\"" . ($data[4] ? " selected " : "") . ">";
    echo $GLOBALS["messages"]["miscyesno"][0] . "</OPTION>\n";
    echo "</SELECT></TD></TR>\n";
    echo "<TR><TD>" . $GLOBALS["messages"]["mischidepattern"] . ":</TD>\n";
    echo "<TD align=\"right\"><INPUT type=\"text\" name=\"no_access\" size=\"30\" value=\"";
    echo $data[5] . "\"></TD></TR>\n";
    echo "<TR><TD>" . $GLOBALS["messages"]["miscperms"] . ":</TD>\n";
    // print out the extended permission table of the user permission
    echo "<TD align=\"right\">\n";
    admin_print_permissions($data[0]);
    echo "</TD></TR>\n";
    echo "<TR><TD>" . $GLOBALS["messages"]["miscactive"] . ":</TD>";
    echo "<TD align=\"right\"><SELECT name=\"active\"" . ($self ? " DISABLED " : "") . ">\n";
    echo "<OPTION value=\"1\">" . $GLOBALS["messages"]["miscyesno"][0] . "</OPTION>";
    echo "<OPTION value=\"0\"" . ($data[7] ? "" : " selected ") . ">";
    echo $GLOBALS["messages"]["miscyesno"][1] . "</OPTION>\n";
    echo "</SELECT></TD></TR>\n";
    echo "<TR><TD colspan=\"2\" align=\"right\"><input type=\"submit\" value=\"" . $GLOBALS["messages"]["btnsave"];
    echo "\" onClick=\"return check_pwd();\">\n<input type=\"button\" value=\"";
    echo $GLOBALS["messages"]["btncancel"] . "\" onClick=\"javascript:location='";
    echo make_link("admin", $dir, NULL) . "';\"></TD></TR></FORM></TABLE><BR></BR>\n";
}
开发者ID:rterbush,项目名称:nas4free,代码行数:90,代码来源:admin.php

示例6: trim

 $_GPC['password'] = trim($_GPC['password']);
 if (!empty($record['password']) && istrlen($record['password']) < 8) {
     message('必须输入密码,且密码长度不得低于8位。');
 }
 $_GPC['groupid'] = intval($_GPC['groupid']);
 if (empty($_GPC['groupid'])) {
     message('请选择所属用户组');
 }
 load()->model('user');
 $record = array();
 $record['uid'] = $uid;
 $record['password'] = $_GPC['password'];
 $record['salt'] = $user['salt'];
 $record['groupid'] = intval($_GPC['groupid']);
 $record['remark'] = $_GPC['remark'];
 user_update($record);
 if (!empty($_GPC['birth'])) {
     $profile['birthyear'] = $_GPC['birth']['year'];
     $profile['birthmonth'] = $_GPC['birth']['month'];
     $profile['birthday'] = $_GPC['birth']['day'];
 }
 if (!empty($_GPC['reside'])) {
     $profile['resideprovince'] = $_GPC['reside']['province'];
     $profile['residecity'] = $_GPC['reside']['city'];
     $profile['residedist'] = $_GPC['reside']['district'];
 }
 if (!empty($extendfields)) {
     foreach ($extendfields as $row) {
         if (!in_array($row['field'], array('profile', 'resideprovince', 'birthyear'))) {
             $profile[$row['field']] = $_GPC[$row['field']];
         }
开发者ID:ChainBoy,项目名称:wxfx,代码行数:31,代码来源:edit.ctrl.php

示例7: template

    template('user/permission');
}
if ($do == 'deny') {
    if ($_W['ispost'] && $_W['isajax']) {
        $founders = explode(',', $_W['config']['setting']['founder']);
        if (in_array($uid, $founders)) {
            exit('管理员用户不能禁用.');
        }
        $somebody = array();
        $somebody['uid'] = $uid;
        if (intval($user['status']) == 2) {
            $somebody['status'] = 1;
        } else {
            $somebody['status'] = 2;
        }
        if (user_update($somebody)) {
            exit('success');
        }
    }
}
if ($do == 'select') {
    $uid = intval($_GPC['uid']);
    $condition = '';
    $params = array();
    if (!empty($_GPC['keyword'])) {
        $condition = ' AND `name` LIKE :name';
        $params[':name'] = "%{$_GPC['keyword']}%";
    }
    $pindex = max(1, intval($_GPC['page']));
    $psize = 10;
    $total = 0;
开发者ID:ChainBoy,项目名称:wxfx,代码行数:31,代码来源:permission.ctrl.php

示例8: fclose

 fclose($news_file);
 // Add Blank Comment In The Active_Comments_File --- only for active/draft news
 if ($postpone_draft != "postpone") {
     $old_com_db = file(SERVDIR . "/cdata/comments.txt");
     $new_com_db = fopen(SERVDIR . "/cdata/comments.txt", "w");
     flock($new_com_db, LOCK_EX);
     fwrite($new_com_db, "{$added_time}|>|\n");
     foreach ($old_com_db as $line) {
         fwrite($new_com_db, $line);
     }
     flock($new_com_db, LOCK_UN);
     fclose($new_com_db);
 }
 // Increase By 1 The Number of Written News for Current User
 $member_db[UDB_COUNT]++;
 user_update($username, $member_db);
 // Do backup news (x2 disk space)
 if ($config_backup_news == 'yes') {
     copy($decide_news_file, $decide_news_file . '.bak');
 }
 // Notifications
 if ($member_db[UDB_ACL] == ACL_LEVEL_JOURNALIST) {
     //user is journalist and the article needs to be approved, Notify !!!
     if ($config_notify_unapproved == "yes" and $config_notify_status == "active") {
         send_mail($config_notify_email, lang("CuteNews - Unapproved article was Added"), str_replace(array('%1', '%2'), array($member_db[UDB_NAME], $title), 'The user %1 (journalist) posted article %2 which needs first to be Approved'));
     }
 }
 if ($postpone) {
     msg("info", lang("News added (Postponed)"), lang("The news item was successfully added to the database as postponed. It will be activated at") . date(" Y-m-d H:i:s", $added_time), '#GOBACK');
 } elseif (empty($preview_hmtl)) {
     $source = '';
开发者ID:jasmith152,项目名称:Salt_Face,代码行数:31,代码来源:addnews.php

示例9: buy_package

function buy_package($user, $package_id, $total = 1)
{
    if (empty($user) || empty($user["uid"])) {
        return error(-1, "用户不存在");
    }
    if ($total <= 0) {
        return error(-1, "购买数必须大于1");
    }
    if (empty($user["credit2"]) || doubleval($user["credit2"]) < 0) {
        return error(-1, "用户余额为0无法购买套餐.");
    }
    $group = kim_get_uni_group($package_id);
    if (empty($group)) {
        return error(-1, "模块不存在.");
    }
    $price = doubleval($group["price"]);
    if (intval($user['groupid']) > 0) {
        list($price, $discount) = check_price($price, intval($user['groupid']));
    }
    if (doubleval($user["credit2"]) < $price * $total) {
        return error(-1, "用户余额不足.");
    }
    $st = get_settings();
    $day = 30;
    if (intval($st[package_day]) > 0) {
        $day = intval($st[package_day]);
    }
    $package_price = $price * $total;
    $package_time = $total * $day * 24 * 60 * 60;
    load()->model("account");
    $account = uni_fetch();
    if (empty($account)) {
        return error(-1, "公众号不存在.");
    }
    $settings = uni_setting($account["uniacid"], array('groupdata'));
    $groupData = $settings['groupdata'] ? $settings['groupdata'] : array("endtime" => TIMESTAMP);
    $package_endTime = $package_time;
    if ($groupData["endtime"] - TIMESTAMP > 0) {
        $package_endTime = $groupData["endtime"] - TIMESTAMP + $package_time;
    }
    $old_package = kim_get_uni_group($account["groupid"]);
    try {
        pdo_begin();
        $endtime = date("Y-m-d", TIMESTAMP + $package_endTime);
        load()->model('user');
        $record = array();
        $record['uid'] = $user["uid"];
        $record['endtime'] = $endtime;
        user_update($record);
        $order_record = array("uniacid" => $account["uniacid"], "uid" => $user["uid"], "package" => $package_id, "buy_time" => TIMESTAMP, "expiration_time" => TIMESTAMP + $package_endTime);
        pdo_insert("users_packages", $order_record);
        $record_id = pdo_insertid();
        if ($record_id <= 0) {
            throw new Exception("保存记录失败");
        }
        //VIP时间同步
        $groupData["endtime"] = $groupData["endtime"] < TIMESTAMP ? TIMESTAMP : $groupData["endtime"];
        $old_over_time = date("Y-m-d", $groupData["endtime"]);
        $new_over_time = date("Y-m-d", TIMESTAMP + $package_endTime);
        $log = array(0, sprintf("自动续费: %s 套餐续费,续费前:%s 到期; 续费后:%s 到期", $group["name"], $old_over_time, $new_over_time));
        if (intval($account["groupid"]) != intval($package_id)) {
            $surplus_price = $old_package["price"] * round(($groupData["endtime"] - TIMESTAMP) / 86400);
            $surplus_price = $surplus_price / $day;
            $surplus_time = round($surplus_price / $group["price"]) * $day;
            $package_endTime = $surplus_time * 24 * 60 * 60 + $package_time;
            $new_over_time = date("Y-m-d", TIMESTAMP + $package_endTime);
            $log_text = sprintf("套餐变更: &lt;p&gt;A、原套餐: %s , %s 到期&lt;/p&gt;&lt;p&gt;B、变更后: %s , %s 到期.&lt;/p&gt;", $old_package["name"], $old_over_time, $group["name"], $new_over_time);
            $log = array(0, $log_text);
            if (pdo_update('uni_account', array('groupid' => $package_id), array('uniacid' => $account["uniacid"])) <= 0) {
                throw new Exception("更新套餐失败.");
            }
        }
        $new_groupdata = array('groupdata' => iserializer(array('isexpire' => 1, 'endtime' => TIMESTAMP + $package_endTime, 'oldgroupid' => $old_package['id'], 'is_auto' => 1)));
        if (pdo_update('uni_settings', $new_groupdata, array('uniacid' => $account["uniacid"])) <= 0) {
            throw new Exception("更新套餐失败!");
        }
        $result = user_credits_update($user["uid"], "credit2", -$package_price, $log);
        if (is_error($result)) {
            throw new Exception($result["message"]);
        }
        $_W['account']['groupid'] = $account["uniacid"];
        load()->model('module');
        module_build_privileges();
        pdo_update("users_packages", array("record_id" => $record_id, "status" => 1), array("id" => $record_id));
        pdo_commit();
        return true;
    } catch (Exception $e) {
        pdo_rollback();
        return error(-1, $e->getMessage());
    }
    return error(-1, "错误操作.");
}
开发者ID:aspnmy,项目名称:weizan,代码行数:92,代码来源:common.inc.php

示例10: http_build_query

                $getdata = http_build_query(array("query" => $q,'action' => 'article_list'));
                $opts = array('http' =>array('method'=>'POST','header'=>'Content-type: application/x-www-form-urlencoded'));
                $context  = stream_context_create($opts);
                $result = file_get_contents('http://'.$_SERVER['HTTP_HOST'].'/php/brainspell.php?'.$getdata, false, $context);	
                echo $result;
                */
            } else {
                if ($parts[1] == "about") {
                    about();
                } else {
                    if ($parts[1] == "blog") {
                        blog();
                    } else {
                        if ($parts[1] == "download") {
                            download();
                        } else {
                            if ($parts[1] == "user") {
                                user_update($parts[2]);
                            } else {
                                home();
                            }
                        }
                    }
                }
            }
        }
    }
}
?>

开发者ID:BIDS-collaborative,项目名称:brainspell,代码行数:29,代码来源:404.php

示例11: qq_login_create_user

function qq_login_create_user($username, $avatar_url_2, $openid)
{
    global $conf, $time, $longip;
    $arr = qq_login_read_user_by_openid($openid);
    if ($arr) {
        return xn_error(-2, '已经注册');
    }
    // 自动产生一个用户名
    $r = user_read_by_username($username);
    if ($r) {
        $username = $username . '_' . $time;
        $r = user_read_by_username($username);
        if ($r) {
            return xn_error(-1, '用户名被占用。');
        }
    }
    // 自动产生一个 Email
    $email = "qq_{$time}@qq.com";
    $r = user_read_by_email($email);
    if ($r) {
        return xn_error(-1, 'Email 被占用');
    }
    // 随机密码
    $password = md5(rand(1000000000, 9999999999) . $time);
    $user = array('username' => $username, 'email' => $email, 'password' => $password, 'gid' => 101, 'salt' => rand(100000, 999999), 'create_date' => $time, 'create_ip' => $longip, 'avatar' => 0, 'logins' => 1, 'login_date' => $time, 'login_ip' => $longip);
    $uid = user_create($user);
    if (empty($uid)) {
        return xn_error(-1, '注册失败');
    }
    $user = user_read($uid);
    $r = db_exec("INSERT INTO bbs_user_open_plat SET uid='{$uid}', platid='1', openid='{$openid}'");
    if (empty($uid)) {
        return xn_error(-1, '注册失败');
    }
    runtime_set('users+', '1');
    runtime_set('todayusers+', '1');
    // 头像不重要,忽略错误。
    if ($avatar_url_2) {
        $filename = "{$uid}.png";
        $dir = substr(sprintf("%09d", $uid), 0, 3) . '/';
        $path = $conf['upload_path'] . 'avatar/' . $dir;
        !is_dir($path) and mkdir($path, 0777, TRUE);
        $data = file_get_contents($avatar_url_2);
        file_put_contents($path . $filename, $data);
        user_update($uid, array('avatar' => $time));
    }
    return $user;
}
开发者ID:xianyuxmu,项目名称:alinkagarden-xiuno,代码行数:48,代码来源:qq_login.func.php

示例12: Copyright

# phpWebNotes - a php based note addition system
# Copyright (C) 2000-2002 Webnotes Team - webnotes-devel@sourceforge.net
# This program is distributed under the terms and conditions of the GPL
# See the files README and LICENSE for details
# --------------------------------------------------------
# $Id: admin_manage_users_update.php,v 1.6 2002/10/07 02:54:39 vboctor Exp $
# --------------------------------------------------------
require_once 'core' . DIRECTORY_SEPARATOR . 'api.php';
login_cookie_check();
access_ensure_check_action(ACTION_USERS_EDIT);
$f_user_id = gpc_get('f_user_id');
$f_email = gpc_get('f_email');
$f_password = gpc_get('f_password');
$f_password_confirm = gpc_get('f_password_confirm');
$f_access_level = gpc_get('f_access_level');
if ($f_password != $f_password_confirm) {
    util_header_redirect($g_admin_manage_users_edit . '?f_user_id=' . $f_user_id);
}
if (isset($f_enabled)) {
    $f_enabled = 1;
} else {
    $f_enabled = 0;
}
if (isset($f_protected)) {
    $f_protected = 1;
} else {
    $f_protected = 0;
}
user_update($f_user_id, $f_email, $f_password, $f_access_level, $f_enabled, $f_protected);
util_header_redirect($g_admin_manage_users);
开发者ID:BackupTheBerlios,项目名称:webnotes-svn,代码行数:30,代码来源:admin_manage_users_update.php

示例13: listingUsers

function listingUsers($db_connexion, $action = '')
{
    $query = "SELECT * FROM `users` order by `id_user` ASC";
    $statment = $db_connexion->query($query);
    $resultats = $statment->fetchall();
    if (empty($action)) {
        $output = "";
        $entete = array("Pseudo", "Email", "Nom", "Prénom", "Adresse", "Code Postal", "Date de création", "Date de dernière modif", "Actions");
        $output .= "<table class='table table-striped table-hover table-bordered'>\r\n        <thead>\r\n        <tr>";
        // boucle foreach pour créer des TH pour chaque valeur du tableau $entete
        foreach ($entete as $key => $value) {
            $output .= "<th>{$value}</th>";
        }
        $output .= "</tr></thead><tbody>";
        foreach ($resultats as $resultat) {
            $output .= "<tr>";
            $output .= "<td>" . $resultat["user_name"] . "</td>";
            $output .= "<td>" . $resultat["user_email"] . "</td>";
            $output .= "<td>" . $resultat["user_firstname"] . "</td>";
            $output .= "<td>" . $resultat["user_lastname"] . "</td>";
            $output .= "<td>" . $resultat["user_adress"] . "</td>";
            $output .= "<td>" . $resultat["user_zipcode"] . "</td>";
            $output .= "<td>" . $resultat["last_login"] . "</td>";
            $output .= "<td>" . $resultat["date_created"] . "</td>";
            $output .= "<td>\r\n                <ul>\r\n                  <li><a href='utilisateur.php?action=voir&id=" . $resultat["id_user"] . "'>Voir</a></li>\r\n                  <li><a href='utilisateur.php?action=modifier&id=" . $resultat["id_user"] . "'>Modifier</a></li>\r\n                  <li><a href='utilisateur.php?action=supprimer&id=" . $resultat["id_user"] . "'>Supprimer</a></li>\r\n                  </ul>\r\n              </td>\r\n              </tr>";
        }
        $output .= "</tbody>\r\n                </table>";
    } else {
        $action = $_GET['action'];
        if (isset($_GET["id"])) {
            $userID = $_GET["id"];
            switch ($action) {
                case 'voir':
                    $output = "";
                    $user = user_edit($db_connexion, $userID);
                    $output .= file_exists("../upload/300x400_" . $user["user_pic"]) ? "<img src='../upload/300x400_" . $user["user_pic"] . "'><br/>" : "";
                    $output .= !empty($user["user_lastname"]) ? "Nom : " . $user["user_lastname"] . "<br/>" : "";
                    $output .= !empty($user["user_firstname"]) ? "Prénom : " . $user["user_firstname"] . "<br/>" : "";
                    $output .= "Pseudo : " . $user["user_name"] . "<br/>";
                    $output .= "Email : " . $user["user_email"] . "<br/>";
                    break;
                case 'supprimer':
                    try {
                        $statement = $db_connexion->prepare("DELETE FROM users WHERE id_user=:id");
                        $statement->execute(array(":id" => $userID));
                        header("Location:utilisateur.php");
                    } catch (PDOException $e) {
                        echo $e->getMessage();
                    }
                    break;
                case 'modifier':
                    $output = user_update($userID, $db_connexion);
                    $action = "?action=modifier&id=1&step=image";
                    $output .= user_image_upload($userID, $db_connexion, $action, false);
                    break;
            }
        }
    }
    return $output;
}
开发者ID:amine142,项目名称:userprofil,代码行数:60,代码来源:user.inc.php

示例14: crud_operations

function crud_operations()
{
    if (session_okay()) {
        if (isset($_POST["user_add"])) {
            user_create();
        }
        if (g("crud") == "d" && !isset($_POST["user_add"])) {
            user_delete();
        }
        if (isset($_POST["user_update"])) {
            user_update();
        }
        if (g("crud") == "u") {
            crud_message_user_update();
        }
    }
}
开发者ID:alicankustemur,项目名称:LoginCrudPHPExample,代码行数:17,代码来源:crud_operations.php

示例15: pages

    $totalnum = $user['threads'];
    $pages = pages('my-thread-{page}.htm', $totalnum, $page, $pagesize);
    $threadlist = mythread_find_by_uid($uid, $page, $pagesize);
    include './flarum/view/my_thread.htm';
} elseif ($action == 'agree') {
    $page = param(2, 1);
    $pagesize = 20;
    // $conf['pagesize']
    $totalnum = $user['myagrees'];
    $pages = pages('my-agree-{page}.htm', $totalnum, $page, $pagesize);
    $threadlist = myagree_find_by_uid($uid, $page, $pagesize);
    include './flarum/view/my_agree.htm';
} elseif ($action == 'uploadavatar') {
    $upfile = param('upfile', '', FALSE);
    empty($upfile) and message(-1, 'upfile 数据为空');
    $json = xn_json_decode($upfile);
    empty($json) and message(-1, '数据有问题: json 为空');
    $name = $json['name'];
    $width = $json['width'];
    $height = $json['height'];
    $data = base64_decode($json['data']);
    $size = strlen($data);
    $filename = "{$uid}.png";
    $dir = substr(sprintf("%09d", $uid), 0, 3) . '/';
    $path = $conf['upload_path'] . 'avatar/' . $dir;
    $url = $conf['upload_url'] . 'avatar/' . $dir . $filename;
    !IN_SAE and !is_dir($path) and (mkdir($path, 0777, TRUE) or message(-2, '目录创建失败'));
    file_put_contents($path . $filename, $data) or message(-1, '写入文件失败');
    user_update($uid, array('avatar' => $time));
    message(0, $url);
}
开发者ID:jarryyen,项目名称:xiuno-theme-flarum,代码行数:31,代码来源:my.php


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