Jump to content

Email Form


piercam03

Recommended Posts

hey, i have some code :

[code]<center>

<form action="" method="post">
Victim Email:<br>
<input type="text" name="recipient" size="25" value="e.g. [email protected]">
<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. [email protected]" 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>
<?php
if ($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>&nbsp;</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.nr

also how can i make it so tht if certain words are entered then it doesnt send
Link to comment
https://forums.phpfreaks.com/topic/13650-email-form/
Share on other sites

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]<?php
if ($_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. [email protected]">
<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. [email protected]" 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>&nbsp;</p>

</body>[/code]
Link to comment
https://forums.phpfreaks.com/topic/13650-email-form/#findComment-52935
Share on other sites

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

It will prevent automated spammers from using your service. Good stuff.
Link to comment
https://forums.phpfreaks.com/topic/13650-email-form/#findComment-52943
Share on other sites

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.
Link to comment
https://forums.phpfreaks.com/topic/13650-email-form/#findComment-52960
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.