Jump to content

Recommended Posts

I need to use my error message div within die()... but i dont know if I can do this.. Im not good with escaping with quatations

 

for example, I got

 

 else
        {
            die ("Your ip has been blocked. Time till unblock:".($current_time - $blocked_time));
        }

I need to put a div in there for the error style:

 

 else
        {
            die ("<div class='error'>Your ip has been blocked. Time till unblock:".($current_time - $blocked_time));</div>
        }

But I know that will just cause a bunch of errors.

 

First of all is it even possible?

 

Thanks for all the help I love this site. Its kind of embarassing the stupid shit I ask but Im just horrible with putting html into php. What confuses me is using double qoutes n single quotes and just quotes in general I just cant grasp it!

 

 

Link to comment
https://forums.phpfreaks.com/topic/208963-is-it-possible-to-apply-css-within-die/
Share on other sites

I've used HTML inside of die() before, and inline CSS is just HTML, so it will work. I'm seeing that you are trying to block by IP, and while that is fairly useless, I think it is in your best interest if you don't output anything with die(), at least when dealing with people you are trying to block. Why let them know what is going on? Also, it would be better to block by IP inside your .htaccess, and then the user will get a forbidden message, and you won't have to style it.

I've used HTML inside of die() before, and inline CSS is just HTML, so it will work. I'm seeing that you are trying to block by IP, and while that is fairly useless, I think it is in your best interest if you don't output anything with die(), at least when dealing with people you are trying to block. Why let them know what is going on? Also, it would be better to block by IP inside your .htaccess, and then the user will get a forbidden message, and you won't have to style it.

Well the way everything is set up I need to use die it makes it easier for me. This script resticts access to a page after being viewed 3 times... it saves the surfers IP in a database and matches it ...when the surfer gets the error message, it exits the script... im using an include file for the content on the page. Idk, it just makes it easier for me.

 

But how would I apply the html in it? Like whats the structure of it?

 

Thanks for your reply

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.