Posted on Friday 3rd August 2007 at 02:05 PM | |
Diablosblizz Senior Member |
Hey, I recoded my own shoutbox, and it only displays one post, but there are two posts in the database: Code <?php session_start(); include("config.php"); include("bbcode12.php"); if($logged[username]) { switch($_GET[page]) { default: echo "<script language=\"JavaScript\"> function refresh() { setTimeout('dorefresh()', 30000); } function dorefresh() { window.location.reload(); } </script><body onLoad='refresh()'>"; $getcount = mysql_query("SELECT * FROM `shoutbox` ORDER BY `id` LIMIT 0, 15"); $getnum = mysql_num_rows($getcount); if($getnum == 0) { echo "There are no shoutbox posts."; } else { $getcount = mysql_query("SELECT * FROM `shoutbox` ORDER BY `id` LIMIT 0, 15"); $t = mysql_fetch_array($getcount); echo "<a href='members.php?user=$t[by]'>$t[by]</a>: $t[message]"; } break; case 'post': if($logged[username] && $_POST[tag]) { if(empty($_POST[message])) { echo "You need to enter a message to submit!"; } else { $user = $logged[username]; $msg = htmlspecialchars(stripslashes($_POST[message])); $insert = mysql_query("INSERT INTO `shoutbox` (`by`, `message`) VALUES ('$user','$msg')"); echo "<meta http-equiv='refresh' content='0;url=box.php'>Shout Posted."; } } if($logged[username] && !$_POST[tag]) { echo "Unknown error, please go back and try again!"; } break; } } else { echo "Sorry, you must be logged in to post!"; } ?> Shadow, you said to get rid of the limit in the shoutbox and it still did not work. Anybody have any ideas? Thanks! |
Posted on Friday 3rd August 2007 at 09:55 PM | |
SkillMaster Senior Member |
Talk to you on msn. |
Posted on Saturday 4th August 2007 at 01:05 AM | |
Diablosblizz Senior Member |
Question also, how do I make a "swearing filter"? :S I tried the code below: Code function swear($content) { $content = nl2br($content); $replacement = "bobba"; $file = 'badwords.txt'; $words = file($file); return preg_replace($words, $replacement, $content); } And I get: Code Warning: preg_replace() [function.preg-replace]: Delimiter must not be alphanumeric or backslash in C:\Program Files\xampplite\htdocs\members\bbcode12.php on line 39 I want the swear words to be in badwords.txt if possible. Thanks! |
Posted on Saturday 4th August 2007 at 02:06 AM | |
ShadowMage Senior Member |
try str_replace instead? |
Posted on Saturday 4th August 2007 at 02:56 AM | |
Diablosblizz Senior Member |
I was able to fix this by Skill. :) ANOTHER ANOTHER QUESTION: -.-'' Is it possible to have a PHP date go 30 minutes into the future? I want to add a timer ban to my site and I want the php to go 30 minutes into the future by using this time format: PHP Code
1
$today = date("h:i A");
I don't want to type in the date (like Shadows tutorial). I want it to be automatic because it is a racist filter on my shoutbox and I want it to automatically ban. Is this possible? Thanks! |
Posted on Saturday 4th August 2007 at 08:41 PM | |
SkillMaster Senior Member |
i was going to suggest Code $m = date("A"); $unban = $today + 0:30$m; Dunno |