Re: Programming structures
| From: | Chris Adams | Date: | Sun, 25 Jun 2000 22:04:17 +0000 |
| Subject: | Re: Programming structures | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-3036@lists.php.net to get a copy of this message | ||
> alex <alex@quad.com.ar> wrote:
> > I would allways use the die() alternative, since it's much more readable
> > than the "if/else" solution. On the other hand, making your script die is
> > not so nice, for example I usually require() some footer.inc's at the end of
> > the scripts that wouldn't get executed with the die() before it.
>
> Nothing prevents you from designing your own die() function like
>
> function myDie($errormsg)
> {
> print "</table></table></table>Error: '$errormsg'";
> require 'footer.inc';
> exit;
> }
It strikes me that it might be a good idea to allow the programmer to override certain built in
functions such as die, to avoid having to change a ton of library code or 3rd party routines. As an
example, I would like to make a version of die() that would only send the output to the browser for
people matching certain patterns (e.g. IP address in set block, special username or cookie),
possibly with additional debugging info (e.g. mysql_error(), phpinfo()) and a generic "An error
occurred while processing this page. Our programming team has already been notified." HTML page
for
everyone else.