You are here: Re: DIssapearing/reappearing Session variables « PHP Programming Language « IT news, forums, messages
Re: DIssapearing/reappearing Session variables

Posted by iktorn on 04/10/07 05:44

dangerd napisał(a):
> On Apr 9, 8:52 pm, iktorn <s...@phpfreelancer.net> wrote:
>> dangerd napisał(a):
>>
>
> Hello,
>
> I got rid of the session_register() and the problem persists. I think
> what is happening is that the $_SESSION[$authdata] (I took your
> advise on board) dissapears after five or so refreshes but then
> reappears after another refresh. There does not seem to be a pattern
> on the number of refreshes it takes for $authdata to dissapear.
> Strange...
>
> Duncs
>

There is always some reasonable solution for such problems ;)

In http://www.multidome.co.uk/test/gallery.txt authorisation.php
is included afer DOCTYPE declaration, therefore session_start()
isn't called at the beginning of the script and your session is being
lost (if you don't have some output buffering turned on).

The proper way of using session is:

<?
//must be called on every page
session_start();
//after calling session_start(), assign anything to $_SESSION
$_SESSION['foo']='bar';
//now let's generate HTML
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<title>Multidome- The UK's favorite telescopic pool enclosure.</TITLE>
<?
//you can use $_SESSION also after sending text to the browser
$_SESSION['foo2']='kkk';
?>

If it didn't solve your problem, turn on debugging (including E_NOTICE
reporting) - it's the best way to find some bugs in code.

--
Wiktor Walc
http://phpfreelancer.net

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация