Welcome to Geeklog, Anonymous Thursday, November 28 2024 @ 10:34 am EST

Geeklog Forums

Session variables in Static pages?


tokyoahead

Anonymous
Hi,

I am writing a small php-script that is packed into a static page.

I want to set a new variable in that script that is used in all functions of that script during the users time to use the script. So when a user clicks on a link on the page that calls the static page again with another parameter, that variable should be retained, just like session-variables do.

I tried it but it did not work.
for testing I wrote a simple script:

Text Formatted Code

if (!isset($_SESSION['var']))
 {$var=1;}
else
 {$var=$_SESSION['var'];}

$var++;

$_SESSION['var']=$var;

echo $var;


 


It shows that the session-set variable is deleted (unregistered) with every click.

Any idea how to do it?

thanks
 Quote

Status: offline

Blaine

Forum User
Moderator
Registered: 07/16/02
Posts: 1232
Location:Canada
Are you trying to use the new CVS code or GL 1.3.9 ?

GL does not currently use PHP Sessions but we have added support for them in the new CVS code (1.3.10).

If not - you can modify GL to use Sessions but you likely are not starting SESSIONS - you will need to explore how to use Sessions.
Geeklog components by PortalParts -- www.portalparts.com
 Quote

tokyoahead

Anonymous
Thanks for answering so fast.

I was making an error to forget the session_start();
I tried to start it from within a function but this never worked.

Now I added it on the first line of the static page code and it worked!

thanks
 Quote

All times are EST. The time is now 10:34 am.

  • Normal Topic
  • Sticky Topic
  • Locked Topic
  • New Post
  • Sticky Topic W/ New Post
  • Locked Topic W/ New Post
  •  View Anonymous Posts
  •  Able to post
  •  Filtered HTML Allowed
  •  Censored Content