Jump to content

Recommended Posts

Still trying to update this website from like 2000.

 

It looks like my sessions are not working correctly.  I get fatal errors on line 3 in this code:

<table cellspacing=0 cellpadding=3 border=0 width=70%>
<tr><td align=center><h3>Welcome, <u><b><?php= GetSessionVar("full_name") ?></b>  
</td>
</tr>
</table>

 

Call to undefined function GetSessionVar().

 

This is the error I get in my IDE.  The webpage just shows "Welcome _".

 

Combine this with the fact that I get an undefined index error for this code:

 

function _SessionCreate($SessionName)
{
$Db=new sql;
global $_SESSION_DATA;

$GLOBALS["$SessionName"]=md5 (microtime() . $_SERVER['REMOTE_ADDR']);
$Db->exec("insert into session (sid) values ('" . $GLOBALS["$SessionName"] . "')");        
$_SESSION_DATA["$SessionName"]=array();
SetCookie ("$SessionName", $GLOBALS["$SessionName"],0,"/");
return;         
}

 

The problem is with "$_SERVER['REMOTE_ADDR']);".  The REMOTE_ADDR being the problem.  Some of the pages using the session stuff worked before i upgraded to 5.2.4.  I am thinking all the code worked in 2000 but now is outdated after the upgrade.

 

If this is the case what verbs should I be using?  I have read where I can use isset to check the variable, but not sure how to write that around this multiple coded line.

 

Oh and what does the "space . space" do? 

 

Thanks again.

Link to comment
https://forums.phpfreaks.com/topic/73980-setsessionvar-getsessionvar/
Share on other sites

<table cellspacing=0 cellpadding=3 border=0 width=70%>
<tr><td align=center><h3>Welcome, <u><b><?php= $_SESSION['full_name'] ?></b>  
</td>
</tr>
</table>

 

This part is just a guess.

 

<?php

function _SessionCreate($SessionName)
{
$Db=new sql;
global $_SESSION_DATA;

$_SESSION["$SessionName"]=md5 (microtime() . $_SERVER['REMOTE_ADDR']);
$Db->exec("insert into session (sid) values ('" . $_SESSION["$SessionName"] . "')");        
$_SESSION_DATA["$SessionName"]=array();
SetCookie ("$SessionName", $_SESSION["$SessionName"],0,"/");
return;         
}

?>

 

I'm not really sure where your getting this from

$_SESSION_DATA

So I can't really help you with that one :)

Changed the first code from my first post to:

 

<table cellspacing=0 cellpadding=3 border=0 width=70%>
<tr><td align=center><h3>Welcome, <u><b><?php $name = GetSessionVar("full_name");
print "$name" ?></b>  
</td>
</tr>
</table>

 

Now it works and say's Welcome (the persons name).

 

Now on to the next problem.  I'll be back I am sure thanks for the help poco, I appreciate it.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.