I am modifying a guestbook code and there is one specific line, where I can't escape the double quotes that I want to be parsed to html.

$cookie = setcookie('entry','
<br><br><span class=warning>
Sorry, You have already posted a Message on this guestbook.<br>
Please wait 2 minutes and try again.</span>',time() + (120));
double quotes should be parsed around the term "warning" in the span class.

I know it's not that necessary to have quotes in the html text, but I want to get this right.

In other pieces of code I could easily escape the double quotes by using \" .

any idea what I can do?

thanks in advance

fci

06-21-2006, 01:43 PM

why are you putting html in a cookie? ideally you would set it to be 'warning' or 'no_error' then have it display what you want where ever.

yeti

06-21-2006, 02:31 PM

in my guestbook is an option called for flood protecting the gb

a cookie is set and when the user has posted a short time before (actually 2 min.) the error message is echoed.

in the original code were a lot of html4.02 invalid elements (i.e. <center>), that I could replace - all but in this specific line. I removed the <center> and <font> tags and want to add <span class="warning">...</span> in order to format this warning like the other ones.

original code:

// Checking to see if the visitor has already posted --------------------

// Set cookie for flood protection --------------------------------------------------------------
$cookie = setcookie('entry','<br><br><center><font color=red><b>Sorry, You have already posted a Message on this guestbook.<br>Please wait 2 minutes and try again.</b></font><br><br></center>',time() + (120));
} // End of If statement for flooding

modified code:

// Set cookie for flood protection --------------------------------------------------------------
$cookie = setcookie('entry','<span class=\"warning\">Sorry, You have already posted a Message on this guestbook.<br>Please wait 2 minutes and try again.</span>',time() + (120));
} // End of If statement for flooding

I already tried to escape the quotes (that are required in the parsed html), but it did not work. warning was not formatted correctly because of invalid html:

<span class=\"warning\">Sorry, You have already posted a Message on this guestbook.<br>Please wait 2 minutes and try again.</span>

fci

06-21-2006, 02:37 PM

it would be more logical to do it like this:

// Checking to see if the visitor has already posted --------------------