Shoutbox , ridding SPAM, adding features, Syntax, explanatio
Posted: Wed Jul 26, 2006 6:24 pm
feyd | Please use
I don't understand the while {} loop in my shoutbox results. Can someone explain the code?
ShoutBox Code[/syntax]
4. I want to install PHP on my computer so I don't have to upload to my site and reload to test things. How can I go about doing this on my Apple.
Thanks Pixel Guys!!
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
Below is the code I use for my PHP shoutbox. I can read basic PHP fine, I can read and code basic VBA.
Here's what I need help on. Reply to any you know how to work.
[b]1. If any word from a list is present in the message, do not send.[/b]
[b]2. If more than one URL exists within message, do not send.[/b]
Can I do this by creating a variable $msg and checking it with with a string of some sort and check the above?
[b]3. I'd like to submit the msg, without the page reloading.[/b]
Using something like this to reload the Div containing the shoutbox results (I use this for a real time clock I coded in JS). Very open to other ideas.
[syntax="javascript"]function realtimeclock() { insert code... }
function cycle()
{
if (document.all || document.getElementById)
setInterval("realtimeclock()",1000)
}
window.onload=cycleShoutBox Code[/syntax]
Code: Select all
<form action="<? echo $php_self ?>" method="post">
<input id="name" type='text' value='' name='name' />
<input type="submit" name="submit" value="Submit" />
<textarea rows="2" cols="35" name='message'></textarea>
</form>
<?
mysql_connect("localhost","xxxx","xxxx");
mysql_select_db("xxxx");
if($submit)
{
putenv('TZ=America/New_York');
$time=date("F j, Y, g:i a", time());
$result=MYSQL_QUERY("INSERT INTO shoutbox (id,name,message,time)".
"VALUES ('NULL','$name', '$message','$time')");
}
$result = mysql_query("select * from shoutbox order by id desc limit 40");
while($r=mysql_fetch_array($result))
{
$time=$r["time"];
$id=$r["id"];
$message=$r["message"];
$name=$r["name"];
?>
<? echo $name ?><br />
<? echo $time ?><br />
<? echo $message ?><br />
<? } ?>Thanks Pixel Guys!!
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]