pg.ddx.io  pgsql-php@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Wim Paulussen <wim@chen.be>
To: pgsql-php@postgresql.org
Subject: Re: session_is_started()
Date: Thu, 08 Apr 2004 16:49:01 +0200
Message-ID: <4075665D.3060105@chen.be> (raw)
In-Reply-To: <20040408134031.GA13236@localhost.localdomain>
References: <20040408134031.GA13236@localhost.localdomain>

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!
>
>  
>




view thread (5+ messages)  latest in thread

Message-ID: <4075665D.3060105@chen.be>
Permalink:  ../4075665D.3060105@chen.be/
Also on:    postgresql.org/message-id/4075665D.3060105@chen.be

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-php@postgresql.org
  Cc: wim@chen.be
  Subject: Re: session_is_started()
  In-Reply-To: <4075665D.3060105@chen.be>
  References: <20040408134031.GA13236@localhost.localdomain> <4075665D.3060105@chen.be>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox