function deleteUser() { if ($_SESSION['uid'] != '1') { $msg = "权限不足,无法删除用户!<meta http-equiv='refresh' content='1;url=user.php'/>"; return $msg; } $uid = $_REQUEST['uid']; if ($uid == 1) { $msg = "管理员无法被删除!"; return $msg; } // delete user avatar $row = getUserByUid($uid); $filename = "images/uploads/avatar/" . $row['avatar']; if (file_exists($filename)) { unlink($filename); } $filename = "images/uploads/avatar_50/" . $row['avatar']; if (file_exists($filename)) { unlink($filename); } $filename = "images/uploads/avatar_100/" . $row['avatar']; if (file_exists($filename)) { unlink($filename); } //delete user postImage $sql = "select zhx_album.pid,image,iid from zhx_post right join zhx_album on zhx_post.pid=zhx_album.pid where zhx_post.uid={$uid}"; $rows = fetchAll($sql); if ($rows) { foreach ($rows as $row) { $filename = "images/uploads/postImage/" . $row['image']; if (file_exists($filename)) { unlink($filename); } $filename = "images/uploads/postImage_500/" . $row['image']; if (file_exists($filename)) { unlink($filename); } delete("zhx_album", "iid=" . $row['iid']); } } //delete user notify in and out $where = "uid=" . $uid . " or nuid=" . $uid; delete("zhx_notify", $where); //delete user like in and out delete("zhx_like", "uid=" . $uid); $sql = 'select lid from zhx_post right join zhx_like on zhx_post.pid=zhx_like.pid where zhx_post.uid=' . $uid; $rows = fetchAll($sql); if ($rows) { foreach ($rows as $row) { delete('zhx_like', 'lid=' . $row['lid']); } } //delete user comment in and out delete("zhx_comment", "uid=" . $uid); $sql = 'select cid from zhx_post right join zhx_comment on zhx_post.pid=zhx_comment.pid where zhx_post.uid=' . $uid; $rows = fetchAll($sql); if ($rows) { foreach ($rows as $row) { delete('zhx_comment', 'cid=' . $row['cid']); } } // delete user posts delete("zhx_post", "uid=" . $uid); //delete user account delete("zhx_user", "uid=" . $uid); $msg = "用户删除成功!<meta http-equiv='refresh' content='1;url=admin.php'/>"; return $msg; }
<?php /** * Created by PhpStorm. * User: Liu * Date: 2016/2/18 * Time: 21:56 */ $uid = $_SESSION['uid']; include_once "../dao/getUser.php"; $firstName = ""; $lastName = ""; if ($uid != null) { $user = mysql_fetch_array(getUserByUid($uid)); $firstName = $user['firstName']; $lastName = $user['lastName']; } if ($user['username'] != "admin") { ?> <body style ="background-image: url('../css/login_background.jpg'); background-attachment: fixed"> <?php } else { ?> <body style ="background-image: url('../css/admin_background.gif'); background-attachment: fixed"> <?php } ?> <div style="z-index: 0" class="navbar navbar-default navbar-fixed-top"> <?php if ($user['username'] != "admin") { ?>
function User_info() { global $db, $timestamp, $db_onlinetime, $winduid, $windpwd, $safecv, $db_ifonlinetime, $c_oltime, $onlineip, $db_ipcheck, $tdtime, $montime, $db_ifsafecv, $db_ifpwcache, $uc_server; PwNewDB(); $detail = getUserByUid($winduid); if (empty($detail) && $uc_server) { require_once R_P . 'require/ucuseradd.php'; } $loginout = 0; if ($db_ipcheck && strpos($detail['onlineip'], $onlineip) === false) { $iparray = explode('.', $onlineip); strpos($detail['onlineip'], $iparray[0] . '.' . $iparray[1]) === false && ($loginout = 1); } if (!$detail || PwdCode($detail['password']) != $windpwd || $db_ifsafecv && $safecv != $detail['safecv'] || $loginout || $detail['yz'] > 1) { $GLOBALS['groupid'] = 'guest'; require_once R_P . 'require/checkpass.php'; Loginout(); if ($detail['yz'] > 1) { $GLOBALS['jihuo_uid'] = $detail['uid']; Showmsg('login_jihuo'); } Showmsg('ip_change'); } else { list($detail['shortcut'], $detail['appshortcut']) = explode("\t", $detail['shortcut']); unset($detail['password']); $detail['honor'] = substrs($detail['honor'], 90); $distime = $timestamp - $detail['lastvisit']; if ($distime > $db_onlinetime || $distime > 3600) { //Start elementupdate if ($db_ifpwcache & 1 && SCR != 'post' && SCR != 'thread') { require_once R_P . 'lib/elementupdate.class.php'; $elementupdate = new ElementUpdate(); $elementupdate->userSortUpdate($detail); } //End elementupdate if (!GetCookie('hideid')) { $ecpvisit = pwEscape($timestamp, false); $ct = 'lastvisit=' . $ecpvisit . ',thisvisit=' . $ecpvisit; if ($db_ifonlinetime) { $c_oltime = $c_oltime <= 0 ? 0 : ($c_oltime > $db_onlinetime * 1.2 ? $db_onlinetime : intval($c_oltime)); $s_oltime = pwEscape($c_oltime, false); $ct .= ',onlinetime=onlinetime+' . $s_oltime; if ($detail['lastvisit'] > $montime) { $ct .= ',monoltime=monoltime+' . $s_oltime; } else { $ct .= ',monoltime=' . $s_oltime; } $c_oltime && updateDatanalyse($winduid, 'memberOnLine', $c_oltime); $c_oltime = 0; } $db->update("UPDATE pw_memberdata SET {$ct} WHERE uid=" . pwEscape($winduid)); $detail['lastvisit'] = $detail['thisvisit'] = $timestamp; } } } return $detail; }
<?php require_once 'include.php'; checkLogin(); $avatar = getUserByUid($_SESSION['uid'])['avatar']; $uid = $_SESSION['uid']; $notify_num = getNotifyNumByuid($uid); ?> <!DOCTYPE HTML> <html> <head> <meta charset="utf-8"> <meta name="description" content=""> <meta name="keywords" content=""> <meta http-equiv="x-ua-compatible" content="ie=7" /> <meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport"> <title><?php echo $pageTitle; ?> -自画像</title> <link rel="stylesheet" href="styles/style.css"> <script src="scripts/jquery.js"></script> <script src="scripts/notifyRedirect.js"></script> </head> <body> <header> <div class="logo"> <a class="logo_image" href="user.php"><h1>自画像</h1></a> <a class="logo_menu" href="find.php">发现</a>
<?php !defined('P_W') && exit('Forbidden'); if (empty($detail) && GetCookie('ucuser')) { require_once R_P . 'uc_client/uc_client.php'; list($winduid, $md5pwd) = explode("\t", addslashes(StrCode(GetCookie('ucuser'), 'DECODE'))); $detail = uc_user_check($winduid, $md5pwd); } if ($detail['uid'] > 0) { $register = L::loadClass('Register', 'user'); $register->appendUser($detail['uid'], $detail['username'], $detail['password'], $detail['email']); $detail = getUserByUid($detail['uid']); }
<?php $pageTitle = "修改资料"; require_once 'includes/header.php'; $user_data = getUserByUid($uid); // print_r($user_data); ?> <form class="form_b4" method="post" action="doAction.php?act=changeInfo" enctype="multipart/form-data"> <img src="images/uploads/avatar/<?php echo $user_data['avatar']; ?> " alt=""><br><br> <label for="avatar">更新头像:</label><br> <input style="width:170px;" type="file" id="avatar" name="avatar" accept="image/jpeg,image/gif,image/jpg,image/png"><br><br> <label for="name">更改姓名:</label><br> <input type="text" value="<?php echo $user_data['name']; ?> " name="name"><br><br> <i>更改密码</i> <hr> <label for="password">当前密码:</label><br> <input type="password" name="password"><br><br> <label for="passwordNew">新密码:</label><br> <input type="password" name="passwordNew" placeholder="留空则为当前密码"><br><br><br> <hr>
function _getUserIconByUid($uid) { $userInfo = getUserByUid($uid); if (!$userInfo) { return ''; } require_once R_P . 'require/showimg.php'; $result = showfacedesign($userInfo['icon'], 1, 's'); return $result[0]; }
echo $like_user['avatar']; ?> "> </a> <?php } echo '</li>'; } // show comment content echo "<div class='comment' id='comment" . $row['pid'] . "'>"; if ($comment_data[0]['uid']) { echo '<li class="post_comment">'; foreach ($comment_data as $comment) { echo '<ul class=post_comment_row>'; $comment_user = getUserByUid($comment['uid']); ?> <a class="post_comment_user" href="viewUser.php?target_uid=<?php echo $comment_user['uid']; ?> "> <span class="post_avatar"> <img title="<?php echo $comment_user['name']; ?> " src="images/uploads/avatar_50/<?php echo $comment_user['avatar']; ?> ">
<?php /** * Created by Chenguang Bai. * Date: 2016/2/27 */ include_once "DBHelper.php"; include_once "getUser.php"; session_start(); $uid = $_SESSION['uid']; $result = getUserByUid($uid); echo json_encode(mysql_fetch_array($result));
/** * 获取用户信息 */ function User_info() { global $db, $timestamp, $db_onlinetime, $winduid, $windpwd, $bday, $safecv, $db_ifonlinetime, $c_oltime, $onlineip, $db_ipcheck, $tdtime, $montime, $db_ifsafecv, $db_ifpwcache, $uc_server, $db_md_ifopen; PwNewDB(); $detail = getUserByUid($winduid); if (empty($detail) && $uc_server) { require_once R_P . 'require/ucuseradd.php'; } $loginout = 0; if ($db_ipcheck && strpos($detail['onlineip'], $onlineip) === false) { $iparray = explode('.', $onlineip); strpos($detail['onlineip'], $iparray[0] . '.' . $iparray[1]) === false && ($loginout = 1); } if (!$detail || PwdCode($detail['password']) != $windpwd || $db_ifsafecv && $safecv != $detail['safecv'] || $loginout || $detail['yz'] > 1) { $GLOBALS['groupid'] = 'guest'; require_once R_P . 'require/checkpass.php'; Loginout(); if ($detail['yz'] > 1) { $GLOBALS['jihuo_uid'] = $detail['uid']; Showmsg('login_jihuo'); } Showmsg('ip_change'); } else { list($detail['shortcut'], $detail['appshortcut']) = explode("\t", $detail['shortcut']); unset($detail['password']); $detail['honor'] = substrs($detail['honor'], 90); $distime = $timestamp - $detail['lastvisit']; if ($distime > $db_onlinetime || $distime > 3600) { /*--- element update ---start*/ if ($db_ifpwcache & 1 && SCR != 'post' && SCR != 'thread') { L::loadClass('elementupdate', '', false); $elementupdate = new ElementUpdate(); $elementupdate->userSortUpdate($detail); } /*--- element update ---end*/ if (!GetCookie('hideid')) { $userService = L::loadClass('UserService', 'user'); /* @var $userService PW_UserService */ $updateMemberData = $updateByIncrementMemberData = array(); $updateMemberData['lastvisit'] = $timestamp; $updateMemberData['thisvisit'] = $timestamp; if ($db_ifonlinetime) { $c_oltime = intval($c_oltime); $c_oltime = $c_oltime <= 0 ? 0 : ($c_oltime > $db_onlinetime * 1.2 ? $db_onlinetime : $c_oltime); $updateByIncrementMemberData['onlinetime'] = $c_oltime; if ($detail['lastvisit'] > $montime) { $updateByIncrementMemberData['monoltime'] = $c_oltime; } else { $updateMemberData['monoltime'] = $c_oltime; } if ($c_oltime) { require_once R_P . 'require/functions.php'; updateDatanalyse($winduid, 'memberOnLine', $c_oltime); } $c_oltime = 0; } if (get_date($timestamp, 'Y-m-d') > get_date($detail['lastvisit'], 'Y-m-d')) { /*更新今日登录数*/ $stasticsService = L::loadClass('Statistics', 'datanalyse'); $stasticsService->login($winduid); /*连续登录天数*/ if ($db_md_ifopen) { require_once R_P . 'require/functions.php'; doMedalBehavior($winduid, 'continue_login'); } } $userService->update($winduid, array(), $updateMemberData); $updateByIncrementMemberData && $userService->updateByIncrement($winduid, array(), $updateByIncrementMemberData); $detail['lastvisit'] = $detail['thisvisit'] = $timestamp; } } } return $detail; }
<?php $pageTitle = "消息"; require_once 'includes/header.php'; $rows = getUserNotifys($uid, 10); echo '<ul class="notify_list">'; echo '<li>' . $notify_num . ' 条未读'; if ($notify_num > 0) { echo ' ⁄ <a href="doAction.php?act=markAllRead" style="text-decoration: none">全部标记为已读</a>'; } echo '</li>'; if ($rows) { foreach ($rows as $row) { $row['name'] = getUserByUid($row['uid'])['name']; // $row['post_name']=substr(getPostBypid($row['pid'])['post'],0,10); $row['post_name'] = getPostBypid($row['pid'])['post']; ?> <li class="notify_row <?php if ($row['readed'] == "0") { echo "notify_active"; } ?> "> <?php if ($row['uid'] == $row['nuid']) { ?> <span> 你 <?php if ($row['type'] == "like") {