Session Problems - It could be me

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
magic-chef
Forum Newbie
Posts: 1
Joined: Tue Jun 24, 2003 7:24 pm
Location: Planet Earth

Session Problems - It could be me

Post by magic-chef »

I have session variables changing on my test site.

He is a code snip:

This is at initial login:
=userid after index stsrt
.=userid after 2nd assign
.=Sessusrid.
=userid before includes

After Registering I get this:

11=userid after index stsrt
.11=userid after 2nd assign
.11=Sessusrid.
11=userid before includes

This is the code that produces it:

session_start();
$userid=$_SESSION['userid'];
echo $userid."=userid after index stsrt<BR>.";
$userid=$_SESSION['userid'];
echo $userid."=userid after 2nd assign<BR>.";
if (!isset($_SESSION['uname']))
{
$_SESSION['uname'] = '';
}
if (!isset($_SESSION['fn']))
{
$_SESSION['fn'] = '';
}
if (!isset($_SESSION['userid']))
{
$_SESSION['userid'] = '';
}
if (!isset($_SESSION['mtype']))
{
$_SESSION['mtype'] = '0';
}
echo $_SESSION['userid']."=Sessusrid.<BR>";
echo $userid."=userid before includes<BR>.";

Here's another pages version of the variable:

11=userid at pur-cred begin
.1111=userid befor purch <----------- doubles & dot
. <---------------------------------------just a dot

Where are the dots coming from?

How come it is doubled?
Post Reply