本文整理汇总了PHP中UserSession::getUserId方法的典型用法代码示例。如果您正苦于以下问题:PHP UserSession::getUserId方法的具体用法?PHP UserSession::getUserId怎么用?PHP UserSession::getUserId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserSession
的用法示例。
在下文中一共展示了UserSession::getUserId方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: extract
require '../include/init.inc.php';
$user_name = $password = $remember = $verify_code = '';
extract($_POST, EXTR_IF_EXISTS);
if (Common::isPost()) {
// 去掉验证码 if(strtolower($verify_code) != strtolower($_SESSION['osa_verify_code'])){
if (0) {
OSAdmin::alert("error", ErrorMessage::VERIFY_CODE_WRONG);
} else {
$user_info = User::checkPassword($user_name, $password);
if ($user_info) {
if ($user_info['status'] == 1) {
User::loginDoSomething($user_info['user_id']);
if ($remember) {
$encrypted = OSAEncrypt::encrypt($user_info['user_id']);
User::setCookieRemember(urlencode($encrypted), 30);
}
$ip = Common::getIp();
SysLog::addLog($user_name, 'LOGIN', 'User', UserSession::getUserId(), json_encode(array("IP" => $ip)));
Common::jumpUrl('panel/index.php');
} else {
OSAdmin::alert("error", ErrorMessage::BE_PAUSED);
}
} else {
OSAdmin::alert("error", ErrorMessage::USER_OR_PWD_WRONG);
SysLog::addLog($user_name, 'LOGIN', 'User', '', json_encode(ErrorMessage::USER_OR_PWD_WRONG));
}
}
}
Template::assign('_POST', $_POST);
Template::assign('page_title', '登入');
Template::Display('login.tpl');
示例2: extract
<?php
require '../include/init.inc.php';
$group_name = $group_desc = '';
extract($_POST, EXTR_IF_EXISTS);
if (Common::isPost()) {
$exist = UserGroup::getGroupByName($group_name);
if ($exist) {
OSAdmin::alert("error", ErrorMessage::NAME_CONFLICT);
} else {
if ($group_name == "") {
OSAdmin::alert("error", ErrorMessage::NEED_PARAM);
} else {
$input_data = array('group_name' => $group_name, 'group_desc' => $group_desc, 'group_role' => "1,5,17,18,22,23,24,25", 'owner_id' => UserSession::getUserId());
$group_id = UserGroup::addGroup($input_data);
if ($group_id) {
SysLog::addLog(UserSession::getUserName(), 'ADD', 'UserGroup', $group_id, json_encode($input_data));
Common::exitWithSuccess('账号组添加完成', 'complaint/group.php');
}
}
}
}
Template::assign("_POST", $_POST);
Template::display('complaint/group_add.tpl');
示例3:
<?php
require '../include/init.inc.php';
if (array_key_exists(UserSession::SESSION_NAME, $_SESSION)) {
SysLog::addLog(UserSession::getUserName(), 'LOGOUT', 'User', UserSession::getUserId());
}
User::logout();
Common::exitWithSuccess("您已安全登出!", "panel/login.php");
示例4: extract
<?php
require '../include/init.inc.php';
$t = '';
extract($_REQUEST, EXTR_IF_EXISTS);
$current_user_id = UserSession::getUserId();
if ($OSA_TEMPLATES[$t] == null) {
$t = "default";
}
$ret = User::setTemplate(UserSession::getUserId(), $t);
$_SESSION[UserSession::SESSION_NAME]['template'] = $t;
$rand = rand(0, 10000);
$back_url = $_SERVER['HTTP_REFERER'] . "#" . $rand;
header("Location:{$back_url}");
示例5: extract
<?php
require '../include/init.inc.php';
$user_name = $password = $real_name = $mobile = $email = $user_desc = $change_password = $show_quicknote = $old = $new = '';
extract($_POST, EXTR_IF_EXISTS);
$current_user_id = UserSession::getUserId();
if (Common::isPost()) {
if ($change_password) {
$ret = User::checkPassword(UserSession::getUserName(), $old);
if ($ret) {
if (strlen($new) < 6) {
OSAdmin::alert("error", ErrorMessage::PWD_TOO_SHORT);
} else {
$user_data['password'] = md5($new);
User::updateUser($current_user_id, $user_data);
SysLog::addLog(UserSession::getUserName(), 'MODIFY', 'User', $current_user_id);
Common::exitWithSuccess(ErrorMessage::PWD_UPDATE_SUCCESS, '/index.php');
}
} else {
OSAdmin::alert("error", ErrorMessage::OLD_PWD_WRONG);
}
} else {
$user_data['real_name'] = $real_name;
$user_data['mobile'] = $mobile;
$user_data['email'] = $email;
$user_data['user_desc'] = $user_desc;
$user_data['show_quicknote'] = $show_quicknote;
User::updateUser($current_user_id, $user_data);
UserSession::reload();
SysLog::addLog(UserSession::getUserName(), 'MODIFY', 'User', $current_user_id, json_encode($user_data));
Common::exitWithSuccess('资料修改成功', '/index.php');
示例6: array
OSAdmin::alert("error");
}
}
}
if ($method == 'play' && !empty($user_id)) {
$user_data = array("status" => 1);
$result = User::updateUser($user_id, $user_data);
if ($result >= 0) {
SysLog::addLog(UserSession::getUserName(), 'PLAY', 'User', $user_id, json_encode($user_data));
Common::exitWithSuccess('已解封', 'complaint/user.php');
} else {
OSAdmin::alert("error");
}
}
if ($method == 'del' && !empty($user_id)) {
if ($user_id == UserSession::getUserId()) {
OSAdmin::alert("error", ErrorMessage::CAN_NOT_DO_SELF);
} else {
if ($user_id == 1) {
Common::exitWithSuccess('不能删除初始管理员', 'complaint/user.php');
}
$user = User::getUserById($user_id);
$result = User::delUser($user_id);
if ($result >= 0) {
$user['password'] = null;
SysLog::addLog(UserSession::getUserName(), 'DELETE', 'User', $user_id, json_encode($user));
Common::exitWithSuccess('已删除', 'complaint/user.php');
} else {
OSAdmin::alert("error");
}
}
示例7: extract
<?php
require '../include/init.inc.php';
$note_content = '';
extract($_POST, EXTR_IF_EXISTS);
$note_content = Common::filterText($note_content);
if (Common::isPost()) {
if ($note_content == "") {
OSAdmin::alert("error", ErrorMessage::NEED_PARAM);
} else {
$note_content = htmlspecialchars($note_content);
$input_data = array('note_content' => $note_content, 'owner_id' => UserSession::getUserId());
$note_id = QuickNote::addNote($input_data);
if ($note_id) {
SysLog::addLog(UserSession::getUserName(), 'ADD', 'QuickNote', $note_id, json_encode($input_data));
Common::exitWithSuccess('便签添加成功', 'panel/quicknote_add.php');
}
}
}
Template::assign("_POST", $_POST);
Template::display('panel/quicknote_add.tpl');