pass config to get_session_ip, so it knows what mask to use

This commit is contained in:
Shish 2009-01-04 08:17:41 -08:00
parent 93b7467fdd
commit 7f90fdbf97
2 changed files with 2 additions and 5 deletions

View file

@ -183,13 +183,10 @@ function get_memory_limit() {
return $memory; return $memory;
} }
function get_session_ip() { function get_session_ip($config) {
global $config;
$mask = $config->get_string("session_hash_mask", "255.255.0.0"); $mask = $config->get_string("session_hash_mask", "255.255.0.0");
$addr = $_SERVER['REMOTE_ADDR']; $addr = $_SERVER['REMOTE_ADDR'];
$addr = inet_ntop(inet_pton($addr) & inet_pton($mask)); $addr = inet_ntop(inet_pton($addr) & inet_pton($mask));
return $addr; return $addr;
} }

View file

@ -238,7 +238,7 @@ class UserPage implements Extension {
private function set_login_cookie($name, $pass) { private function set_login_cookie($name, $pass) {
global $config; global $config;
$addr = get_session_ip(); $addr = get_session_ip($config);
$hash = md5(strtolower($name) . $pass); $hash = md5(strtolower($name) . $pass);
setcookie("shm_user", $name, setcookie("shm_user", $name,