本文整理汇总了PHP中Session::del方法的典型用法代码示例。如果您正苦于以下问题:PHP Session::del方法的具体用法?PHP Session::del怎么用?PHP Session::del使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Session
的用法示例。
在下文中一共展示了Session::del方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: registerAction
/**
* 确认注册【设定密码】
* @method registerAction
* @return [type] [description]
* @author NewFuture
*/
public function registerAction()
{
$msg = '信息注册失败!';
if ($regInfo = Session::get('reg')) {
Session::del('reg');
if (Input::post('password', $password, 'trim') === false) {
/*密码未md5*/
$this->error('密码错误', '/');
} elseif (!$password) {
/*未设置密码*/
$password = $regInfo['password'];
}
$regInfo['password'] = Encrypt::encryptPwd($password, $regInfo['number']);
if ($id = UserModel::insert($regInfo)) {
/*注册成功*/
$regInfo['id'] = $id;
$token = Auth::token($regInfo);
Cookie::set('token', [$id => $token]);
unset($regInfo['password']);
Session::set('user', $regInfo);
$msg = '信息注册成功!';
}
}
$this->jump('/', $msg);
}
示例2: moveFileSessionToTmp
/**
* セッションに保存されたファイルデータをファイルとして保存する
*
* @param Model $model
* @param string $fieldName
* @return void
* @access public
*/
function moveFileSessionToTmp(&$model, $fieldName)
{
$sessionKey = $model->data[$model->alias][$fieldName . '_tmp'];
$tmpName = $this->savePath . $sessionKey;
$fileData = $this->Session->read('Upload.' . $sessionKey);
$fileType = $this->Session->read('Upload.' . $sessionKey . '_type');
$this->Session->del('Upload.' . $sessionKey);
$this->Session->del('Upload.' . $sessionKey . '_type');
// サイズを取得
if (ini_get('mbstring.func_overload') & 2 && function_exists('mb_strlen')) {
$fileSize = mb_strlen($fileData, 'ASCII');
} else {
$fileSize = strlen($fileData);
}
if ($fileSize == 0) {
return false;
}
// ファイルを一時ファイルとして保存
$file = new File($tmpName, true, 0666);
$file->write($fileData);
$file->close();
// 元の名前を取得
$pos = strpos($sessionKey, '_');
$fileName = substr($sessionKey, $pos + 1, strlen($sessionKey));
// アップロードされたデータとしてデータを復元する
$uploadInfo['error'] = 0;
$uploadInfo['name'] = $fileName;
$uploadInfo['tmp_name'] = $tmpName;
$uploadInfo['size'] = $fileSize;
$uploadInfo['type'] = $fileType;
$model->data[$model->alias][$fieldName] = $uploadInfo;
unset($model->data[$model->alias][$fieldName . '_tmp']);
}
示例3: actionIndex
public function actionIndex()
{
// Запомним адрес откуда пришли (с какого сайта)
// чтобы после авторизации вернутся на него
// todo Запомнить HTTP_REFERER
$this->scripts[] = 'auth';
Session::del('auth');
$this->data['authdata'] = false;
$this->render('form');
}
示例4: destroy
public function destroy()
{
Session::del('Twitter_Token');
Session::del('Twitter_TokenSecret');
Session::del('Twitter_State');
$this->oauth = new OAuth(self::CONFIG_KEY, self::CONFIG_SECRET);
$this->state = self::STATE_NOTHING;
$this->token = '';
$this->tokenSecret = '';
TwCensus::redirect('/');
}
示例5: clear_status_msg
public function clear_status_msg()
{
$msg_id = WebApp::get('msg_id');
if ($msg_id === NULL) {
$msg_id = WebApp::post('msg_id');
}
if ($msg_id === NULL) {
$this->parent->parent->debug($this::name_space . ': MSG ID was not provided!');
return new ActionResult($this, '/', 0, 'Failed to clear status message. No ID found.', B_T_FAIL);
}
$msg_id = trim(str_replace('alert_', '', $msg_id));
$msg_id = base64_decode($msg_id);
Session::del('status_msg', $msg_id);
$this->parent->parent->debug($this::name_space . ': MSG ID "' . $msg_id . '" was ' . (Session::get('status_msg', $msg_id) === NULL ? '' : 'not ') . 'cleared');
return new ActionResult($this, '/', 0, 'Cleared status message.', B_T_SUCCESS);
}
示例6: processRequest
/**
* This file is a part of MyWebSQL package
*
* @file: modules/showcreate.php
* @author Samnan ur Rehman
* @copyright (c) 2008-2014 Samnan ur Rehman
* @web http://mywebsql.net
* @license http://mywebsql.net/license
*/
function processRequest(&$db)
{
Session::del('select', 'result');
Session::del('select', 'pkey');
Session::del('select', 'ukey');
Session::del('select', 'mkey');
Session::del('select', 'unique_table');
Session::set('select', 'result', array());
$extraMsg = '';
$type = $_REQUEST["id"];
$name = $_REQUEST["name"];
$cmd = $db->getCreateCommand($type, $name);
$cmd = sanitizeCreateCommand($type, $cmd);
$tm = $db->getQueryTime();
$sql = $db->getLastQuery();
$sql = preg_replace("/[\n\r]/", "<br/>", htmlspecialchars($sql));
$replace = array('TYPE' => $type, 'NAME' => $name, 'COMMAND' => $cmd, 'TIME' => $tm, 'SQL' => $sql, 'MESSAGE' => $extraMsg);
echo view('showcreate', $replace);
}
示例7: processRequest
/**
* This file is a part of MyWebSQL package
*
* @file: modules/dbcreate.php
* @author Samnan ur Rehman
* @copyright (c) 2008-2012 Samnan ur Rehman
* @web http://mywebsql.net
* @license http://mywebsql.net/license
*/
function processRequest(&$db)
{
Session::del('select', 'result');
Session::del('select', 'pkey');
Session::del('select', 'ukey');
Session::del('select', 'mkey');
Session::del('select', 'unique_table');
Session::set('select', 'result', array());
$dbName = $_REQUEST["name"];
$dbSelect = $_REQUEST["query"];
$sql = '';
if (!$db->createDatabase($dbName)) {
createErrorGrid($db);
} else {
$redirect = '0';
if ($dbSelect) {
Session::set('db', 'changed', true);
Session::set('db', 'name', $dbName);
$redirect = '1';
}
$replace = array('DB_NAME' => htmlspecialchars($dbName), 'SQL' => preg_replace("/[\n\r]/", "<br/>", htmlspecialchars($sql)), 'TIME' => $db->getQueryTime(), 'REDIRECT' => $redirect);
echo view('dbcreate', $replace);
}
}
示例8: delSession
function delSession($id)
{
$tobeDeleted = new Session($id);
if ($tobeDeleted->isNew()) {
return true;
}
// item never existed in the first place
if ($tobeDeleted->del()) {
return true;
} else {
return $tobeDeleted;
}
}
示例9: PUT_phoneAction
/**
* 修改用户手机
* PUT /user/1/phone {code:"C09E"}
* @method GET_infoAction
* @param integer $id [description]
* @author NewFuture
*/
public function PUT_phoneAction($id = 0)
{
$id = $this->auth($id);
$response['status'] = 0;
if (!Input::put('code', $code, 'ctype_alnum')) {
$response['info'] = '验证码格式不对';
} elseif (!($verify = Session::get('code_phone'))) {
$response['info'] = '验证码已过期,请重新生成';
} elseif (!Safe::checkTry('phone_code_' . $id)) {
$response['info'] = '此验证码尝试次数过多,请重新发送短信';
Session::del('code_phone');
} elseif (key($verify) != strtoupper($code)) {
$response['info'] = '验证码错误';
} else {
session::del('code_phone');
Safe::del('phone_code_' . $id);
$phone = $verify[strtoupper($code)];
//读取号码
if (UserModel::SavePhone($phone)) {
$response['info'] = '手机号已经更新';
$response['status'] = 1;
} else {
$response['info'] = '手机号保存失败';
}
}
$this->response = $response;
}
示例10: logout
/**
* Logs a user out
* @param boolean (optional) parameter given to Auth::redirect()
* @return void
* @acess public
*/
public function logout($from = false)
{
$this->session->del(USER_LOGIN_VAR);
$this->session->del(USER_PASSW_VAR);
$this->session->del('login_hash');
$this->redirect($from);
}
示例11: clearRoles
function clearRoles()
{
$_xhelpSession = new Session();
if ($myRoles =& $_xhelpSession->get("xhelp_hasRights")) {
$_xhelpSession->del("xhelp_hasRights");
return true;
}
return false;
}
示例12: helpCheckUpdates
echo $DB->name();
?>
;
var commandEditor = null;
var commandEditor2 = null;
var commandEditor3 = null;
<?php
include BASE_PATH . '/config/updates.php';
if ($AUTOUPDATE_CHECK === TRUE && Session::get('updates', 'check') == '') {
if (in_array(date('D'), $AUTOUPDATE_DAYS)) {
echo "\n\t\$(function() { helpCheckUpdates(); });\n";
}
}
if (Session::get('db', 'changed')) {
echo 'document.getElementById("messageContainer").innerHTML = "Database changed to: ' . htmlspecialchars(Session::get('db', 'name')) . '";';
Session::del('db', 'changed');
} else {
echo 'document.getElementById("messageContainer").innerHTML = "Connected to: ' . DB_HOST . ' as ' . DB_USER . '";';
}
?>
</script>
<script type="text/javascript" language="javascript" src="cache.php?script=layout,ui,dialogs,context,alerts,cookies,select,interface,options,treeview,common,taskbar,settings,query,tables,clipboard"></script>
<?php
$DB->disconnect();
echo getContextMenusHTML();
updateSqlEditor();
echo getHotkeysHTML();
echo getGeneratedJS();
?>
</body></html>
<?php
示例13: simpleQuery
function simpleQuery(&$db)
{
$query = v($_REQUEST["query"]);
if (!$query) {
$query = Session::get('select', 'query');
}
// try to load from session
if (!$query) {
return '';
}
// see if user is restricted to a list of databases by configuration
// if yes, then disallow db use queries
// it's still possible that the command can contain db prefixes, which will override the db selection
//$info = getCommandInfo($query);
//if ($info['dbChanged'])
// return '';
$query_type = getQueryType($query);
if ($query_type['result'] == TRUE) {
Session::del('select', 'table');
Session::del('select', 'limit');
Session::del('select', 'has_limit');
Session::del('select', 'page');
Session::del('select', 'count');
Session::set('select', 'query', $query);
Session::set('select', 'has_limit', $query_type['has_limit'] == TRUE);
}
// try to find limit clause in the query. If one is not applied, apply now
/*$regExpr = "/limit [0-9]+((\s)*,(\s)*[0-9]+)/";
preg_match($regExpr, $query, $matches);
if (isset($matches[1]))
{
//$query = str_replace($matches[1], "", $query);
}
else
{
$limitStart = v($_REQUEST['ls']) && ctype_digit(v($_REQUEST['ls'])) ? v($_REQUEST['ls']) : 0;
$limitEnd = v($_REQUEST['le']) && ctype_digit(v($_REQUEST['le'])) ? v($_REQUEST['le']) : MAX_RECORD_TO_DISPLAY;
$_SESSION['limit_start'] = $limitStart;
$_SESSION['limit_end'] = $limitEnd;
$_SESSION['limit_applied'] = 1;
}*/
return $query;
}
示例14: actionLogout
public function actionLogout()
{
Session::del('auth');
Session::destroy();
setcookie('last-item', null, -1, '/');
// forgot menu item
$this->redirect('/');
}
示例15: simpleQuery
function simpleQuery(&$db)
{
$query = v($_REQUEST["query"]);
if (!$query) {
$query = Session::get('select', 'query');
}
// try to load from session
if (!$query) {
return '';
}
// see if user is restricted to a list of databases by configuration
// if yes, then disallow db use queries
// it's still possible that the command can contain db prefixes, which will override the db selection
//$info = getCommandInfo($query);
//if ($info['dbChanged'])
// return '';
$query_type = getQueryType($query);
if ($query_type['result'] == FALSE) {
return $query;
}
// only apply limit/sort to select queries with results
if ($query_type['can_limit'] == FALSE) {
return $query;
}
Session::set('select', 'can_limit', $query_type['can_limit'] == TRUE);
if (v($_REQUEST["id"]) == 'sort') {
$field = v($_REQUEST['name']);
if ($field) {
$query = sortQuery($query, ctype_digit($field) ? $field : $db->quote($field));
}
// clear pagination if sorting is changed
Session::set('select', 'page', 1);
}
// save order clause with query in session, required for pagination
Session::set('select', 'query', $query);
// try to find limit clause in the query. If one is not applied, apply now
// only either sort or pagination request can come at a time
if (!$query_type['has_limit'] && v($_REQUEST["id"]) != 'sort') {
$record_limit = Options::get('res-max-count', MAX_RECORD_TO_DISPLAY);
$page = v($_REQUEST['name']);
if ($page) {
$limit_applied = Session::get('select', 'limit');
if (!ctype_digit($page) | $page < 1 || !$limit_applied) {
return $query;
}
$count = Session::get('select', 'count');
$total_pages = ceil($count / $record_limit);
if ($total_pages < $page) {
return $query;
}
Session::set('select', 'page', $page);
$limit = $db->getLimit($record_limit, ($page - 1) * $record_limit);
$query .= $limit;
} else {
Session::del('select', 'table');
Session::del('select', 'limit');
Session::del('select', 'page');
Session::del('select', 'count');
Session::del('select', 'sort');
Session::del('select', 'sortcol');
if (!$db->query($query)) {
return $query;
}
$count = $db->numRows();
if ($count > $record_limit) {
Session::set('select', 'count', $count);
Session::set('select', 'page', 1);
Session::set('select', 'limit', true);
$limit = $db->getLimit($record_limit);
$query .= $limit;
}
}
}
return $query;
}