Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.