| 
	
 | 
 Posted by l3vi on 06/14/48 11:49 
Enjoy! 
 
<form method="post" action="mailinglist.php"> 
Email: <input name="email" type="text" size="25" maxlength="100"> 
Confirm Email: <input name="email2" type="text" size="25" 
maxlength="100"> 
<INPUT type="submit" STYLE="background:#1C721C" VALUE="Submit"></FORM> 
 
<? 
if($_POST['Submit']) 
{ 
	if($_POST['email'] == $_POST['email2']) 
	{ 
		foreach($_POST as $key=>$val){ $form.= $val; } 
		if (eregi("Content-Transfer-Encoding", $form) || 
eregi("Content-Type", $form) || eregi("MIME-Version", $form)|| 
eregi("@YOURDOMAIN.COM",$form)) 
		{ 
			die("Sorry, your input looks like a hacking attempted!"); 
		} 
		foreach($_POST as $var=>$pvar) 
		{ 
			$replace = array('/\n/', '/\r/', '/Bcc:/', '/Cc:/', "/'/", '/"/', 
"/\<\?/", "/\?\>/", '/:/', '/;/'); 
			$nvar=preg_replace($replace, " ", $pvar); 
			$_POST[$var]=$nvar; 
		} 
	mail("YOUR_EMAIL@YOUROMAIN.COM", "SUBJECT", "BODY" , "From: 
".$_POST['email'].""); 
	mail($_POST['email'], "THANKS FOR SUBSCRIBING", "THANK YOU USER FOR 
JOINING MY MAILING LIST" , "From: YOUR_EMAIL@YOUROMAIN.COM"); 
	} else print "Email confirmation does not match!"; 
} 
?> 
 
 
 
Varanus wrote: 
> I'm attempting to set up a form that subscribes people to a mailing 
> list. 
> 
> The way the mailing list works is the user has to send an e-mail to 
> blahblah@blah.com from their e-mail account with "SUBSCRIBE BLAH" in 
> the body of the e-mail. 
> 
> I want to make it easier, and have a form where they just type in their 
> e-mail and it subscribes them to the mailing list. 
> 
> 
> It seemed simple enough for me, but I can't seem to get it right. 
> 
> my PHP code: 
> <? 
> $email = $_REQUEST['email']; 
> $from = "$email"; 
> $body = "SUBSCRIBE CYPHERLOX"; 
> mail( "stserv@list.cypherlox.com", $body, $email ); 
> ?> 
> 
> 
> my form: 
> <form method="post" action="mailinglist.php"> 
> e-mail: <input name="email" type="text" size="25" maxlength="100"> 
> <INPUT type="submit" STYLE="background:#1C721C" VALUE="Submit"></FORM>
 
  
Navigation:
[Reply to this message] 
 |