Jump to content
xisto Community
Chesso

Bug In My Forums.

Recommended Posts

There seems to be a bug in my forums where if a user posts alot .'s on a single line (and I mean alot) the page won't load at all except for showing the google ad at the bottom.I tested with posting tons of text say about as long as this and copy/paste alot and it works fine. Just with a ton of text on a single line (looks as a single line in phpmyadmin) breaks it.Anyone have any idea why this would happen?People really shouldn't be doing it anyway but I would prefer it not to breake the whole thread page....

Share this post


Link to post
Share on other sites

Hi Chesse,

 

I just tried what you said.

The following is your problem:

The long one-word-line isn't automatically wrapped. That's bad enough, but there's more to it.

Your table layout is kind of hard to see through, because some measurements are in CSS files and some in the table tags. I can only tell you what's happening.

The one-liner stretches the lowest td-field, as much as possible. Because of that the whole table is stretched. All the other tds follow, because their width is set in percentages (20%/80%).

The worst thing now is though, that you set something up (and I couldn't find out what due to the above opaqueness), that makes the layout go all crazy. In Safari it looks as expected, but there no horizontal scrolling bars, so you can't see the content. In Firefox, the whole page moves to the right, but there are scrollbars.

Don't ask me why though.

I can point out some things, that might help:

Use the PHP wordwrap function on words, that would break the page layout. You still have to think, that there folks, that want to enlarge the text, have different fonts etc, so you still have to think about your broken layout.

You do at least thing terribly wrong in CSS: IDs (#tdtablemid for instance) are for UNIQUE tags. That means, you use them once per page. Identification, you get it? What you ought to use are Classes (as in ".tdtablemid"). You assign them to HTML tags like this: <td class="tdtablemid">. This might be the reason why the pages look crazy.

max-width, min-width are not respected by most browsers.

If you do this, you might yield the hoped for results.

 

Good luck, ask back!

 

Ruben

 

PS.: Php.net/wordwrap

PS.2: CSS validator

Edited by ruben (see edit history)

Share this post


Link to post
Share on other sites

first of all, i just visit your forum and it doesn't work, it redirects you to other website and shows an error that you forgot to disable javascript posting in the forum. Now, tell me something, do you use MySql as your database backend??? if it is true, well, i recommend you to use the mysql_real_escape_string() function.Best regards,

Share this post


Link to post
Share on other sites

The forum has worked fine for me except for this particular problem.Yeah I don't strip out html/jscript as of yet, not sure how to. This is basically my first attempt at doing it.

Share this post


Link to post
Share on other sites

The forum has worked fine for me except for this particular problem.
Yeah I don't strip out html/jscript as of yet, not sure how to. This is basically my first attempt at doing it.

It's quite easy simply call the function with the value that you want to strip out as a parameter before your insert stament. I use this function everytime and you dont know how many problems and time i avoid with it:
<?phpfunction safeEscapeString($string){	if (get_magic_quotes_gpc()) {		return $string;	}	else {		return mysql_real_escape_string($string); // PHP 4.x	}}$var1=safeEscapeString($_POST["var1"]);$var2=safeEscapeString($_POST["var2"]);...// your db connection settingsmysql_query("insert into table(var1,var2) values ('$var1','$var2')") or die ("Error...\n" . mysql_errno(). ": " . mysql_error() );// other code?>

Best regards,

Share this post


Link to post
Share on other sites

Not sure about that but right now I use: $msg = strip_tags($message,'<b>'); $message = str_replace("\r\n","<br>",$msg); $msg = mysql_real_escape_string(stripslashes($message)); $message = $msg;strips all html tags except b to begin with, replaces \r\n with br and then fixes up ' and " for display.Gotta figure out how to strip out javascript stuff....

Share this post


Link to post
Share on other sites

Yo Chesso,
Javascript stuff can hardly be implemented without HTML tags in it. If you know Javascript, you will remember that you cannot implement JS without either an eventhandler in a HTML tag or a <script> tag.
By the way I got the link to the CSS validator wrong, here it is: Jigsaw CSS Validator for Chesso Forums
Good luck figuring your code out. Remember to work W3C-compliant, will save you a lot of trouble. Then you can still adapt to MSIE.

I'm audi,
Ruben

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | 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.