本文整理汇总了PHP中Sessions类的典型用法代码示例。如果您正苦于以下问题:PHP Sessions类的具体用法?PHP Sessions怎么用?PHP Sessions使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Sessions类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: ExitApplication
function ExitApplication($token)
{
if (!empty($token)) {
$session = new Sessions();
$session->ClearSession($token);
}
return;
}
开发者ID:brahimmachkouri,项目名称:phpDHCPAdmin,代码行数:8,代码来源:class.cleanup.php
示例2: isAdminSess
function isAdminSess()
{
$sessId = session_id();
$session = new Sessions();
$dbSessId = $session->sessionValid($sessId);
$myUser = null;
if (($dbData = $session->dataField($sessId)) != null) {
$myUser = $session->isAdmin($dbData);
}
if (!isset($dbSessId) || !isset($sessId) || !isset($myUser) || $sessId != $dbSessId) {
print "forwarded to the logout.php <br>";
header("Location: logout.php");
}
}
开发者ID:nateirwin,项目名称:custom-historic,代码行数:14,代码来源:StoreSession.php
示例3: checkCRF
/**
* Check token submitted
* @param $token
* @return bool
*/
public static function checkCRF($token)
{
if (!$token) {
return false;
}
return Sessions::get('current_token') != trim($token) ? false : true;
}
开发者ID:rivomanana,项目名称:rv-slim-base,代码行数:12,代码来源:Token.php
示例4: getHandler
public static function getHandler()
{
if (self::$handler === false) {
self::$handler = new Sessions();
}
return self::$handler;
}
开发者ID:ekowabaka,项目名称:wyf,代码行数:7,代码来源:Sessions.php
示例5: authenticate
public function authenticate()
{
$nick = strtolower($this->username);
$user = Users::model()->find('LOWER(email)=?', array($nick));
if ($user === null) {
$this->errorCode = self::ERROR_USERNAME_INVALID;
} elseif (!$user->validatePassword($this->password, $user->salt)) {
$this->errorCode = self::ERROR_PASSWORD_INVALID;
} elseif ($user->status == 0) {
$this->errorCode = self::ERROR_PASSWORD_INVALID;
return 2;
} elseif ($user->status == 4) {
// user is banned
$this->errorCode = self::ERROR_PASSWORD_INVALID;
return 3;
} else {
$this->_id = $user->id;
$this->username = $user->email;
$this->setState('isAdmin', $user->status == 3);
$this->setState('permissions', $user->status);
$this->setState('nick', $user->nick);
$this->setState('session_key', md5($user->email . time() . uniqid() . $user->salt));
$this->setState('user_ip', Yii::app()->request->userHostAddress);
Sessions::model()->deleteAllByAttributes(array('user_id' => $user->id));
$this->errorCode = self::ERROR_NONE;
}
return $this->errorCode == self::ERROR_NONE;
}
开发者ID:mrtos,项目名称:OpenNVR,代码行数:28,代码来源:UserIdentity.php
示例6: Session
public function Session($Name, $Value = null)
{
$SESSIONS = new Sessions();
if ($Value) {
$SESSIONS->{$Name} = $Value;
$SESSIONS->Update();
} else {
$Value = $SESSIONS->Get($Name);
if ($Value) {
$SESSIONS->{$Name} = $Value;
$SESSIONS->Update();
}
}
unset($SESSIONS);
return $Value;
}
开发者ID:baiduXM,项目名称:agent,代码行数:16,代码来源:class.UsersModule.php
示例7: checkLoginState
/**
* 检查用户是否已经登录
* @param unknown_type $username
*/
public function checkLoginState($username)
{
$string = 's:' . strlen($username) . ':"' . $username . '"';
$criteria = new CDbCriteria();
$criteria->addSearchCondition('data', $string);
$model = Sessions::model()->find($criteria);
return $model;
}
开发者ID:yunsite,项目名称:my-advertise,代码行数:12,代码来源:LoginForm.php
示例8: logout
public function logout()
{
/*
* compares session token against get method to see if it's the actual user
*/
if (Sessions::get('token') == Requests::get('token')) {
Sessions::destroy();
}
}
开发者ID:nc1991,项目名称:Basic-MVC,代码行数:9,代码来源:UserController.php
示例9: getOnlineUsers
public static function getOnlineUsers()
{
$sessions = Sessions::model()->findAll();
$temp = array();
foreach ($sessions as $session) {
$temp[] = $session->user;
}
return $temp;
}
开发者ID:netconstructor,项目名称:X2Engine,代码行数:9,代码来源:SessionChild.php
示例10: adminLoginNow
function adminLoginNow()
{
$username = $_REQUEST['login_user'];
$password = $_REQUEST['login_password'];
$admin = new administrator();
$admin->setUsername($username);
$data = $admin->getAdminFromUsername();
if (count($data) > 0) {
$admin->extractor($data);
if ($admin->password() == md5($password)) {
$session = new Sessions();
$session->setAdminLoginSessions($admin->id(), $admin->name(), $admin->email());
Common::jsonSuccess("Success");
} else {
Common::jsonError("Login Error");
}
} else {
Common::jsonError("Login Error");
}
}
开发者ID:jcodesdotme,项目名称:pp,代码行数:20,代码来源:login-controller.php
示例11: updateMainCityImages
function updateMainCityImages()
{
$maincity = new MainCity();
$session = new Sessions();
$maincity->setMainCityId($session->getLastMainCityId());
$data = $maincity->getMainCityFromId();
$maincity->extractor($data);
$imgs = $maincity->mainCityImage();
if ($imgs != "") {
$imgs = $imgs . ',' . $_REQUEST['images'];
} else {
$imgs = $_REQUEST['images'];
}
$maincity->setMainCityImage($imgs);
if ($maincity->updateMainCityImages()) {
Common::jsonSuccess("Main City Update Successfully!");
} else {
Common::jsonError("Error");
}
}
开发者ID:jcodesdotme,项目名称:pp,代码行数:20,代码来源:maincity-controller.php
示例12: __isAuthenticated
function __isAuthenticated()
{
return true;
if (array_key_exists('HTTP_AUTH_KEY', $_SERVER)) {
$authKey = $_SERVER['HTTP_AUTH_KEY'];
} elseif (array_key_exists('auth_key', $_GET)) {
$authKey = $_GET['auth_key'];
} else {
throw new RestException(401, 'Authentication Required');
}
$sessions = new Sessions();
$session = $sessions->verifySession($authKey);
if (is_array($session)) {
$sesInfo = $sessions->getSessionUser($authKey);
self::$userId = $sesInfo['USR_UID'];
self::$authKey = $authKey;
return true;
}
throw new RestException(401, 'Wrong Credentials!');
}
开发者ID:emildev35,项目名称:processmaker,代码行数:20,代码来源:Auth.php
示例13: afterDelete
public function afterDelete()
{
parent::afterDelete();
$shared = Shared::model()->findAllByAttributes(array('cam_id' => $this->id));
foreach ($shared as $s) {
Notifications::model()->deleteAllByAttributes(array('shared_id' => $s->id, 'status' => 1));
$s->delete();
}
Sessions::model()->deleteAllByAttributes(array('real_id' => $this->id));
Sessions::model()->deleteAllByAttributes(array('real_id' => $this->id . '_low'));
return true;
}
开发者ID:mrtos,项目名称:OpenNVR,代码行数:12,代码来源:Cams.php
示例14: add
public function add()
{
$name = $_POST["name"];
$lastname = $_POST["lastname"];
$email = $_POST["email"];
$pass = $_POST["pass"];
$conf = $_POST["conf"];
if ($name == null or $lastname == null or $email == null or $pass == null or $conf == null) {
header("location: Unirse.php?error=1");
} else {
if ($pass != $conf) {
header("location: Unirse.php?error=2");
} else {
$sql = "select * from usuario where Email='" . $email . "'";
$result = $this->cone->procedure($sql);
if ($result) {
if (!$result->fetch_assoc()) {
$sql = "select (count(idUsuario)+1) as 'newId' from usuario";
$result = $this->cone->procedure($sql);
if ($result) {
if ($row = $result->fetch_assoc()) {
$sql = "insert into Usuario values (" . $row['newId'] . ",'" . $name . "','" . $lastname . "','" . $email . "','" . $pass . "',null)";
$rs = $this->cone->procedure($sql);
if ($rs) {
$ses = new Sessions();
$ses->init();
$ses->set("user", $email);
header("location: ../User/index.php");
} else {
header("location: Unirse.php?error=3");
}
}
}
} else {
header("location: Unirse.php?error=4");
}
}
}
}
}
开发者ID:BryanPalacios,项目名称:AppMul_ProyectoF,代码行数:40,代码来源:AddUser.php
示例15: loginCheck
public static function loginCheck()
{
global $db;
if (Sessions::get("login")) {
$username = Session::get("login")['username'];
if ($username) {
$kontrol = $db->query("SELECT username FROM username = '{$username}'")->rowCount();
return $kontrol ? true : false;
}
} else {
return false;
}
}
开发者ID:vahitserifsaglam1,项目名称:ozsa-src,代码行数:13,代码来源:Security.php
示例16: run
function run()
{
/**
* only run cron if delay time has expired
*/
if (time() - $_SESSION['cron']['time'] > $_SESSION['cron']['delay'] || $_SESSION['inactive']['start']) {
/**
* stuff to run
*/
$s = new Sessions();
$p = new Patient();
foreach ($s->logoutInactiveUsers() as $user) {
$p->patientChartInByUserId($user['uid']);
}
/**
* set cron start to false reset cron time to current time
*/
$_SESSION['inactive']['start'] = false;
$_SESSION['cron']['time'] = time();
return array('success' => true, 'ran' => true);
}
return array('success' => true, 'ran' => false);
}
开发者ID:nhom5UET,项目名称:tichhophethong,代码行数:23,代码来源:CronJob.php
示例17: login_in2
public function login_in2($datos = FALSE)
{
$objdata = new Database();
$sth = $objdata->prepare('SELECT * FROM users U inner join profiles P ' . 'ON U.idProf = P.idProfile ' . 'WHERE U.idUser = :id');
$sth->execute(array(':id' => $datos));
$data = $sth->fetch();
$count = $sth->rowCount();
if ($count > 0) {
require 'sessions.php';
$objSess = new Sessions();
$objSess->init();
$objSess->set('login', $data['logUser']);
$objSess->set('idpro', $data['idProf']);
$objSess->set('profi', $data['profName']);
switch ($data['profName']) {
case 'Admin':
header('location: ' . URL . 'admin/');
break;
case 'Standard':
header('location: ' . URL . 'dashboard/');
break;
}
}
}
开发者ID:dareyesm,项目名称:paginadorPHP,代码行数:24,代码来源:users.php
示例18: actionCheck
public function actionCheck($id = '', $clientAddr = '')
{
if (!$id && !$clientAddr && isset($_POST['data'])) {
$data = json_decode($_POST['data'], 1);
$id = $data['id'];
$clientAddr = $data['clientAddr'];
}
$response = array('result' => 'fail', 'id' => '');
if (empty($id) && $this->validateRequest('id', $id)) {
$response['id'] = 'empty or invalid id';
$this->renderJSON($response);
}
if (empty($clientAddr) && $this->validateRequest('ip', $clientAddr)) {
$response['id'] = 'empty or invalid ip';
$this->renderJSON($response);
}
$session_id = Sessions::model()->findByAttributes(array('session_id' => $id), array('select' => 'real_id, ip'));
if ($session_id) {
$cam = Cams::model()->findByPK($session_id->real_id);
if ($cam->is_public) {
$response['result'] = 'success';
$response['id'] = $session_id->real_id;
} elseif ($session_id->ip == $clientAddr) {
$response['result'] = 'success';
$response['id'] = $session_id->real_id;
} else {
$response['id'] = 'huge fail';
}
} else {
$cam = Cams::model()->findByPK($id);
if ($cam && $cam->is_public) {
$response['result'] = 'success';
$response['id'] = $id;
} else {
$response['id'] = 'huge fail';
}
}
$this->renderJSON($response);
}
开发者ID:mrtos,项目名称:OpenNVR,代码行数:39,代码来源:CamsController.php
示例19: Sessions
<?php
include "../../../../bdConnection.php";
require '../extras/class/sessions.php';
$objses = new Sessions();
$objses->init();
$user = isset($_SESSION['user']) ? $_SESSION['user'] : null;
$sql = "SELECT Type FROM user, role WHERE user.Name = '{$user}' AND user.Role = role.Type";
$cs = mysql_query($sql, $cn);
while ($resul = mysql_fetch_array($cs)) {
$consul1 = $resul[0];
}
$sql1 = "SELECT lab.id_lab FROM user,lab WHERE user.Name ='{$user}' AND user.lab=lab.id_lab";
$cs1 = mysql_query($sql1, $cn);
while ($resul = mysql_fetch_array($cs1)) {
$consul2 = $resul[0];
}
?>
<script type="text/javascript">
<!--
function mostrarReferencia(){
//Si la opcion con id Conocido_1 (dentro del documento > formulario con name fcontacto > y a la vez dentro del array de Conocido) esta activada
if (document.frm_per.nom_per[4].checked == true) {
//muestra (cambiando la propiedad display del estilo) el div con id 'desdeotro'
document.getElementById('desdeotro').style.display='block';
//por el contrario, si no esta seleccionada
} else {
开发者ID:josecabellozavala,项目名称:Cinvestrain,代码行数:31,代码来源:ajax_form_agregar.php
示例20: loginClient
function loginClient()
{
$username = $_REQUEST['client_username_log'];
$password = $_REQUEST['client_password_log'];
$client = new Clients();
$session = new Sessions();
$client->setClientUsername($username);
$data = $client->getClientFromUsername();
//echo count($data);
if (count($data) > 0) {
$client->extractor($data);
if (strcmp($client->clientPassword(), md5($password)) == 0) {
$session->setClientLoginSessions($client->clientId(), $client->clientTitle(), $client->clientFirstName(), $client->clientLastName());
if ($_SESSION['booked'] != '') {
echo 'booked';
//die('booked');
} else {
echo 2;
//die('accounts');
}
} else {
echo 3;
}
} else {
Common::jsonError("Login Error");
}
}
开发者ID:jcodesdotme,项目名称:pp,代码行数:27,代码来源:clients-controller.php
注:本文中的Sessions类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论