Page 1 of 1

Good code getting parsed incorrectly....

Posted: Tue Dec 12, 2006 11:02 am
by Citizen
I have a script that allows users to put in their own articles. The problem is that sometimes users put in bad code and the out put ends up looking like this:

I think it has something to do with the image tag not being closed correctly after the "alt" property.

Any ideas what I need to do to the $content variable before echoing it to prevent this from happening?

Code: Select all

<td width="100%">
 							<div style="margin-left: 1%; margin-top: 2%; margin-bottom: 2%;">
 							<span style="font-size: 10pt;">
 							<p><img bigimg="" src="http://static.ibnlive.com/pix/sitepix/09_2006/knot_248.jpg" alt="WHERE IS THE LOVE: The wife’s message read - You are the most despicable, deceitful people I have ever met." title="WHERE IS THE LOVE: The wife&r... <a href='article.php?article=65'>(More)</a>
 							</span>
 							</div>
 						</td>
 					</tr>
 					<tr>
 						<td>

Posted: Tue Dec 12, 2006 11:22 am
by volka
Somewhere something like htmlentities() is applied incorrectly ...maybe ;)

Posted: Tue Dec 12, 2006 12:40 pm
by Citizen
volka wrote:Somewhere something like htmlentities() is applied incorrectly ...maybe ;)
When I use htmlentities, the HTML no longer works....

Here is an example:

http://www.hashbush.com/newsindex.php

Posted: Tue Dec 12, 2006 1:28 pm
by volka
I didn't say you should add another call to htmlentities(), did I? I just speculated that something like htmlentities already has been used incorrectly.
But without seeing the actual code it's all wild guessing.

Posted: Tue Dec 12, 2006 1:31 pm
by Citizen
I found the problem.... it has to do with substr cutting my <img code in half.

I posted a more relevent thread since I was wrong in assuming it was a parse error:

viewtopic.php?t=60683