This is a discussion on Shoutbox , ridding SPAM, adding features, Syntax, explanations of my shoutbox code, help on additional code within the PHP Language forums, part of the PHP Programming Forums category; Below is the code I use for my PHP shoutbox. I can read basic PHP fine, I can read and ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
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 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. HTML Code:
function realtimeclock() { insert code... }
function cycle()
{
if (document.all || document.getElementById)
setInterval("realtimeclock()",1000)
}
window.onload=cycle
someone explain the code? ShoutBox Code 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 />
<? } ?>
my site and reload to test things. How can I go about doing this on my Apple. Thanks Pixel Guys!! |
|
|||
|
Here's where I'm at. I managed to write this much.
Code:
$count = substr_count($message, 'href'); if ($count > 2) die (); to insert it in after the 'message' has been given the value $message, so the content is already shot to the database before it dies.... I need to know how to assign the text inside my text area named 'message' can be assigned as a variable before being sent to the db, and also preventing the info from being sent to the db with out killing all php on the page... |
|
|||
|
Ok this works :D next problem!!
Code:
if($submit)
{
putenv('TZ=America/New_York');
$time=date("F j, Y, g:i a", time());
$count = substr_count($message, 'href');
if ($count < 2) {
$result=MYSQL_QUERY("INSERT INTO shoutbox
(id,name,message,time)".
"VALUES ('NULL','$name', '$message','$time')");
}
}
then say wants to reload the page to see if someone else wrote anything, you get the pop-up box asking "do you want to submit this data again?". Is there a way around that? This stems from my question #3. |
|
|||
|
<ire.kevin@gmail.com> wrote in message news:1153960578.889516.169600@i3g2000cwc.googlegro ups.com... > Here's where I'm at. I managed to write this much. > > Code:
> $count = substr_count($message, 'href'); > > if ($count > 2) > die (); > > Problem is... the die kills the rest of the php on the page, I also had > to insert it in after the 'message' has been given the value $message, > so the content is already shot to the database before it dies.... > > I need to know how to assign the text inside my text area named > 'message' can be assigned as a variable before being sent to the db, > and also preventing the info from being sent to the db with out killing > all php on the page... $message = $_POST['then name of the message field'] ???? Shelly |