piercam03 Posted July 4, 2006 Share Posted July 4, 2006 hey, i have some code :[code]<center><form action="" method="post">Victim Email:<br><input type="text" name="recipient" size="25" value="e.g. name@domain.com"><br>Sender Name: <br><input type="text" name="name" value="e.g. Charles Ray" size="25"><br>Sender Email: <br><input type="text" name="email" value="e.g. name@domain.com" size="25"><br>Subject: <br><input type="text" name="subject" size="25" value="e.g. hello!"><br>Text:<br><textarea name="message" cols="20" rows="6">Enter the message body here</textarea><br><input type="submit" name="submit" value="Send"><br><br><?phpif ($submit) { if($name && $subject && $email && $message ) { mail("$recipient","$subject","$message","From: $name <$email>") or die("email error");echo "Message Sent"; /} else {echo "All fields must be filled in!<BR>";}} // end php submission code?></form><body><p> </p></body>[/code]What it lets you do is send email form the web using a simple form.i am currently gettin so many people usin it that i am crashing my hosts servers and i was wondering if anyone knew hot to make it once sent that a cookie is put on your system disableing you from sendin another message untill the cookie expires (5 mins)thanks.to visit go to www.anonymail.co.nralso how can i make it so tht if certain words are entered then it doesnt send Quote Link to comment https://forums.phpfreaks.com/topic/13650-email-form/ Share on other sites More sharing options...
Orio Posted July 4, 2006 Share Posted July 4, 2006 Your code had many errors, so I fixed them. Make sure this is at the top of the page, and the html is after the closing ?>.[code=php:0]<?phpif ($_POST['submit']) { if(isset($_COOKIE['email'])){die("Error- System flood- please wait at least 5 minutes between each mail.");};setcookie("email","1",60*5);if(isset($_POST['name']) && isset($_POST['subject']) && isset($_POST['email']) && isset($_POST['message']) ) { $headers="From: ".$name." <".$email.">";mail($_POST['recipient'],$_POST['subject'],$_POST['message'],$headers) or die("email error");echo "Message Sent"; /} else {echo "All fields must be filled in!<BR>";}} // end php submission code?><center><form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="POST">Victim Email:<br><input type="text" name="recipient" size="25" value="e.g. name@domain.com"><br>Sender Name: <br><input type="text" name="name" value="e.g. Charles Ray" size="25"><br>Sender Email: <br><input type="text" name="email" value="e.g. name@domain.com" size="25"><br>Subject: <br><input type="text" name="subject" size="25" value="e.g. hello!"><br>Text:<br><textarea name="message" cols="20" rows="6">Enter the message body here</textarea><br><input type="submit" name="submit" value="Send"><br><br></form><body><p> </p></body>[/code] Quote Link to comment https://forums.phpfreaks.com/topic/13650-email-form/#findComment-52935 Share on other sites More sharing options...
piercam03 Posted July 4, 2006 Author Share Posted July 4, 2006 i just get an error :Parse error: syntax error, unexpected '/' in /home/iplaynee/public_html/main.php on line 11 Quote Link to comment https://forums.phpfreaks.com/topic/13650-email-form/#findComment-52938 Share on other sites More sharing options...
michaellunsford Posted July 4, 2006 Share Posted July 4, 2006 delete the trailing slash behind "message sent"; on line eleven. of the code.You might also consider captcha. Andy B's method is awesome, here:http://www.digitalmidget.com/php_noob/captcha.phpIt will prevent automated spammers from using your service. Good stuff. Quote Link to comment https://forums.phpfreaks.com/topic/13650-email-form/#findComment-52943 Share on other sites More sharing options...
piercam03 Posted July 4, 2006 Author Share Posted July 4, 2006 i deleted the / anmd it sent the message but it doesnt stop me from resending another one Quote Link to comment https://forums.phpfreaks.com/topic/13650-email-form/#findComment-52951 Share on other sites More sharing options...
Orio Posted July 4, 2006 Share Posted July 4, 2006 Maybe your computer is blocking cookies. If it's bots that flood your server, use captcha like michaellunsford told you.But if it's people, you could have a table with IP addresses (everytime a form is sent your IP is added to the table). And that table deletes old records every 5 mins using a cron job.Orio. Quote Link to comment https://forums.phpfreaks.com/topic/13650-email-form/#findComment-52960 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.