Re: parse error? how can I print spesific message for all error mesage
| From: | Lars Torben Wilson | Date: | Tue, 12 Mar 2002 21:16:12 +0000 |
| Subject: | Re: parse error? how can I print spesific message for all error mesage | ||
| References: | 1 2 3 4 5 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-88243@lists.php.net to get a copy of this message | ||
On Tue, 2002-03-12 at 12:32, Ceyhun Güler wrote:
> if I write directly "localhost/myphp/resmigoster.php" on his browser
> it response
> Warning: Undefined index: dir in c:\inetpub\wwwroot\kocak\resimgoster.php on
> line 1
>
> Warning: Undefined index: res in c:\inetpub\wwwroot\kocak\resimgoster.php on
> line 3
>
> if I write directly "localhost/myphp/resmigoster.php?dir=main&res=mine"
> than the script works like mine
> but I wonder to disable "Warning: Undefined index: dir in
> c:\inetpub\wwwroot\kocak\resimgoster.php on line 1"
> response if someone directly enter "localhost/myphp/resmigoster.php" I want
> to say him that "Access Denied" Or something like that
'The Right Way'--there are several ;)--is to initialize your
variables. :) If you don't want to do that, then:
1) Set error_reporting(E_ALL) for development, so you catch all the
silly little errors we all make;
2) Set display_errors = Off in php.ini, so that users don't see any
errors that are generated;
3) Use set_error_handler() to create your own function which can deal
with error messages however you like.
To the above, you can add all sorts of things. Using
set_error_handling(), for instance, you can have error messages logged
to a file, or sent to a socket or pipe--whatever. But turning
error_reporting() off while developing is just going to let you get away
with all sorts of things which might come back and bite you later
(unquoted array keys, etc).
--
Torben Wilson <torben@php.net>
http://www.thebuttlesschaps.com
http://www.hybrid17.com
http://www.inflatableeye.com
+1.604.709.0506