CodeCharge Studio
search Register Login  

Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge -> Programming

 register_globals problem (php+mysql+?? 2.0.5)

Print topic Send  topic

Author Message
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!

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Web Database

Join thousands of Web developers who build Web applications with minimal coding.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.