Skip site navigation (1) Skip section navigation (2)

Re: session_is_started()

From: Wim Paulussen <wim(at)chen(dot)be>
To: pgsql-php(at)postgresql(dot)org
Subject: Re: session_is_started()
Date: 2004-04-08 14:49:01
Message-ID: 4075665D.3060105@chen.be (view raw or flat)
Thread:
Lists: pgsql-php
I would do the following : on the first page you start the session with 
session_start and then you include an OK field in the session
<code>
($_SESSION['OK']   = TRUE;
</code>
On the following pages , the first thing you do is check the existence 
of the variable like this
<code>
if (! isset($_SESSION['OK']))
{
    session_start();
}
</code>

Your problems derives most probably from teh fact that in your php.ini 
the session.autostart is set to On , starting a session automatically 
once 1 time started.


Joolz wrote:

>Hello,
>
>I'm makeing a PHP frontend to a postgresql db, and want to use
>sessions in order to sore global variables. I read that it's enough to
>put session_start() in the top file of the app, but that doesn't work,
>when I go two or three PHP files "deep", the session is forgotten.
>
>To workaround this, I tried putting session_start() at the begonning
>of every PHP file that does something with session variables. This
>however gives me lot of these errors: "Notice: A session had already
>been started - ignoring session_start() in [scriptname] on line 5"
>
>I would like something like
>
>if (!session_is_started()) { // note: this function doesn't exist
>  session_start();
>}
>
>How have you solved this problem? Thanks for any tips!
>
>  
>


In response to

Responses

pgsql-php by date

Next:From: Ivan Sergio BorgonovoDate: 2004-04-08 15:23:41
Subject: functions aka stored procedures results and PHP
Previous:From: JoolzDate: 2004-04-08 13:40:31
Subject: session_is_started()

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group