8.gif

Search (advanced search)
Use this Search form before posting, asking or make a new thread.
Tips: Use Quotation mark to search words (eg. "How To Make Money Online")

03-01-2014, 12:08 AM
Post: #1
session register() can some one please explain
  • Angry Angry Angry Angry Angry Angry Angry Angry Angry


session register() can some one please explain

[Image: icon_post_target.gif]by autolinktrader » Thu Feb 27, 2014 10:36 pm





im having problem my server upgraded from php4 to php5
can anyone help me understand the change i carnt get my head around it
ive broke the code down that need editing

session_start();
unset($l);
session_register($l);

/***********************************************************************

Check if user is logged on and display the appropriate page

************************************************************************/

if($page=="" or $page==" "){

header("Location: site_start.php");

}

if($page!="" and& $page!=" "){

if(!isset($l)){

include ("templates/template_header_main.php");

include ("templates/template_login_top.php");

include ("templates/template_$page.php");

include ("templates/template_footer_main.php"); }

else

the problem is with the isset and sessions register i know ive to change the
session_register($l) to $_SESSION['name']= $name;

but then how do i edit the isset to work with the new
$_SESSION['name']= $name; or how do i edit the $_SESSION['name']= $name; to work with the old isset
also
can you please explain to me here whats actually going on , im great
with .php and automated scripts but all i can think that $_session in
more of a command not a $var more of a session register command , if
this is so could someone share the $_session command list please
this has proper baffled my head all help is greatly welcome
thank you
autolinktrader
Angry Angry Angry Angry Angry Angry Angry Angry Angry Angry Angry
03-01-2014, 01:30 AM
Post: #2
RE:
can any one help me convert my the code below to work with the code above


Below is a fix that may be included in older code to make it work with PHP6.
When needed it recreates the functions
- session_register()
- session_is_registered()
- session_unregister()

The functions inside the function fix_session_register() are only available after fix_session_register() has run.
Therefore in PHP<6 where there already is a session_register() nothing happens.

<?php
// Fix for removed Session functions
function fix_session_register(){
function session_register(){
$args = func_get_args();
foreach ($args as $key){
$_SESSION[$key]=$GLOBALS[$key];
}
}
function session_is_registered($key){
return isset($_SESSION[$key]);
}
function session_unregister($key){
unset($_SESSION[$key]);
}
}
if (!function_exists('session_register')) fix_session_register();
?>

above code is not mine author below taken from php-forum.com a forum with no users lol
[EDIT BY dan brown AT php DOT net: Bugfix provided by "dr3w" on 02-APR-2010: "its [sic] function_exists with an S at the end".]


im almost there ive now got my site up visible lol
i just can not log in
my sessions are not registered




52.gif