1 Star 0 Fork 0

pocdoc/WeXin

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
member.php 2.09 KB
一键复制 编辑 原始数据 按行查看 历史
== 提交于 2014-07-03 10:11 . change
<?php
/**
* 用户管理
*
* [WeEngine System] Copyright (c) 2013 WE7.CC
*/
define('IN_SYS', true);
require 'source/bootstrap.inc.php';
$actions = array();
$action = $_GET['act'];
if($_W['uid']) {
$actions = array('logout', 'setting', 'wechat', 'module', 'barcode');
if($_W['isfounder']) {
$actions = array_merge($actions, array('create', 'edit', 'display', 'select', 'group', 'fields', 'permission'));
}
if (!in_array($action, $actions)) {
header('Location: ./index.php');
}
} else {
$actions = array('login', 'register', 'code');
$action = in_array($action, $actions) ? $action : 'login';
}
$controller = 'member';
require router($controller, $action);
function _login($forward = '') {
global $_GPC;
require_once IA_ROOT . '/source/model/member.mod.php';
hooks('member:login:before');
$member = array();
$username = trim($_GPC['username']);
if(empty($username)) {
message('请输入要登录的用户名');
}
$member['username'] = $username;
$member['password'] = $_GPC['password'];
if(empty($member['password'])) {
message('请输入密码');
}
$record = member_single($member);
if(!empty($record)) {
if($record['status'] == -1) {
message('您的账号正在核合或是已经被系统禁止,请联系网站管理员解决!');
}
$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;
member_update($status);
hooks('member:login:success');
if(empty($forward)) {
$forward = $_GPC['forward'];
}
if(empty($forward)) {
$forward = './index.php?refersh';
}
message("欢迎回来,{$record['username']}。", $forward);
} else {
message('登录失败,请检查您输入的用户名和密码!');
}
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
PHP
1
https://gitee.com/pocdoc/WeXin.git
git@gitee.com:pocdoc/WeXin.git
pocdoc
WeXin
WeXin
master

搜索帮助

0d507c66 1850385 C8b1a773 1850385