[PHP] define()

2012-06-15 Thread Karl DeSaulniers
Quick question phprz. Is it ok to put a token inside a define() statement? IE: define('TOKEN', $sometoken); I guess what I am really after is if this can be read by a hacker? I may be misguided as to what define()'s parameters are. Once you define something it becomes a server variable? And se

Re: [PHP] 'Define vs const' or 'file vs class'

2007-12-17 Thread Nathan Nobbe
On Dec 17, 2007 8:15 AM, Johannes Skov Frandsen <[EMAIL PROTECTED]> wrote: > Hi everybody > > This post is not so much a question to solve a problem but more in the > direction: what would you do and why. > > I'm starting a new project and is preparing the basic layout for the > application. In al

[PHP] 'Define vs const' or 'file vs class'

2007-12-17 Thread Johannes Skov Frandsen
Hi everybody This post is not so much a question to solve a problem but more in the direction: what would you do and why. I'm starting a new project and is preparing the basic layout for the application. In all my previous projects I have had a config file that all other files would require

Re: [PHP] define() an array?

2007-04-27 Thread Richard Lynch
On Thu, April 26, 2007 5:43 am, Tijnema ! wrote: > On 4/20/07, Richard Lynch <[EMAIL PROTECTED]> wrote: >> On Fri, April 20, 2007 4:46 am, [EMAIL PROTECTED] wrote: >> > I thought I could define() and array. However, when I do this: >> >> Nope. :-( >> >> Has to be string or int or boolean or float o

Re: [PHP] define() an array?

2007-04-27 Thread M.Sokolewicz
Chris wrote: Tijnema ! wrote: On 4/20/07, Richard Lynch <[EMAIL PROTECTED]> wrote: On Fri, April 20, 2007 4:46 am, [EMAIL PROTECTED] wrote: > I thought I could define() and array. However, when I do this: Nope. :-( Has to be string or int or boolean or float or other "scalar" type. > define(

Re: [PHP] define() an array?

2007-04-27 Thread Chris
Tijnema ! wrote: On 4/20/07, Richard Lynch <[EMAIL PROTECTED]> wrote: On Fri, April 20, 2007 4:46 am, [EMAIL PROTECTED] wrote: > I thought I could define() and array. However, when I do this: Nope. :-( Has to be string or int or boolean or float or other "scalar" type. > define("THECONSTANT",

Re: [PHP] define() an array?

2007-04-26 Thread Tijnema !
On 4/20/07, Richard Lynch <[EMAIL PROTECTED]> wrote: On Fri, April 20, 2007 4:46 am, [EMAIL PROTECTED] wrote: > I thought I could define() and array. However, when I do this: Nope. :-( Has to be string or int or boolean or float or other "scalar" type. > define("THECONSTANT", array(1,2,3)); >

Re: [PHP] define() an array?

2007-04-20 Thread Richard Lynch
On Fri, April 20, 2007 4:46 am, [EMAIL PROTECTED] wrote: > I thought I could define() and array. However, when I do this: Nope. :-( Has to be string or int or boolean or float or other "scalar" type. > define("THECONSTANT", array(1,2,3)); > print_r(THECONSTANT); > > it prints THECONSTANT and not

Re: [PHP] define() an array?

2007-04-20 Thread Stut
[EMAIL PROTECTED] wrote: I thought I could define() and array. However, when I do this: define("THECONSTANT", array(1,2,3)); print_r(THECONSTANT); it prints THECONSTANT and not the array :( according to the manual: bool define ( string $name, mixed $value [, bool $case_insensitive] ) And isn

Re: [PHP] define() an array?

2007-04-20 Thread Jeremy Privett
[EMAIL PROTECTED] wrote: Hi, I thought I could define() and array. However, when I do this: define("THECONSTANT", array(1,2,3)); print_r(THECONSTANT); it prints THECONSTANT and not the array :( according to the manual: bool define ( string $name, mixed $value [, bool $case_insensitive] ) An

[PHP] define() an array?

2007-04-20 Thread lists
Hi, I thought I could define() and array. However, when I do this: define("THECONSTANT", array(1,2,3)); print_r(THECONSTANT); it prints THECONSTANT and not the array :( according to the manual: bool define ( string $name, mixed $value [, bool $case_insensitive] ) And isn't "mixed" of any typ

Re: [PHP] define() or $variable for application settings?

2006-02-09 Thread Paul Novitski
At 07:56 PM 2/8/2006, Matt Arnilo S. Baluyos (Mailing Lists) wrote: I have a config.inc.php file which basically contains all the configuration info that the applications needs (directory/file locations, database credentials, etc). The information there is set using the define() function. Howeve

Re: [PHP] define() or $variable for application settings?

2006-02-09 Thread Barry
tedd wrote: Matt: That should've been my follow up question - which is, if define() is a lot safer and more elegant to use than variables, why do many projects use variables? My use of CONSTANCE's and variables depend upon need. If I require a constant throughout the main() portion of my co

Re: [PHP] define() or $variable for application settings?

2006-02-09 Thread tedd
Matt: That should've been my follow up question - which is, if define() is a lot safer and more elegant to use than variables, why do many projects use variables? My use of CONSTANCE's and variables depend upon need. If I require a constant throughout the main() portion of my code, then I use

Re: [PHP] define() or $variable for application settings?

2006-02-09 Thread Matt Arnilo S. Baluyos (Mailing Lists)
On 2/9/06, Jochem Maas <[EMAIL PROTECTED]> wrote: > bare in mind though that define() is horribly slow (to paraphrase > Rasmus) which may be the reason many projects choose to use variables > instead. see here: Thanks Chris and Jochem! That should've been my follow up question - which is, if defi

Re: [PHP] define() or $variable for application settings?

2006-02-09 Thread Jochem Maas
Chris wrote: Hi Matt, I use define's. me too. mostly because unless you use the runkit extension or something you can't undefine or change the values of a constant. bare in mind though that define() is horribly slow (to paraphrase Rasmus) which may be the reason many projects choose to use va

Re: [PHP] define() or $variable for application settings?

2006-02-08 Thread Chris
Hi Matt, I use define's. With variables it's easy to forget to global'ise it when you go into a function, define's don't have this issue. Matt Arnilo S. Baluyos (Mailing Lists) wrote: Hello Everyone, I have a config.inc.php file which basically contains all the configuration info that the a

[PHP] define() or $variable for application settings?

2006-02-08 Thread Matt Arnilo S. Baluyos (Mailing Lists)
Hello Everyone, I have a config.inc.php file which basically contains all the configuration info that the applications needs (directory/file locations, database credentials, etc). The information there is set using the define() function. However, I've seen some open-source projects which either u

RE: [PHP] define (true/false)

2005-07-28 Thread Jay Blanchard
[snip] > now that was exactly my reasoning ... but I very much appriciate the input > of the more experienced/older/classically-trained (as apposed to my > completely > -self-taught-not-backed-up-with-any-solid-computer-science-theory-skills ) > guys out there (hey Jay it's a compliment ;-) Jay's

RE: [PHP] define (true/false)

2005-07-28 Thread Jay Blanchard
[snip] > I may be misunderstanding you here, but I don't see why you would not > want to use a variable to define a constant. I do it from time to time, > most common would be in a config document where I'll check if the page > is being accessed via http or https, and define a constant based on

Re: [PHP] define (true/false)

2005-07-28 Thread Vidyut Luther
On Jul 28, 2005, at 9:41 AM, Edward Vermillion wrote: [snip] I may be misunderstanding you here, but I don't see why you would not want to use a variable to define a constant. I do it from time to time, most common would be in a config document where I'll check if the page is being acces

Re: [PHP] define (true/false)

2005-07-28 Thread John Nichel
Jochem Maas wrote: now that was exactly my reasoning ... but I very much appriciate the input of the more experienced/older/classically-trained (as apposed to my completely -self-taught-not-backed-up-with-any-solid-computer-science-theory-skills) guys out there (hey Jay it's a compliment ;-)

Re: [PHP] define (true/false)

2005-07-28 Thread Edward Vermillion
John Nichel wrote: Jay Blanchard wrote: [snip] never want to use a variable to determine a constant because the variable is not likely to be the same (that is why we call them variables) on any iteration. Using constants in expressions is OK, for instance if(BAR == $foo){ ...stuff... } But

Re: [PHP] define (true/false)

2005-07-28 Thread Jochem Maas
John Nichel wrote: Jay Blanchard wrote: [snip] if($bars == 3) { define('BAR', 1); } then: if(BAR) { That's an incorrect use for constants. Use variables for that =] WHY? [/snip] Because the constant can be variable in this case. Consider (this is old school, and we all know that I

Re: [PHP] define (true/false)

2005-07-28 Thread John Nichel
Jay Blanchard wrote: [snip] if($bars == 3) { define('BAR', 1); } then: if(BAR) { That's an incorrect use for constants. Use variables for that =] WHY? [/snip] Because the constant can be variable in this case. Consider (this is old school, and we all know that I am the definition of o

Re: [PHP] define (true/false)

2005-07-28 Thread John Nichel
Sebastian wrote: i never really used constants before so this may sound stupid.. when you define a constant using define() and want to return true/false is this logical: if($bars == 3) { define('BAR', 1); } then: if(BAR) { // bars is true } or should i need to do an else statement as

Re: [PHP] define (true/false)

2005-07-28 Thread Vidyut Luther
Exactly, CONSTANTS are ... "eternal truths" to the program, they shouldn't change, constants should not be changing based on arguments being passed, or other variables. by definition, it's no longer a constant, and a misuse of the define () function. On Jul 28, 2005, at 8:46 AM, Jay Bl

Re: [PHP] define (true/false)

2005-07-28 Thread André Medeiros
On Thu, 2005-07-28 at 14:41 +0200, Jochem Maas wrote: > André Medeiros wrote: > > On Wed, 2005-07-27 at 17:17 -0400, Sebastian wrote: > > > >>i never really used constants before so this may sound stupid.. > >>when you define a constant using define() and want to return true/false > >>is this log

RE: [PHP] define (true/false)

2005-07-28 Thread Jay Blanchard
[snip] >>if($bars == 3) >>{ >>define('BAR', 1); >>} >> >>then: >> >>if(BAR) >>{ > That's an incorrect use for constants. Use variables for that =] WHY? [/snip] Because the constant can be variable in this case. Consider (this is old school, and we all know that I am the definition of old scho

Re: [PHP] define (true/false)

2005-07-28 Thread Jochem Maas
André Medeiros wrote: On Wed, 2005-07-27 at 17:17 -0400, Sebastian wrote: i never really used constants before so this may sound stupid.. when you define a constant using define() and want to return true/false is this logical: if($bars == 3) { define('BAR', 1); } then: if(BAR) { ...

Re: [PHP] define (true/false)

2005-07-28 Thread André Medeiros
On Wed, 2005-07-27 at 17:17 -0400, Sebastian wrote: > i never really used constants before so this may sound stupid.. > when you define a constant using define() and want to return true/false > is this logical: > > if($bars == 3) > { > define('BAR', 1); > } > > then: > > if(BAR) > { > /

Re: [PHP] define (true/false)

2005-07-27 Thread Jochem Maas
Sebastian wrote: i never really used constants before so this may sound stupid.. you could use constants and still sound stupid. - that would be 'constantly sounding stupid' ;-) when you define a constant using define() and want to return true/false is this logical: yes, if a little verbose

Re: [PHP] define (true/false)

2005-07-27 Thread comex
> i never really used constants before so this may sound stupid.. > when you define a constant using define() and want to return true/false > is this logical: http://us2.php.net/defined -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

[PHP] define (true/false)

2005-07-27 Thread Sebastian
i never really used constants before so this may sound stupid.. when you define a constant using define() and want to return true/false is this logical: if($bars == 3) { define('BAR', 1); } then: if(BAR) { // bars is true } or should i need to do an else statement as well: if($bars ==

Re: [PHP] define constants within functions?

2004-08-10 Thread Justin French
On 11/08/2004, at 12:16 AM, Jay Blanchard wrote: They should be global already... http://us3.php.net/manual/en/language.constants.php "Like superglobals, the scope of a constant is global. You can access constants anywhere in your script without regard to scope. For more information on scope, read

RE: [PHP] define constants within functions?

2004-08-10 Thread Jay Blanchard
[snip] If I define a constant within a function, it appears that the constant is only defined within the namespace of the function. Fair enough. Can I globalise these definitions? [/snip] They should be global already... http://us3.php.net/manual/en/language.constants.php "Like superglobals,

[PHP] define constants within functions?

2004-08-10 Thread Justin French
If I define a constant within a function, it appears that the constant is only defined within the namespace of the function. Fair enough. Can I globalise these definitions? --- Justin French http://indent.com.au -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.

Re: [PHP] define variables.

2003-03-05 Thread Vincent M.
Jason K Larson wrote: http://www.php.net/manual/en/function.constant.php $msg = constant('_LANG'.$num); HTH, -- Jason k Larson Strange it does not work if I do: $num = "_LANG".$num ; $msg = constant($num) ; echo $mgs ; //It does not display anything! But If I do it directly, it works: $nu

Re: [PHP] define variables.

2003-03-05 Thread Jason k Larson
http://www.php.net/manual/en/function.constant.php $msg = constant('_LANG'.$num); HTH, -- Jason k Larson Vincent M. wrote: Hello, I do a lot of define like that: define ("_LANG1", "Server options"); define ("_LANG1", "Manage your system"); etc... And stuff like that: if($num == 1) { $mgs =

[PHP] define variables.

2003-03-05 Thread Vincent M.
Hello, I do a lot of define like that: define ("_LANG1", "Server options"); define ("_LANG1", "Manage your system"); etc... And stuff like that: if($num == 1) { $mgs = _LANG1 ; }else if($num == 2) { $mgs = _LANG2 ; } etc... But I do want to avoid all these if and else, is there a way

Re: [PHP] define("DOC_HOME_PATH", "what goes here")

2003-02-20 Thread 1LT John W. Holmes
> define ("DOC_HOME_PATH", "http://localhost/killerspin/web/store/";); > define ("IMG_HOME_PATH", "http://localhost/killerspin/web/images/";); > define ("CTL_HOME_PATH", "http://localhost/killerspin/web/control/";); > > Click Here > > > doesn't work. It should. The above code produces this when

[PHP] define("DOC_HOME_PATH", "what goes here")

2003-02-19 Thread Jonathan Villa
I want to define 3 constants DOC_HOME_PATH IMG_HOME_PATH CTL_HOME_PATH So that I can just do this Click Here **do I need to echo? **not everything goes to "stuff" Right now I have define ("DOC_HOME_PATH", "d:/is/projects/killerspin/web/store/"); define ("IMG_HOME_PATH", "d:/is/projects/kil

[PHP] define("DOC_HOME_PATH", "what goes here")

2003-02-19 Thread Jonathan Villa
I want to define 3 constants DOC_HOME_PATH IMG_HOME_PATH CTL_HOME_PATH So that I can just do this Click Here **do I need to echo? **not everything goes to "stuff" Right now I have define ("DOC_HOME_PATH", "d:/is/projects/killerspin/web/store/"); define ("IMG_HOME_PATH", "d:/is/projects/kil

[PHP] define("DOC_HOME_PATH", "what goes here")

2003-02-19 Thread Jonathan Villa
I want to define 3 constants DOC_HOME_PATH IMG_HOME_PATH CTL_HOME_PATH So that I can just do this Click Here **do I need to echo? **not everything goes to "stuff" Right now I have define ("DOC_HOME_PATH", "d:/is/projects/killerspin/web/store/"); define ("IMG_HOME_PATH", "d:/is/projects/kil

Re: [PHP] define new window

2002-03-07 Thread Duncan Hill
On Thu, 7 Mar 2002, Administration@myclassguide wrote: > This line opens in a new window. How can i define the size of the window, > scroll options etc. Javascript. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

[PHP] define new window

2002-03-07 Thread [EMAIL PROTECTED]
Hi This line opens in a new window. How can i define the size of the window, scroll options etc. echo "Results"; Thanks in advance Mohamed -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

[PHP] define() function strange output... !!!!

2002-01-07 Thread Levon Ghazaryan
Hi everibody I have Apache running under Linux SuSE 7.2 with PHP/4.0.4pl1 The server the Linux and the php instalation is the standart SuSE package instalation from the SuSE install cd-s so, everithing is fine except one thing: calling this test.php script in browser window: '; if(defined("_Sc"