Dan wrote:
Hi all.
I taught myself PHP before the frenzy over register_globals.
After a reasonable break from the language, I'm back for more.
I'm building a site where I'll be holding a lot of variables in memory
for each session. How do I do that? Apparently I can't use
session_register() if re
Giulio wrote:
As far as I know,
it's not true you can't use session variables if register_globals is off,
the difference is that you must acces session variables using
ALWAYS CALL session_start() BEFORE TRYING TO USE THE $_SESSION SUPERGLOBAL!
also I don't quite see the connection with register_gl
As far as I know,
it's not true you can't use session variables if register_globals is
off,
the difference is that you must acces session variables using
$_SESSION['variablename'], that's is an assurance that a session
variable is a REAL session variable, and that it is not set using for
exampl
session_start();
$_SESSION['somevar'] = "foo";
u could also check out pear's HTTP_Session package.
On 28/04/2005, at 7:06 PM, Dan wrote:
Hi all.
I taught myself PHP before the frenzy over register_globals.
After a reasonable break from the language, I'm back for more.
I'm building a site where I'll
Hi all.
I taught myself PHP before the frenzy over register_globals.
After a reasonable break from the language, I'm back for more.
I'm building a site where I'll be holding a lot of variables in memory
for each session. How do I do that? Apparently I can't use
session_register() if register_glob
Hi,
Thursday, July 31, 2003, 1:30:54 AM, you wrote:
amc> Hello,
amc> I'm lookin for some tips on the best way to do this...
amc> I make a database connection outside of my classes... lets call it
amc> $myDBConnection. I need to use this connection in a class nested in a
amc> class... Was wonderi
Hello,
I'm lookin for some tips on the best way to do this...
I make a database connection outside of my classes... lets call it
$myDBConnection. I need to use this connection in a class nested in a
class... Was wondering the most efficient way of doing this? I don't want to
create a new db conne
For this use globals, it would be painfull to pass everything. But you
can also use some class that would keep track of such things.
Dara Dowd wrote:
Is it "better" to pass variables through functions or to simply declare them as global within the function's scope?
The variables in this particul
In terms of security, or in my opinion, good and proper coding, it is
best to have no global variables. There is always a way to wrap
variables that will be needed in local scopes. However, this philosophy
is harder to practice than it is to preach. Code can get ugly when
passing if you are
Is it "better" to pass variables through functions or to simply declare them as global
within the function's scope?
The variables in this particular case are things like MySQL database connections and
tablenames.
Thanks,Dara
--
For the largest free email in Ireland (25MB) &
File Storage space (
At 21:49 10.11.2002, Mathieu Dumoulin said:
[snip]
>Hi, i got this project i'm building right now. It basically a core system to
>do adminsitrative modules for web sites.
>
>I got tons of classes that get created on call of a function like
>sql_setup(), frm_s
Hi, i got this project i'm building right now. It basically a core system to
do adminsitrative modules for web sites.
I got tons of classes that get created on call of a function like
sql_setup(), frm_setup(). These functions create the objects from the
classes so they can be used later in other o
On Lun 04 Nov 2002 00:10, Paul wrote:
> Ok, I have turned global vars off and I have replaced my old
> $HTTP_GET_VARS with $_GET[] but I seem to not get the values passed. I
> run the phpinfo and I see the variables being stored as
> _GET["variable_name"]
>
> Is calling $_GET["variable_name"] corre
Hello,
"Paul" <[EMAIL PROTECTED]> wrote:
> OK I guess I am closer = the variable is being passed as I tested but I
> guess is failing on the test:
>
> if (isset($_GET["error_message"]))
>
What do you mean by "failing on the test"? What are you trying to
accomplish,
btw? How are you testing it? Al
ROTECTED]>; <[EMAIL PROTECTED]>
Sent: Monday, November 04, 2002 3:02 PM
Subject: RE: [PHP] Global Variables Off
> Makes no difference..I tried them both
>
> -Original Message-
> From: John Nichel [mailto:jnichel@;by-tor.com]
> Sent: Sunday, November 03, 2002
1:08 PM
To: Paul
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] Global Variables Off
I assume you mean that the echo statement I gave as an example shows
this:
The test variable is []
Right? If so, that is truly odd, especially considering you are using
4.2.3. I don't have a good answer for that ...
mailto:shiflett@;php.net]
> Sent: Sunday, November 03, 2002 10:15 PM
> To: Paul
> Cc: [EMAIL PROTECTED]
> Subject: Re: [PHP] Global Variables Off
>
> You didn't really tell us how you're passing data or what is not
> working.
>
> Try this. Create a tes
assigned to _GET.
With no change in code, I turn global variables 'on' and the same page
works..
Paul
PS using php 4.2.3
-Original Message-
From: Chris Shiflett [mailto:shiflett@;php.net]
Sent: Sunday, November 03, 2002 10:15 PM
To: Paul
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP]
Makes no difference..I tried them both
-Original Message-
From: John Nichel [mailto:jnichel@;by-tor.com]
Sent: Sunday, November 03, 2002 10:59 PM
To: Paul
Cc: 'Chris Shiflett'; [EMAIL PROTECTED]
Subject: Re: [PHP] Global Variables Off
Try single quotes...
$_GET['test
urn global variables 'on' and the same page
works..
Paul
PS using php 4.2.3
-Original Message-
From: Chris Shiflett [mailto:shiflett@;php.net]
Sent: Sunday, November 03, 2002 10:15 PM
To: Paul
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] Global Variables Off
You didn't really
Paul
PS using php 4.2.3
-Original Message-
From: Chris Shiflett [mailto:shiflett@;php.net]
Sent: Sunday, November 03, 2002 10:15 PM
To: Paul
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] Global Variables Off
You didn't really tell us how you're passing data or what is not
working.
You didn't really tell us how you're passing data or what is not working.
Try this. Create a test script called test.php that looks like this:
echo "The test variable is [" . $_GET["test"] . "]";
?>
Assuming this script is located at http://example.org/test.php, access
this page using a URL li
Ok, I have turned global vars off and I have replaced my old
$HTTP_GET_VARS with $_GET[] but I seem to not get the values passed. I
run the phpinfo and I see the variables being stored as
_GET["variable_name"]
Is calling $_GET["variable_name"] correct? If so, why would I not get
the value?
I use
I didn't do it yet.
The script I am working on is large with many variables so I was hoping
someone else would know before I do it.
"Chris Hewitt" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Christopher J. Crane wrote:
>
> >Can I do this?
> >global $Ticker=
Christopher J. Crane wrote:
>Can I do this?
>global $Ticker=array();
>
I don't know, what happens when you try it?
HTH
Chris
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Can you global a variable at the same time as making it an array?
I usually do this:
$Ticker = array(); global $Ticker;
Can I do this?
global $Ticker=array();
Thank you.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Hi,
Thursday, October 3, 2002, 6:06:52 AM, you wrote:
AG> Hello,
AG> how can I use global variables in my web portal? I have read the php
AG> documentation, but it works only in the same file.
AG> I want use more global variable on many php site.
AG> For example:
AG> In login.php I use the code
On 2 Oct 2002 at 22:06, Anna Gyor wrote:
> how can I use global variables in my web portal? I have read the php
> documentation, but it works only in the same file. I want use more
> global variable on many php site.
>
> For example:
> In login.php I use the code
>
> $first=mysql_resul
> how can I use global variables in my web portal? I have read the php
> documentation, but it works only in the same file.
> I want use more global variable on many php site.
>
> For example:
> In login.php I use the code
>
> $first=mysql_result($result,0,"FIRST_NAME");
>
> and I want
age -
From: "Anna Gyor" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, October 02, 2002 2:06 PM
Subject: [PHP] Global variables
> Hello,
>
> how can I use global variables in my web portal? I have read the php
> documentation, but it works onl
Hello,
how can I use global variables in my web portal? I have read the php
documentation, but it works only in the same file.
I want use more global variable on many php site.
For example:
In login.php I use the code
$first=mysql_result($result,0,"FIRST_NAME");
and I want to print th
Hi all,
Help me please. I need $vartwo1 have the same value that $varone1. Look:
function one(){
?>
I tried using $_SERVER['PHP_SELF'] and $HTTP_SERVER_VARS['PHP_SELF']
but got the same error.
I found the answer on www.php.net.
function blah() {
global $PHP_SELF;
echo $PHP_SELF;
}
Thanks for your help, Mark.
--
>
> On Friday, June 21, 2002, at 09:23 AM, Mark McCulligh wrote:
>
> >
On Friday, June 21, 2002, at 09:23 AM, Mark McCulligh wrote:
> Is there a way to access a session variables or server variables from
> inside
> a function?
>
> I have a function and was trying to use $PHP_SELF inside of it.
> I get a variable undefined error.
> Out side of the function it work
Is there a way to access a session variables or server variables from inside
a function?
I have a function and was trying to use $PHP_SELF inside of it.
I get a variable undefined error.
Out side of the function it works fine.
I don't want to parameter pass the global variables to the function, I
Thanks Jason,
Works great in htaccess
Zac
- Original Message -
From: "Jason Wong" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, June 06, 2002 4:08 AM
Subject: Re: [PHP] global variables without sessions on apache
> On Thursday 06 June 2002
On Thursday 06 June 2002 06:05, Zac Hillier wrote:
> Miguel,
>
> I mean that the variables will never change per Virtual host but that the
> site is a template for many sites and these vars are part of the
> distinction for each site / Virtual Host.
>
> So far the suggestions of using the auto-pr
day, June 05, 2002 7:12 PM
Subject: Re: [PHP] global variables without sessions on apache
> On Wed, 5 Jun 2002, Zac Hillier wrote:
> > Is it possible using php on our own apache server to create global
> > variables for virtual host without having to use session variables.
> >
On Wed, 5 Jun 2002, Zac Hillier wrote:
> Is it possible using php on our own apache server to create global
> variables for virtual host without having to use session variables.
>
> We would like to have three variables that are constant for each virtual
> host and that are available from every p
On Wednesday 05 June 2002 22:45, Zac Hillier wrote:
> Could you expand on this a little more? I've tried searching for
> auto-prepend in both php documentation and apache and cannot find anything
> thats relates to our needs.
In php.ini there is a setting called "auto_prepend_file". Set it to wh
To: <[EMAIL PROTECTED]>
Sent: Wednesday, June 05, 2002 2:46 PM
Subject: Re: [PHP] global variables without sessions on apache
> On Wednesday 05 June 2002 20:40, Zac Hillier wrote:
> > Hi,
> >
> > Is it possible using php on our own apache server to create global
> > va
I'm not sure about at a htaccess level, but at a php.ini level I believe you
can set a file to "always include" at the top of every php page. This file
could simply be:
Not sure on the specifics, but it was discussed on the list in the last two
weeks, and i'm sure there is documentation for th
On Wednesday 05 June 2002 20:40, Zac Hillier wrote:
> Hi,
>
> Is it possible using php on our own apache server to create global
> variables for virtual host without having to use session variables.
>
> We would like to have three variables that are constant for each virtual
> host and that are av
Hi,
Is it possible using php on our own apache server to create global variables
for virtual host without having to use session variables.
We would like to have three variables that are constant for each virtual
host and that are available from every page, I thought it would be possible
with hta
use a database
ed
At 04:35 PM 5/29/2002 +0300, serge gedeon wrote:
>Dear sir,
>
>I would like to know if I could create using PHP, global variables that I
>could use in diferrent files. I don't want to use http_get_vars or post or
>cookies is there an other way?
Sounds like a job for $_SESSION to me...
http://www.php.net/manual/en/ref.session.php
---John Holmes...
> -Original Message-
> From: serge gedeon [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, May 29, 2002 9:36 AM
> To: [EMAIL PROTECTED]
> Subject: [PHP] Global variable
Look at the auto-prepend or auto-append feature.
-Original Message-
From: serge gedeon [mailto:[EMAIL PROTECTED]]
Sent: 29 May 2002 14:35
To: [EMAIL PROTECTED]
Subject: [PHP] Global variables
Dear sir,
I would like to know if I could create using PHP, global variables that I
could
Dear sir,
I would like to know if I could create using PHP, global variables that I
could use in diferrent files. I don't want to use http_get_vars or post or
cookies is there an other way?
Thank you.
Serge GEDEON
_
Sen
Dear sir,
I would like to know if I could create using PHP, global variables that I
could use in diferrent files. I don't want to use http_get_vars or post or
cookies is there an other way?
Thank you.
Serge GEDEON
_
Get
Jule wrote:
> Hey,
> i'm just wondering if there is another way to write global variables to a
> global.php, now i just the whole fopen etc script, where i open a file and
> write the sctring $number_right = [whatever number it is] to the file, but is
> there a different way to write it to the
TECTED]
> Subject: [PHP] global variables
>
> Hey,
> i'm just wondering if there is another way to write global variables
to a
> global.php, now i just the whole fopen etc script, where i open a file
and
> write the sctring $number_right = [whatever number it is] to the f
Hey,
i'm just wondering if there is another way to write global variables to a
global.php, now i just the whole fopen etc script, where i open a file and
write the sctring $number_right = [whatever number it is] to the file, but is
there a different way to write it to the file with one simple c
Hello folks
I have a virtual domain under Apache and do not have access to the global
php.ini file
Apache lets me set site-wide configuration in an /.htaccess file
Is there something similar for PHP? All the references I've been able to
find seem to refer to php.ini but do not say if I can ma
Does anyone know if it is possible to have a script declare a variable and make it
accesible by any script started by any browser?
$bar = 'abc';
function foo() {
global $bar;
$bar = 'def';
}
foo();
echo $bar; // def
http://www.php.net/manual/en/language.variables.scope.php
regards,
Philip Olson
On Tue, 25 Sep 2001, Peter wrote:
> Hi,
>
> I am have a function in which I have created a variable in it called
To: PHP List
> Subject: [PHP] global variables
>
>
> Hi,
>
> I am have a function in which I have created a variable in
> it called $genpassword.
>
> I find that I am unable to carry this variable over to the
> the other scripts to use because it is a local va
Hi,
I am have a function in which I have created a variable in it called
$genpassword.
I find that I am unable to carry this variable over to the the other
scripts to use because it is a local variable and its value exists only in
the function.
Is there anyway that I can take the value in $gen
i am using a global variable (curClass),
which is a reference to some class,
inside another class i want to change
the value of this global variable, to
"point" or refer to another class.
but that doesnt work.
am i doing something wrong???
here my code
--
class temp
{
functi
Hi,
I have a function like so
function updateForm()
{
global $link;
$query = "UPDATE badgers
SET
lname = '$lname',
fname = '$fname'
WHERE
Well, you could try:
extract( $GLOBALS )
inside a function - that might work..
At 22:14 26/07/2001 -0400, [EMAIL PROTECTED] wrote:
>How can I read in all of the global variables and give them local
>scope? PLEASE HELP ME.
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscrib
How can I read in all of the global variables and give them local
scope? PLEASE HELP ME.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]
on 7/8/01 7:57 PM, Brian White at [EMAIL PROTECTED] wrote:
>>> I dislike the GLOBAL statement in that many of the bugs that get me
>>> scratching my
>>> head are to do with when I have forgotten to use it.
>>
>> Then you're probably using it way too often.
>
> It is usually for "SCRIPT_NAME", o
At 20:13 8/07/2001 -0500, Mark Charette wrote:
> > I dislike the GLOBAL statement in that many of the bugs that get me
> > scratching my
> > head are to do with when I have forgotten to use it.
>
>Then you're probably using it way too often.
It is usually for "SCRIPT_NAME", or one of the CGI para
> I dislike the GLOBAL statement in that many of the bugs that get me
> scratching my
> head are to do with when I have forgotten to use it.
Then you're probably using it way too often.
Global scope variable are inherently dangerous and cause more problems than
they're worth. I've been in this b
Hi Inércia!
On Sun, 08 Jul 2001, Inércia Sensorial wrote:
> > You must learn it's way if you want to be effective. Also take a
> > look at design features proposed for PHP5. Looks promising and more C++
> like,
> > so better compare it with the later one.
>
> I went to php.net and searched for
> You must learn it's way if you want to be effective. Also take a
> look at design features proposed for PHP5. Looks promising and more C++
like,
> so better compare it with the later one.
I went to php.net and searched for some kind of docs on PHP5, but found
not a word. Where can I see this
At 02:55 PM 7/7/01 -0400, Mitch Vincent wrote:
> I've been using PHP for several years now and one question has plagued
>me the entire time. Why doesn't PHP have global variables? Before someone
>says it, I do know PHP sort of does have global variables, but having to
>specify GLOBAL in any fu
So this will do then:
$GLOBALS["userPassword"] = "whatever";
And when I need to use it, I use
echo userPassword;
and such alike?
What if I would like to change it? Can I simply use
'userPassword="whatever"';
?
Thanks,
Richard
--
PHP General Mailing List (http://www.php.net/)
To
In article <9e6s21$2rk$[EMAIL PROTECTED]>,
[EMAIL PROTECTED] ("Richard") wrote:
> So i should start the header (or wherever in the header) with :
>
> $GLOBALS["userPassword"] = "whatever";
>
> function cp() {
> global $userPassword;
>
> // $userPassword is 'whatever' /
So i should start the header (or wherever in the header) with :
$GLOBALS["userPassword"] = "whatever";
function cp() {
global $userPassword;
// $userPassword is 'whatever' //
}
Did I get it or am I just too tired?
- Richard
"Michael Stearne" <[EMAIL PROTECTED]> w
Try the define function. That will define a constant that you will always have
access to (within functions, through various included files,etc.) Or you can
write values to the $GLOBALS array of global variables.
$GLOBALS["userPassword"]="u8943fd";
Will define a variable that is accessible as $
Greetings.
I have about two include files which are included in every php page that
I have, and I wish to store global variables, such as passwords, usernames
and other details information.
After going through the PHP manual, all I could find was UNSET/SET
global variables, but I don't kn
Aaron Tuller schrieb:
>
> At 1:16 AM + 4/19/01, Philip Olson wrote:
> >
> >
> >
>
> don't do that, at least I think it will recursively traverse the
> $GLOBALS arrary (since $GLOBALS itself is $GLOBAL) and you will never
> end.
print_r() does have that bug, not var_dump().
http
> At 1:16 AM + 4/19/01, Philip Olson wrote:
> >
> >
> >
>
> don't do that, at least I think it will recursively traverse the
> $GLOBALS arrary (since $GLOBALS itself is $GLOBAL) and you will never
> end.
This is true with print_r($GLOBALS) up until 4.0.4 where it was fixed,
whi
At 1:16 AM + 4/19/01, Philip Olson wrote:
>
>
>
don't do that, at least I think it will recursively traverse the
$GLOBALS arrary (since $GLOBALS itself is $GLOBAL) and you will never
end.
-aaron
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL P
Have a look at the enormous $GLOBALS array, something like :
As previously mentioned, phpinfo() provides some pretty information and it
may be more what you want. Regarding $GLOBALS, (as quoted from the
manual) :
"The $GLOBALS array is an associative array with the name of the gl
> I know there is a way to do it in Perl, but is there anyway
> in PHP to display all of the global variables. Such as OS,
> browser, date/time, that sort of thing
>
> I know I could print each one seperately, but are they all
> stored in an array somewhere?
That should show you everything
I know there is a way to do it in Perl, but is there anyway in PHP to display all of
the global variables. Such as OS, browser, date/time, that sort of thing
I know I could print each one seperately, but are they all stored in an array
somewhere?
Jon wrote:
>
> Hi,
>
> I need to retrieve some information from a database, asociated with the user
> session so I could query this information whenever I want through the user
> session. I am searching for something similar to ASPs global variables if
> there is anything equivalent with PHP.
>
Hi,
I need to retrieve some information from a database, asociated with the user
session so I could query this information whenever I want through the user
session. I am searching for something similar to ASPs global variables if
there is anything equivalent with PHP.
Thanks
--
PHP General M
On Friday 23 February 2001 08:50, Dezider Góra wrote:
Disclaimer: I have never touched ASP, so I'm likely to have gotten
somethings wrong..
> function too ). But in asp, there were couple types or scopes.
> Asp got "application" and "session". Application is something like a
> virtual directory
Guys, I'm former asp guy and a long time Visual FoxPro programer, so I'm
carying some habbits and logic from it.
I'm really glad I switched to php, but some things are confisung me.
One of them are globals. From my understandig, globals are globaly seen
and accessed variables from any script ( whe
82 matches
Mail list logo