pg.ddx.io  pgsql-php@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Jules Alberts <jules.alberts@arbodienst-limburg.nl>
To: pgsql-php@postgresql.org
Subject: Re: global variable problem
Date: Tue, 23 Apr 2002 12:27:00 +0200
Message-ID: <200204231033.g3NAX9Qw028301@artemis.cuci.nl> (raw)
In-Reply-To: <8298.193.136.62.21.1019553161.squirrel@www.ipatimup.up.pt>
References: <200204230643.g3N6hEQw020907@artemis.cuci.nl>

On 23 Apr 2002 at 10:12, Miguel Carvalho wrote:
> Jules Alberts wrote:
<snip>
> > besides, my db requires a password so i would have to store it
> > somewhere in a variable, which seems a bit of a security risk.
> 
> Where are you going to store the login and database password?
> I suggest you to store the login and password in a session variable (
> take a lookt at session_register ). I think that is the best way to do
> it.

i tried it already with a stored password + user ID. in a global 
variable, and guess what: they're not visible. but only in the function 
listing(). in the function start() they are both visible...

> >
> > i will try this approach anyway, but i still have a few questions
> >
> 
> > -	when does a script end? at the end of the .PHP file? after a call is
> >  made to another .PHP file?
> 
> The script ends when the .php file reach it's end( when there is noting
> more to parse/ and or execute ).

i have a feeling it's more complex than that. a script calls itself, 
rebuilds HTML code. has the script ended or not? the script that did 
the call has ended. but since it has called itself, it hasn't. i find 
these recursion matters a bit vague when it comes to scipts that 
generate themselves.

> > -	why is the variable $conn visible in start(), but not in listing()?
> 
> If you want to have access to a global var. inside of a function, you
> must say that the global var. is global. Ex:

i did that, it doesn't make any difference

> > - shouldn't a _P_connect create a persistent connection?
> 
> Possibly it would be a good solution...but there may be some problems,
> like:
> 
> doing a roolback in this connection, doest it will roolback all scripts?

i don't think that would be a problem, as long as you explicitely do a 
begin /end transaction.

i tried the original script in a more unmodified way (it comes from the 
latest Dutch issue of C't magazine), but it has the same problem. this 
made me think that the problem is maybe in some setting in php.ini or 
httpd.conf. i'm going to do a complete reinstall of apache and php. if 
the problem persists, i will try to make the script as small as 
possible while still illustrating the problem.

so, maybe until later, and thanks for your reaction.

-- 
Jules Alberts



view thread (7+ messages)  latest in thread

Message-ID: <200204231033.g3NAX9Qw028301@artemis.cuci.nl>
Permalink:  ../200204231033.g3NAX9Qw028301@artemis.cuci.nl/
Also on:    postgresql.org/message-id/200204231033.g3NAX9Qw028301@artemis.cuci.nl

 · 

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: jules.alberts@arbodienst-limburg.nl
  Subject: Re: global variable problem
  In-Reply-To: <200204231033.g3NAX9Qw028301@artemis.cuci.nl>
  References: <200204230643.g3N6hEQw020907@artemis.cuci.nl> <200204231033.g3NAX9Qw028301@artemis.cuci.nl>

* 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