本文整理汇总了PHP中sess函数的典型用法代码示例。如果您正苦于以下问题:PHP sess函数的具体用法?PHP sess怎么用?PHP sess使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了sess函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: c
public function c($rq = null)
{
$type = ['employee' => 1, 'agency' => 2, 'doctor' => 3];
$rq = rq();
$rq['senderid'] = uid();
$rq['sendername'] = username();
if (he_is('agency')) {
$rq['org'] = sess('org');
}
if (he_is('employee')) {
$rq['org'] = sess('org');
}
// return his_chara()[0];
$rq['sendertype'] = $type[his_chara()[0]];
if (his_chara()[0] == 'agency') {
$rq['recipienttype'] = 1;
$rq['recipientid'] = 1;
$rq['recipientname'] = 'admin';
} elseif (his_chara()[0] == 'employee') {
$rq['recipienttype'] = $type[$rq['recipienttype']];
}
// 验证发信规则
$valid = $this->verify($rq);
if (!$valid) {
return ee(2);
}
$rq['sendtime'] = date("Y-m-d H:i:s");
return parent::c($rq);
}
示例2: depQueryToResend
public function depQueryToResend()
{
$username = sess();
$d = M('Department');
$data = $d->select();
return $data;
//$this->assign('username', $username);
//$this->assign('data', $data);
//$this->display('ListByUser:resend');
}
示例3: login
/**
* 登入方法
* @param null $input
* @return array
*/
public function login($input = null)
{
$input = $input ? $input : rq();
if (!empty($input['user_type']) && $input['user_type'] == 'doctor' && !empty($input['cust_id'])) {
$d = M('doctor');
$d = $d->where('cust_id', $input['cust_id'])->first();
if ($d) {
log_him_in(['uid' => $d->id]);
add_chara($input['user_type']);
return ss();
}
return $d ? ss($d) : ee(2);
}
if (!empty($input['user_type']) && !empty($input['username']) && !empty($input['password'])) {
$input['password'] = hash_password($input['password']);
$user = $this->user_exists($input['user_type'], array_only($input, ['username', 'password']));
if ($user) {
$lifetime = 6000;
log_him_in(['username' => $user->username, 'uid' => $user->id], $lifetime);
add_chara($input['user_type']);
if ($input['user_type'] == 'employee') {
sess('permission', $user->permissions);
} else {
sess('permission', []);
}
if ($input['user_type'] == 'agency') {
sess('org', $user->name);
sess('name_in_charge', $user->name_in_charge);
}
if ($input['user_type'] == 'department') {
sess('org', $user->hospital_name . ':' . $user->name);
}
if ($input['user_type'] == 'employee') {
sess('org', $user->name);
}
// 添加日志
ILog::login($input['user_type'], $user);
return ss($user);
}
} else {
return ee(2);
}
return ee(2);
}
示例4: front
public function front()
{
$cache = Cache::get('i_settings', null);
$per_page = array_get($cache, 'user.per_page');
$d = ['debug' => debugging(), 'is_logged_in' => sess('is_logged_in'), 'his_chara' => sess('his_chara'), 'username' => sess('username'), 'uid' => sess('uid'), 'per_page' => $per_page, 'agency_end' => $this->retrieve('system.agency_end')];
$type = ['employee' => 1, 'agency' => 2, 'doctor' => 3];
// 获取未读通知
if (uid()) {
$d['unread'] = M('message')->where('recipientid', uid())->where('recipienttype', $type[his_chara()[0]])->where('read', 0)->count();
} else {
$d['unread'] = 0;
}
$d['org'] = '';
if (he_is('agency')) {
$org = DB::table(table_name('agency'))->select('name')->where('id', uid())->first();
sess('org', $org->name);
$d['org'] = sess('org');
}
if (he_is('employee')) {
$d['org'] = sess('org');
}
return ss($d);
}
示例5: date_default_timezone_set
<?php
date_default_timezone_set("Europe/Moscow");
//подключение
include "includes/kernel.php";
db_connect();
$noclose = 0;
if (strpos($_REQUEST[action], "/") !== false || strpos($_REQUEST[action], "\\") !== false) {
die("error");
}
sess($noclose);
//страница
if ($_REQUEST[action]) {
$action = $_REQUEST[action];
} else {
die("error");
}
//проверка наличия страницы
if (!file_exists("actions/" . $action . ".php")) {
die("error");
}
//залогинен ли?
$user = islogin();
if (!$user && ($action != 'login' && $action != 'autologin' && $action != 'reg')) {
redirect("index.php");
}
header('Content-Type: text/html; charset=windows-1251');
include "actions/" . $action . ".php";
示例6: json_decode
if ($q->status == 200) {
return json_decode($q->body, true);
}
return array();
}
$result = verify(REQUEST_URI, @file_get_contents('php://input'));
$email = isset($result['verifiedEmail']) ? strtolower($result['verifiedEmail']) : '';
$name = isset($result['displayName']) ? $result['displayName'] : '';
$firstName = isset($result['firstName']) ? $result['firstName'] : '';
$lastName = isset($result['lastName']) ? $result['lastName'] : '';
if (strlen($email)) {
sess('u:id', "mailto:{$email}");
sess('u:link', "mailto:{$email}");
sess('u:name', strlen($name) ? $name : $email);
}
$next = sess('next', null);
if (!is_string($next) || !strlen($next)) {
$next = '/login';
}
?>
<script type="text/javascript">
var next = <?php
echo json_encode($next);
?>
;
if (opener) {
opener.location = next;
window.close();
} else {
window.location = next;
}
示例7: his_captcha_data
function his_captcha_data()
{
$d = sess('him.captcha_data');
if ($d) {
return sess('him.captcha_data');
}
return 0;
}
示例8: count
$time = $TAGS[count($TAGS) - 1]['time'] - $TAGS[0]['time'];
$caller = $TAGS[count($TAGS) - 2];
$sparql_n = 0;
$sparql_t = 0;
if (isset($timings)) {
$sparql_n = count($timings);
foreach ($timings as $t) {
$sparql_t += $t['time'];
}
}
?>
<hr class="center" />
<div class="center align-right width-1024">
<?php
$user_link = sess('u:link');
$user_name = sess('u:name');
if (is_null($user_name) || !strlen($user_name)) {
$user_name = $_user;
}
if ($_options->coderev) {
$src = explode('/', __FILE__);
$src = array_slice($src, array_search('www', $src));
$src = implode('/', $src);
$src = "https://github.com/linkeddata/data.fm/tree/master/{$src}";
$queryFoot = $sparql_n < 1 ? '' : sprintf('with %d quer%s in %ss', $sparql_n, $sparql_n > 1 ? 'ies' : 'y', substr($sparql_t, 0, 6));
$versionFoot = implode(' / ', array('librdf: ' . array_shift(explode(' ', librdf_version_string_get())), 'raptor: ' . array_shift(explode(' ', raptor_version_string_get())), 'rasqal: ' . array_shift(explode(' ', rasqal_version_string_get()))));
?>
<div class="footer">
<span id="codeTime" ng-mouseenter="runtime=1" ng-mouseleave="runtime=0">
<em ng-if="runtime"><?php
echo $versionFoot;
示例9: front
public function front()
{
$d = ['debug' => debugging(), 'is_logged_in' => sess('is_logged_in'), 'his_chara' => sess('his_chara'), 'username' => sess('username'), 'uid' => sess('uid')];
return ss($d);
}
示例10: processReporter
private function processReporter($realName = '')
{
$formattedRet = array();
if ($realName) {
$var = $this->news_model->getDetailReporter($realName);
if (count($var) > 0) {
#$formattedRet[] = array('email' => $var[0]['user_email'],'user_fullname'=>$var[0]['user_realname']);
$formattedRet[] = array('id' => $var[0]['user_id'], 'name' => $var[0]['user_realname']);
}
} else {
$formattedRet[] = array('id' => sess('usr_id'), 'name' => sess('usr_fullname'));
}
return json_encode($formattedRet);
}
示例11: modiPassProcess
public function modiPassProcess()
{
$newpass = $_POST['confirm'];
$username = sess();
$u = M('User');
$where['username'] = $username;
$data['password'] = md5($newpass);
$save = $u->where($where)->save($data);
if (!$save) {
$this->error('修改失败');
}
if ($username == 'admin') {
$this->success('修改成功', "__APP__/User/modiUser", 2);
} else {
$this->success('修改成功', "__APP__/ListByUser/revBox", 2);
}
}
示例12: processReporter
private function processReporter($realName = '')
{
$formattedRet = array();
if ($realName != '') {
if (strpos($realName, ',')) {
$arr_nama = explode(',', $realName);
foreach ($arr_nama as $key => $value) {
$var = $this->news_model->getDetailReporter($value);
if (count($var) > 0) {
$formattedRet[] = array('id' => $var[0]['user_id'], 'name' => $var[0]['user_realname']);
}
}
} else {
$var = $this->news_model->getDetailReporter($realName);
if (count($var) > 0) {
#$formattedRet[] = array('email' => $var[0]['user_email'],'user_fullname'=>$var[0]['user_realname']);
$formattedRet[] = array('id' => $var[0]['user_id'], 'name' => $var[0]['user_realname']);
}
}
} else {
$formattedRet[] = array('id' => sess('usr_id'), 'name' => sess('usr_fullname'));
}
return json_encode($formattedRet);
}
示例13: modiPass
public function modiPass()
{
sess();
$this->display();
}
示例14: profile
public function profile()
{
$this->load->helper('core/user_helper');
$data = $this->syter->spawn('profile');
$user = sess('user');
// echo var_dump($user);
$args = array();
$join = array();
$select = "users.*,user_roles.role";
$args['users.id'] = $user['id'];
$join['user_roles'] = array('content' => 'users.role=user_roles.id', 'mode' => 'left');
$result = $this->site_model->get_tbl('users', $args, array(), $join, true, $select);
$res = $result[0];
$img = array();
$resultIMG = $this->site_model->get_image(null, $user['id'], 'users');
if (count($resultIMG) > 0) {
$img = $resultIMG[0];
}
$data['code'] = userProfilePage($res, $img);
$data['page_title'] = fa('fa-user') . " User Profile";
$data['load_js'] = 'site/user';
$data['use_js'] = 'profileJs';
$this->load->view('page', $data);
}
示例15: sess
function sess($id, $val = NULL)
{
if (func_num_args() == 1) {
return isSess($id) ? $_SESSION[$id] : NULL;
} elseif (is_null($val)) {
$r = isset($_SESSION[$id]) ? $_SESSION[$id] : null;
unset($_SESSION[$id]);
return $r;
} else {
$prev = sess($id);
$_SESSION[$id] = $val;
return $prev;
}
}