0

There is one php project made in fully core php. Now my work is to change some style issues. So I just downloaded all the files with the database. I just configured all the database name,username,password over my localhost(LAMP). When I browsed the page it is showing the page but there are some errors with it. It is showing error like

Notice: Undefined variable: _session_register in path to the folder/session.php on line 8 
Notice: Undefined variable: _session_register in path to the folder/session.php on line 9
Notice: Undefined variable: _session_register in path to the folder/session.php on line 10 
Notice: Undefined variable: _session_register in path to the folder/session.php on line 11 
Notice: Undefined variable: _session_register in path to the folder/session.php on line 12 
Notice: Undefined variable: _session_register in path to the folder/session.php on line 13

The code for the session.php is like this

<?php
$_SESSION['example']="yes"; 
ini_set("url_rewriter.tags","");
ini_set('session.use_trans_sid', 0);
ini_set("session.cookie_domain", ".localhost");
session_start();
ob_start();
$_session_register["easb2b_username"];
$_session_register["easb2b_userid"];
$_session_register["easb2b_memtype"];
$_session_register["easb2b_adv_id"];
$_session_register["easb2b_adv_email"];
$_session_register["lang"];
?>

So can someone kindly tell me how to solve this issue. The project has around thousand of files. So its really hard to go through all the files and check them. Any help and suggestions will be really appreciable. Thanks....

1 Answers1

0
<?php
// Use of session_register() is deprecated
$new_sessionvar = "Some value.";
session_register("new_sessionvar");

But you can still use

session_start();
$_SESSION['new_sessionvar'] = "Some value"

In order to use it you need to turn on register_global in php.ini

Note that I have the session_start() function right above initialization. In your code you may want to add it at the top of your script to prevent the Headers already sent by PHP message.

Community
  • 1
  • 1
Dipesh Parmar
  • 27,090
  • 8
  • 61
  • 90