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.
1. If any word from a list is present in the message, do not send.
2. If more than one URL exists within message, do not send.
Can I do this by creating a variable $msg and checking it with with a string of some sort and check the above?
3. I'd like to submit the msg, without the page reloading.
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.
function realtimeclock() { insert code... }
function cycle()
{
if (document.all || document.getElementById)
setInterval("realtimeclock()",1000)
}
window.onload=cycle
I don't understand the while {} loop in my shoutbox results. Can someone explain the code?
ShoutBox Code
<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 /> <? } ?>
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!!
Edited by kevinoneill, 28 July 2006 - 09:07 PM.