create session id in special method
This commit is contained in:
parent
081298ea89
commit
a07710d09e
|
@ -23,7 +23,7 @@
|
||||||
|
|
||||||
|
|
||||||
Author : $Author: tomas $
|
Author : $Author: tomas $
|
||||||
Version : $Revision: 1.2 $
|
Version : $Revision: 1.3 $
|
||||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/alib/var/alib.php,v $
|
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/alib/var/alib.php,v $
|
||||||
|
|
||||||
------------------------------------------------------------------------------*/
|
------------------------------------------------------------------------------*/
|
||||||
|
@ -37,7 +37,7 @@ define('ALIBERR_NOTEXISTS', 31);
|
||||||
* authentication/authorization class
|
* authentication/authorization class
|
||||||
*
|
*
|
||||||
* @author $Author: tomas $
|
* @author $Author: tomas $
|
||||||
* @version $Revision: 1.2 $
|
* @version $Revision: 1.3 $
|
||||||
* @see Subjects
|
* @see Subjects
|
||||||
* @see GreenBox
|
* @see GreenBox
|
||||||
*/
|
*/
|
||||||
|
@ -75,12 +75,8 @@ class Alib extends Subjects{
|
||||||
function login($login, $pass)
|
function login($login, $pass)
|
||||||
{
|
{
|
||||||
if(FALSE === $this->authenticate($login, $pass)) return FALSE;
|
if(FALSE === $this->authenticate($login, $pass)) return FALSE;
|
||||||
for($c=1; $c>0;){
|
$sessid = $this->_createSessid();
|
||||||
$sessid = md5(uniqid(rand()));
|
if(PEAR::isError($sessid)) return $sessid;
|
||||||
$c = $this->dbc->getOne("SELECT count(*) FROM {$this->sessTable}
|
|
||||||
WHERE sessid='$sessid'");
|
|
||||||
if(PEAR::isError($c)) return $c;
|
|
||||||
}
|
|
||||||
$userid = $this->getSubjId($login);
|
$userid = $this->getSubjId($login);
|
||||||
$r = $this->dbc->query("INSERT INTO {$this->sessTable}
|
$r = $this->dbc->query("INSERT INTO {$this->sessTable}
|
||||||
(sessid, userid, login, ts)
|
(sessid, userid, login, ts)
|
||||||
|
@ -367,6 +363,23 @@ class Alib extends Subjects{
|
||||||
return $this->config['allowedActions'][$type];
|
return $this->config['allowedActions'][$type];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ====================================================== private methods */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create new session id
|
||||||
|
*
|
||||||
|
* @return string sessid
|
||||||
|
*/
|
||||||
|
function _createSessid()
|
||||||
|
{
|
||||||
|
for($c=1; $c>0;){
|
||||||
|
$sessid = md5(uniqid(rand()));
|
||||||
|
$c = $this->dbc->getOne("SELECT count(*) FROM {$this->sessTable}
|
||||||
|
WHERE sessid='$sessid'");
|
||||||
|
if(PEAR::isError($c)) return $c;
|
||||||
|
}
|
||||||
|
return $sessid;
|
||||||
|
}
|
||||||
|
|
||||||
/* =============================================== test and debug methods */
|
/* =============================================== test and debug methods */
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue