Garry
|
Posted: 07/12/2005, 8:53 PM |
|
Anyebody know how to solve a problem with the option php.ini register_globals=Off? The decision like this:
session_register('nameOfYourVariable') with $_SESSION['nameOfYourVariable'] = $whateverValue
session_is_registered('nameOfYourVariable') with isset($_SESSION['nameOfYourVariable'])
session_unregister('nameOfYourVariable') with unset($_SESSION['nameOfYourVariable'])
does not work. The browser after login to login page at once pointed to logout mode
|
|
|
vj
|
Posted: 07/13/2005, 1:11 PM |
|
I am not sure if this is the best solution, but you could try this. Try using cookies instead of sessions.
To set a cookie: http://ca.php.net/manual/en/function.setcookie.php
To reset cookie
<?php
// set the expiration date to one hour ago
setcookie ("TestCookie", "", time() - 3600);
setcookie ("TestCookie", "", time() - 3600, "/~rasmus/", ".example.com", 1);
?>
|
|
|
Garry
|
Posted: 07/13/2005, 7:58 PM |
|
Find it!
The sesion is better... Its need to replace the $UserRights whis $_SESSION ['UserRights'] in check_security func (common.php) too and all OK! Below the code of all four function of comon.php need to be edit:
function get_param($param_name)
{
if(isset($_POST[$param_name]))
return $_POST[$param_name];
else if(isset($_GET[$param_name]))
return $_GET[$param_name];
}
function get_session($param_name)
{
if(!isset($_POST[$param_name]) && !isset($_GET[$param_name]))
return isset($_SESSION[$param_name]) ? $_SESSION[$param_name] : "";
}
function set_session($param_name, $param_value)
{
if(isset($_SESSION[$param_name]))
unset($_SESSION[$param_name]);
$_SESSION[$param_name] = $param_value;
}
function check_security($security_level)
{
if(!isset($_SESSION["UserID"]))
{
header ("Location: Login.php?querystring=" . urlencode(getenv("QUERY_STRING")) . "&ret_page=" . urlencode(getenv("REQUEST_URI")));
exit;
}
else
if(!isset($_SESSION["UserRights"]) || $_SESSION["UserRights"] < $security_level)
{
header ("Location: Login.php?querystring=" . urlencode(getenv("QUERY_STRING")) . "&ret_page=" . urlencode(getenv("REQUEST_URI")));
exit;
}
}
Enjoy all!
|
|
|
|