I have been asked to update are software we are running I have been able to get the new versions update running but am having issues with SESSION_REGISTER
and declaring session variables. can someone just point me in the right direction. I have seem sessions_reg goes away in php 5.6 so any help to switch now would be great.
Update AP2.0 & PHP5.2 issues to AP2.2 & PHP5.4
Started by jvrothjr, Feb 04 2013 04:29 PM
6 replies to this topic
#1
Posted 04 February 2013 - 04:29 PM
#2
Posted 04 February 2013 - 04:34 PM
As you noticed
As shown in the PHP manual.
Example:
session_register () is indeed deprecated, but the solution is quite easy. Just save the values to the $_SESSION superglobal instead, and it will automatically be saved to the session file by the PHP parser.As shown in the PHP manual.
Example:
// Assuming we have this variable.
$username = "test";
// Instead of this.
session_register ("username");
// Do this.
$_SESSION['username'] = $username;
Keeping it simple.
#3
Posted 05 February 2013 - 08:40 AM
so replace
if (substr($_SERVER['HTTP_REFERER'],-10) <> "header.php") {$_SESSION[referer] = $_SERVER['HTTP_REFERER'];}
with
if (substr($_SERVER['HTTP_REFERER'],-10) <> "header.php") {
$referer = $_SERVER['HTTP_REFERER'];
$_SESSION[referer] = $referer;
}
if (substr($_SERVER['HTTP_REFERER'],-10) <> "header.php") {$_SESSION[referer] = $_SERVER['HTTP_REFERER'];}
with
if (substr($_SERVER['HTTP_REFERER'],-10) <> "header.php") {
$referer = $_SERVER['HTTP_REFERER'];
$_SESSION[referer] = $referer;
}
#4
Posted 05 February 2013 - 08:48 AM
You don't need the interim
You also need to have quotes around the index in the
As a little nit-picking, you should be using != to test for inequality. As that's what's expected. I know that <> works in MySQL, but not sure if it does in PHP (never tested).
$referer variable there, just set it directly from $_SERVER['HTTP_HEADER']. So the first line is indeed correct.You also need to have quotes around the index in the
$_SESSION array, otherwise PHP will think that you're attempting to use a constant and not a string.As a little nit-picking, you should be using != to test for inequality. As that's what's expected. I know that <> works in MySQL, but not sure if it does in PHP (never tested).
Keeping it simple.
#5
Posted 05 February 2013 - 09:09 AM
ok used but still getting error
if (substr($_SERVER['HTTP_REFERER'],-10) != "header.php") {$_SESSION[referer] = $_SERVER['HTTP_REFERER'];}
Notice: Use of undefined constant referer - assumed 'referer' in C:\wamp\apps\testrequest\includes\pconvar.inc on line 2
if (substr($_SERVER['HTTP_REFERER'],-10) != "header.php") {$_SESSION[referer] = $_SERVER['HTTP_REFERER'];}
Notice: Use of undefined constant referer - assumed 'referer' in C:\wamp\apps\testrequest\includes\pconvar.inc on line 2
#6
Posted 05 February 2013 - 09:12 AM
See the first sentence of the second paragraph in my last post.
Keeping it simple.
#7
Posted 05 February 2013 - 09:17 AM
fixed it right after I posted sorry
Next issue
Notice: Undefined index: cmd in C:\wamp\apps\testrequest\index.php on line 253
switch($_REQUEST['cmd']){
Next issue
Notice: Undefined index: cmd in C:\wamp\apps\testrequest\index.php on line 253
switch($_REQUEST['cmd']){
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users












