If i was to set a session variable using session_register() when a person logs in would the variable still be there to retrieve later? How?
I'm a little fuzzy on exactly how session variables work.
Clarify... SESSION Vars
Moderator: General Moderators
- AVATAr
- Forum Regular
- Posts: 524
- Joined: Tue Jul 16, 2002 4:19 pm
- Location: Uruguay -- Montevideo
- Contact:
session
The session variable, as the name said, es a variable that is born in the session.
So you register the variable when you start the session and register it. But if the user exits the navigator -> the session exits too, and the varibles will disapear.
The session is a contract between your browser session and the server.. when you close de browser you loose the session
hope it helps
So you register the variable when you start the session and register it. But if the user exits the navigator -> the session exits too, and the varibles will disapear.
The session is a contract between your browser session and the server.. when you close de browser you loose the session
hope it helps
session example:
page.php
and in the next script (note the use of the variables $server,$login,$pwd registered in the previous script):
Code: Select all
<?php
session_register('login');
session_register('pwd');
session_register('server');
$login=$login_1;
$pwd = $pwd_1;
$server = $server_1;
?>
<HTML>
<HEAD>
<META NAME="KEYWORDS" CONTENT="test6">
<TITLE>Test</TITLE>
</HEAD>
<BODY text="#1c651c" bgCode: Select all
<?php
session_start();
?>
<HTML>
<HEAD>
<META NAME="KEYWORDS" CONTENT="test7">
<TITLE>Test</TITLE>
</HEAD>
<BODY>
<?php
include 'includes.php';
echo"<TABLE BORDER="1" BORDERCOLOR="#003366" CELLSPACING="1" CELLPADDING="4">";
echo"<TR ALIGN="RIGHT">";
echo"<TD WIDTH="150">";
arial_2("Message : ");
echo"</TD>";
if (!($connection = mysql_connect($server,$login,$pwd)))
{
echo "<TD><font face="arial" size="2" color="#1c651c">Could not Connect!</FONT></TD></TR>";
showerror();
}ahem...
volka wrote:http://www.zend.com/zend/tut/session.php
- twigletmac
- Her Royal Site Adminness
- Posts: 5371
- Joined: Tue Apr 23, 2002 2:21 am
- Location: Essex, UK