Shoutbox , ridding SPAM, adding features, Syntax, explanations of my shoutbox code, help on additional code

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 ...


Go Back   Usenet Forums > PHP Programming Forums > PHP Language

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 07-26-2006
ire.kevin@gmail.com
 
Posts: n/a
Default Shoutbox , ridding SPAM, adding features, Syntax, explanations of my shoutbox code, help on additional code

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
I don't understand the while {} loop in my shoutbox results. Can
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 />

<? } ?>
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!!

Reply With Quote
  #2 (permalink)  
Old 07-27-2006
ire.kevin@gmail.com
 
Posts: n/a
Default Re: Shoutbox , ridding SPAM, adding features, Syntax, explanations of my shoutbox code, help on additional code

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...

Reply With Quote
  #3 (permalink)  
Old 07-27-2006
ire.kevin@gmail.com
 
Posts: n/a
Default Re: Shoutbox , ridding SPAM, adding features, Syntax, explanations of my shoutbox code, help on additional code

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')");
}

}
Maybe you can help me with my other big issue. When my user submits,
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.

Reply With Quote
  #4 (permalink)  
Old 07-27-2006
Shelly
 
Posts: n/a
Default Re: Shoutbox , ridding SPAM, adding features, Syntax, explanations of my shoutbox code, help on additional code


<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


Reply With Quote
  #5 (permalink)  
Old 07-27-2006
ire.kevin@gmail.com
 
Posts: n/a
Default Re: Shoutbox , ridding SPAM, adding features, Syntax, explanations of my shoutbox code, help on additional code

Thanks. I used it in this way

if ($_POST['submit']) { .......rest of code......

Will work yeah?

Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 01:07 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0