is there a function to ignore undefined variables?

 
Post new topic   Reply to topic    Aprelium Forum Index -> PHP
View previous topic :: View next topic  
Author Message
noamkrief
-


Joined: 12 Nov 2003
Posts: 40

PostPosted: Thu Jan 08, 2004 7:10 am    Post subject: is there a function to ignore undefined variables? Reply with quote

Is there a special command i can put on top of a php page that would ignore undefined variables?

thank
Noam
Back to top View user's profile Send private message Send e-mail
whackaxe
-


Joined: 28 Jun 2003
Posts: 90

PostPosted: Thu Jan 08, 2004 2:10 pm    Post subject: Reply with quote

you can check if a variable is set by using the isset function for example

Code:

if (!isset($myvar))
{
print("not set')
}
else
{
print("set!");
}


the ! in front of isset means "isn't" in normal english you could just take it off and invert the messages
_________________
and remeber kids! keep the forums clean!
Back to top View user's profile Send private message
Moxxnixx
-


Joined: 21 Jun 2003
Posts: 1226
Location: Florida

PostPosted: Thu Jan 08, 2004 2:13 pm    Post subject: Reply with quote

Put this at the top of your page:
error_reporting (E_ERROR | E_WARNING | E_PARSE);
or you can go into your php.ini file and turn off notices
for all php pages. :wink:
Back to top View user's profile Send private message Visit poster's website
noamkrief
-


Joined: 12 Nov 2003
Posts: 40

PostPosted: Thu Jan 08, 2004 3:10 pm    Post subject: Reply with quote

both of those worked great.
I like to use both options. Turning off the error reporting seems to be better security over my code and sql database...
thank you both
Noam
Back to top View user's profile Send private message Send e-mail
whackaxe
-


Joined: 28 Jun 2003
Posts: 90

PostPosted: Thu Jan 08, 2004 6:22 pm    Post subject: Reply with quote

its ideal to turn on all warnings in a developmen enviroment, but in a production enviroment, for security reasons, yo should turn it off
_________________
and remeber kids! keep the forums clean!
Back to top View user's profile Send private message
goose
-


Joined: 17 Sep 2002
Posts: 608
Location: The Land Of OZ! come here toto!

PostPosted: Thu Jan 08, 2004 10:14 pm    Post subject: Reply with quote

hmmm maybe i can use this in guppy's webportal

to get it running! :wink:
_________________
living in an armish paradise.....no gates here!

mawuahahaha :)
Back to top View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Aprelium Forum Index -> PHP All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB phpBB Group