|
Posted by ire.kevin on 07/26/06 22:33
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. :D
[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.
[html]function realtimeclock() { insert code... }
function cycle()
{
if (document.all || document.getElementById)
setInterval("realtimeclock()",1000)
}
window.onload=cycle[/html]
[b]I don't understand the while {} loop in my shoutbox results. Can
someone explain the code?[/b]
[b]ShoutBox Code[/b]
[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 />
<? } ?>
[/code]
[b]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
[color=red]Apple.[/color][/b]
Thanks Pixel Guys!!
Navigation:
[Reply to this message]
|