ShoutBox problem!

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

User avatar
William
Forum Contributor
Posts: 332
Joined: Sat Oct 25, 2003 4:03 am
Location: New York City

Post by William »

Http://www.THeNetherRealm.com/shoutbox.php go there try WWWWWWWWWWWWWWWW then try typing in a sentance
and this is switch.php basicly does everything before it posts....

Code: Select all

<?php
// Deleates any old errors to keep from a back up.
$HTTP_REFERER2 = str_replace("?error=1", "", $HTTP_REFERER);
$hover_info = date("g:i A | F j, Y");
$shouts_data = "inc/shouts.inc";
$shout_post_theme = file_get_contents("inc/post_theme.inc");
$shout_old_data = file_get_contents("inc/shouts.inc");
if(isset($_POST['1'])) {
	if(strtolower($shout_data1) == "name" || strtolower($shout_data2) == "message") {

		Header("Location: $HTTP_REFERER2?error=1");
	} Else {

// Get's rid of that \ evertime someone types a special charactor.
$shout_data1 = str_replace("", "", $shout_data1);
$shout_data2 = str_replace("", "", $shout_data2);

// Stip HTML tags.
$shout_data1 = strip_tags(trim($shout_data1));
$shout_data2 = strip_tags(trim($shout_data2));

// Automaticly break long lines. 
$shout_data1 = wordwrap($shout_data1, 15, "<br />",1); 
$shout_data2 = wordwrap($shout_data2, 15, "<br />",1); 

// Checks for a URL & if it's there it add's it if not it doesn't.
if($link == "") {
	$shout_data1 = "<span title='$hover_info'>$shout_data1</span>";
} Else {
	$shout_data1 = "<span title='$hover_info'><a href='$link' target='_blank'>$shout_data1</a></span>";
}

// Get's code checkers.
include("inc/censor_check.inc");
include("inc/smilie_check.inc");

	// Add's new shout
	$fp = fopen( $shouts_data, "w" ) or die("We are sorry, We couldn't add the shout!");
		fwrite( $fp, "<table cellpadding='2' cellspacing='0' border='0' width='150' align='center'>
						<tr>
							<td width='150'>
								<b><font size='2' color='#DDDDDD'>$shout_data1</font></b>
							</td>
						</tr>
						<tr width='150'>
							<td><font size='2'>$shout_data2</font></td>
						</tr>
					</table>
					<hr color='#000000' width='100%' size='1'>
					$shout_old_data" );
	fclose( $fp );
		Header("Location: $HTTP_REFERER2");
	}
} Else {
	Header("Location: $HTTP_REFERER2");
}
?>
Illusionist
Forum Regular
Posts: 903
Joined: Mon Jan 12, 2004 9:32 pm

Post by Illusionist »

I see what you mean now. There is a way to disable teh vertical scroll abrs, lemme see if i can find it real quick...
User avatar
William
Forum Contributor
Posts: 332
Joined: Sat Oct 25, 2003 4:03 am
Location: New York City

Post by William »

Disable but then it whould shiow it over and then any data they put if it's over they cant see it correct?
Illusionist
Forum Regular
Posts: 903
Joined: Mon Jan 12, 2004 9:32 pm

Post by Illusionist »

i meant disable the horizontal bars... Uhm... if i remember correctly it should wrap for you when you disable the scroll bars... I don't know you can try it though.... add this style to the <iframe> tag

Code: Select all

style="overflow-x:hidden;"
User avatar
William
Forum Contributor
Posts: 332
Joined: Sat Oct 25, 2003 4:03 am
Location: New York City

Post by William »

Doesn't work:

Code: Select all

<iframe src='shoutbox/shout.php' height='150' width='150' frameborder='0' style='overflow-x:hidden;'>We are sorry your browser doesn't support frames. Click <a href='shoutbox/shout.php'>here</a> to see the shouts.</iframe>
Illusionist
Forum Regular
Posts: 903
Joined: Mon Jan 12, 2004 9:32 pm

Post by Illusionist »

hmm.... maybe you could still use the wordwrap function, because that seems to work, unless the character's width is larger than normal, like capital letters, but also use some function to see if they entered a bunch of bs and the same letters over and over again... i dont know if that'd work either...
User avatar
William
Forum Contributor
Posts: 332
Joined: Sat Oct 25, 2003 4:03 am
Location: New York City

Post by William »

In other word's I should wait for nay lol :roll:
Post Reply