| version 1.8, 2007/09/22 06:39:57 |
version 1.9, 2009/10/14 11:56:09 |
|
|
| * http://platon.sk/projects/phpPlatonLib/ |
* http://platon.sk/projects/phpPlatonLib/ |
| */ |
*/ |
| |
|
| /* $Platon: phpPlatonLib/Auth_AuthDB/AuthDB.php,v 1.16 2007-09-22 06:13:06 nepto Exp $ */ |
/* $Platon: phpPlatonLib/Auth_AuthDB/AuthDB.php,v 1.18 2009-10-14 11:45:40 nepto Exp $ */ |
| |
|
| /* |
/* |
| * History: |
* History: |
|
|
| * authentification interface |
* authentification interface |
| * 2007-09-22 - configurable cookie name, path, domain |
* 2007-09-22 - configurable cookie name, path, domain |
| * - configurable username/password CGI form variable name |
* - configurable username/password CGI form variable name |
| |
* 2009-10-14 - disable domain in cookie if domain is "localhost" |
| */ |
*/ |
| |
|
| require_once 'DB.php'; |
require_once 'DB.php'; |
|
|
| if (! isset($this->_options['cookie']['name'])) { |
if (! isset($this->_options['cookie']['name'])) { |
| $this->_options['cookie']['name'] = AUTH_DB_COOKIE_NAME; |
$this->_options['cookie']['name'] = AUTH_DB_COOKIE_NAME; |
| } |
} |
| |
if (! strcasecmp(trim($this->_options['cookie']['domain']), 'localhost')) { |
| |
$this->_options['cookie']['domain'] = null; |
| |
} |
| } /* }}} */ |
} /* }}} */ |
| |
|
| /** |
/** |
|
|
| /* Sending HTTP_X_FORWARDED_FOR? OK, send anything you want, |
/* Sending HTTP_X_FORWARDED_FOR? OK, send anything you want, |
| but it must persist for the whole session. */ |
but it must persist for the whole session. */ |
| $ret = array(); |
$ret = array(); |
| foreach (array('REMOTE_ADDR', 'HTTP_X_FORWARDED_FOR') as $key) { |
foreach (array('REMOTE_ADDR', 'HTTP_X_FORWARDED_FOR', 'HTTP_X_REAL_IP') as $key) { |
| if (isset($_SERVER[$key])) { |
if (isset($_SERVER[$key])) { |
| $ret[] = $_SERVER[$key]; |
$ret[] = $_SERVER[$key]; |
| } |
} |
| } |
} |
| |
$ret = array_unique($ret); |
| $ret = join(' / ', $ret); |
$ret = join(' / ', $ret); |
| break; |
break; |
| |
|