Jump to content

style an exit() or die()


etnastyles

Recommended Posts

Is it possible to style an exit() or die() message?

i was trying:

 

p.error {

font-family:Verdana,Arial,Helvetica,sans-serif;

font-size:11px;

color:red;

}

 

exit("<p class=\"error\">".ERROR_VIDEO_LINK."</p>");

 

and this didnt work btw and then i tried using a div wrapped around the exit message and this isnt working either.  I

feel it is very boring to just be presented with black text.. I was thinking of redirecting the user to another page but then i would have to mantain this page too.  Has anyone seen a solution to this style error???

 

regards  ???  8)  :D

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/123251-style-an-exit-or-die/
Share on other sites

you cant write the html styled first as all the styles are dropped when you use the exit or die function. i.e.

 

p.error {

  font-family:Verdana,Arial,Helvetica,sans-serif;

  font-size:11px;

  color:red;

 

echo "<p class=\"error\">".ERROR_VIDEO_LINK."</p>";

exit();

 

I had a look at custom error handler @ http://uk2.php.net/set-error-handler

not really my cup of tea thanks for the info however i think i will have to just live with it

or do a change of location once the script has exit() or die(). boooooooooo

Link to comment
https://forums.phpfreaks.com/topic/123251-style-an-exit-or-die/#findComment-636509
Share on other sites

The CSS will only kick in if the error happens after the CSS has been loaded - IE the die function comes after the link declarations in the head.

 

As a side note though, die declarations should not be used on a live site with database queries, as it is a security risk. It gives hackers information as to what is going on behind the scene, meaning they have more ammo to attack your site with.

Link to comment
https://forums.phpfreaks.com/topic/123251-style-an-exit-or-die/#findComment-636749
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.