Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Programming (http://www.chiefdelphi.com/forums/forumdisplay.php?f=51)
-   -   php/forms/posting/I NEED HELP!!!!!!!!! (http://www.chiefdelphi.com/forums/showthread.php?t=45184)

general 20-03-2006 15:22

Re: php/forms/posting/I NEED HELP!!!!!!!!!
 
woooooooooo, like what happened when i used a swear in the last post.

MattD 20-03-2006 15:41

Re: php/forms/posting/I NEED HELP!!!!!!!!!
 
Quote:

Originally Posted by general
yup that code worked, only two questions is there any way of limiting the words, not the amount, but like not allowing "$@#$@#$@#$@#" to be posted?

And, is there any way to send me an email that says there was a post?

The most straight forward way to censor words posted that I can think of right now is to use the str_ireplace() function before writing the text to the file.

Here's an example of that (this should be in insert.php, before the fwrite() function call, but after the initial assignment of $write):
PHP Code:

$write str_ireplace("badword1""[beep]"$write);
$write str_ireplace("badword2""[beep]"$write);
// .. etc 

What this does is replace every instance of "badword1" and "badword2" with "[beep]"

As for sending an email notification, add this in insert.php (right before the echo "Thanks.." line would be a good spot)
PHP Code:

mail("you@email.com""New Quote""A new quote has been posted."); 


general 20-03-2006 16:21

Re: php/forms/posting/I NEED HELP!!!!!!!!!
 
does the [beep] or whatever have to be in the brakets?

general 20-03-2006 17:21

Re: php/forms/posting/I NEED HELP!!!!!!!!!
 
PHP Code:

<blockquote><p> &quot" . $quote . " &quot; <br />" . "</p><div align=\"right\">" $name "<br />" $teamname "<br /> Team " $teamnumber "</div></p><hr></blockquote>";                    
          
            
//I tried to put it here and it didnt work
        
        
fwrite($hfile$write);            // Write the text
        
fclose($hfile);                    // Close the file 


general 20-03-2006 17:24

Re: php/forms/posting/I NEED HELP!!!!!!!!!
 
PHP Code:

<blockquote><p> &quot" . $quote . " &quot; <br />" . "</p><div align=\"right\">" $name "<br />" $teamname "<br /> Team " $teamnumber "</div></p><hr></blockquote>";                    
          

        
        
fwrite($hfile$write);            // Write the text
        
fclose($hfile);                    // Close the file    
        
        
?>

// the email thing didn't work either

mail("general975@gmail.com", "New Quote", "A new quote has been posted <h ref="http://www.khsfirst.com/quotes.php">CLICK HERE TO SEE IT</a>.");


<script type="text/javascript">
<!--
window.location = "quotes.php";
//-->
</script>

Thanks, your quote has been submitted. <br />
<a href="quotes.php">Please click here if you are not redirected.</a> 


MattD 20-03-2006 17:35

Re: php/forms/posting/I NEED HELP!!!!!!!!!
 
Quote:

Originally Posted by general
PHP Code:

<blockquote><p> &quot" . $quote . " &quot; <br />" . "</p><div align=\"right\">" $name "<br />" $teamname "<br /> Team " $teamnumber "</div></p><hr></blockquote>";                    
          

        
        
fwrite($hfile$write);            // Write the text
        
fclose($hfile);                    // Close the file    
        
        
?>

// the email thing didn't work either

mail("general975@gmail.com", "New Quote", "A new quote has been posted <h ref="http://www.khsfirst.com/quotes.php">CLICK HERE TO SEE IT</a>.");


<script type="text/javascript">
<!--
window.location = "quotes.php";
//-->
</script>

Thanks, your quote has been submitted. <br />
<a href="quotes.php">Please click here if you are not redirected.</a> 


The call to the mail function has to be done before the closing PHP tag ?>. Put it after fclose($hfile).

general 20-03-2006 18:47

Re: php/forms/posting/I NEED HELP!!!!!!!!!
 
Quote:

Originally Posted by MattD
The call to the mail function has to be done before the closing PHP tag ?>. Put it after fclose($hfile).

ok that works, but what a bout the profanity one?

general 20-03-2006 19:06

Re: php/forms/posting/I NEED HELP!!!!!!!!!
 
jk I SOLVED THE PROBLEM HECK YES!

general 20-03-2006 19:16

Re: php/forms/posting/I NEED HELP!!!!!!!!!
 
but another question on the mailto, do i put
PHP Code:

$quote 

if i want to have to quote be in the eamil?

MattD 20-03-2006 19:25

Re: php/forms/posting/I NEED HELP!!!!!!!!!
 
Quote:

Originally Posted by general
but another question on the mailto, do i put
PHP Code:

$quote 

if i want to have to quote be in the eamil?

Yes, that works in the same way as above it with the assignment of $write.

Example:
PHP Code:

mail("you@email.com""Quote Submission""A new quote has been submitted:\r\n\r\n\"" $quote "\""); 


general 20-03-2006 19:30

Re: php/forms/posting/I NEED HELP!!!!!!!!!
 
really i just did it with
PHP Code:

mail("general975@gmail.com""New Quote""A new quote has been posted.  
 
$quote$name$teamname$teamnumber "); 


general 20-03-2006 19:31

Re: php/forms/posting/I NEED HELP!!!!!!!!!
 
Quote:

Originally Posted by MattD
Yes, that works in the same way as above it with the assignment of $write.

Example:
PHP Code:

mail("you@email.com""Quote Submission""A new quote has been submitted:\r\n\r\n\"" $quote "\""); 



whats the \r\n\r\n?

MattD 20-03-2006 19:32

Re: php/forms/posting/I NEED HELP!!!!!!!!!
 
Quote:

Originally Posted by general
whats the \r\n\r\n?

The \r\n\r\n is two line feeds, meaning it would skip a line before showing the quote.

general 20-03-2006 19:33

Re: php/forms/posting/I NEED HELP!!!!!!!!!
 
PHP Code:

mail("general975@gmail.com""New Quote""A new quote has been posted.  
 
$quote$name$teamname$teamnumber  <a href="http://www.khsfirst.com/quotes.php">click here to go to the page</a>"); 

can i do that ^^

MattD 20-03-2006 19:34

Re: php/forms/posting/I NEED HELP!!!!!!!!!
 
Quote:

Originally Posted by general
really i just did it with
PHP Code:

mail("general975@gmail.com""New Quote""A new quote has been posted.  
 
$quote$name$teamname$teamnumber "); 


Yeah, that works too. I just like to explicitly concatenate my strings. (Try saying that 3x fast..)

EDIT: Forgot to mention, the quotes inside of the string literal need to be escaped by preceding them with a \.
PHP Code:

"<a href=\"http://www.khsfirst.com/quotes.php\">click here to go to the page</a>" 



All times are GMT -5. The time now is 22:59.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi