Re: global variable problem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



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


[Index of Archives]     [Postgresql General]     [Postgresql Admin]     [PHP Users]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Databases]     [Yosemite Backpacking]     [Postgresql Jobs]

  Powered by Linux