Flash Games
 FAQ   Search   Memberlist   Usergroups   Register  Profile   Log in to check your private messages   Log in 


Registration to newsletter



 

Post new topic   Reply to topic  
   DEVPPL Forum Index -> PHP and MySQL Forum
View previous topic :: View next topic  
Author Message
ebba



Joined: 16 Aug 2004
Posts: 25

PostPosted: Mon Sep 19, 2005 11:39 am    Post subject: Registration to newsletter Reply with quote

I have a page where people can submit to a newsletter. At this point they must send an email to me whith their email address. Can I in somehow make a php-script so they only can enter their email address and I get it via e-mail?
Back to top
View user's profile Send private message
webmaster
Site Admin


Joined: 17 Aug 2004
Posts: 3642
Location: Sweden

PostPosted: Mon Sep 19, 2005 11:59 am    Post subject: Re: Registration to newsletter Reply with quote


 Try something like this:

PHP:
<?php

if(isset($_POST['submit'])) {

   
$to "your@email.com";
   
$subject "Registration to newsletter";
   
$message $_POST['email'];
   
mail($to$subject$message);

   echo 
"You are now registered to the newsletter!";

} else { 
?>

   <form method="post">
   Your e-mail address: <input type="text" name="email" />
   <input type="submit" name="submit" value="send the mail" />

<?php ?>

Back to top
View user's profile Send private message Visit poster's website
Protege
50+ Club


Joined: 19 Sep 2005
Posts: 68
Location: Scotland

PostPosted: Mon Sep 19, 2005 12:08 pm    Post subject: Re: Registration to newsletter Reply with quote

Remember: before you go adding that to a 'live' site it needs some security. If it gets abused then you're up a certain creek without a paddle. Wink
Back to top
View user's profile Send private message Visit poster's website
webmaster
Site Admin


Joined: 17 Aug 2004
Posts: 3642
Location: Sweden

PostPosted: Mon Sep 19, 2005 12:27 pm    Post subject: Re: Registration to newsletter Reply with quote


 
Protege wrote:
Remember: before you go adding that to a 'live' site it needs some security. If it gets abused then you're up a certain creek without a paddle.  Wink
Exactly, some use forms like this to send out spam. I'm not very good at e-mail security and what's possible to do with email-injections in forms. But this is what I use, are there anything I've missed?

PHP:
<?php
$message 
str_replace(array("\\","Content-Type:","bcc:","cc:","MIME-Version:",
"Content-Transfer-Encoding:","%"),"",$message);
?>

Back to top
View user's profile Send private message Visit poster's website
Phate
500+ Club


Joined: 21 Nov 2004
Posts: 818
Location: 127.0.0.1

PostPosted: Mon Sep 19, 2005 6:51 pm    Post subject: Re: Registration to newsletter Reply with quote

what exactly does that do?
Back to top
View user's profile Send private message Send e-mail AIM Address
webmaster
Site Admin


Joined: 17 Aug 2004
Posts: 3642
Location: Sweden

PostPosted: Mon Sep 19, 2005 11:59 pm    Post subject: Re: Registration to newsletter Reply with quote

Phate wrote:
what exactly does that do?
If someone writes "Content-Type:", "bcc:","cc:", "MIME-Version:", "Content-Transfer-Encoding:" or "%" in the message, They will be removed.
Back to top
View user's profile Send private message Visit poster's website
Phate
500+ Club


Joined: 21 Nov 2004
Posts: 818
Location: 127.0.0.1

PostPosted: Tue Sep 20, 2005 5:44 am    Post subject: Re: Registration to newsletter Reply with quote

oh!

thanks very much!
Back to top
View user's profile Send private message Send e-mail AIM Address
Display posts from previous:   
Post new topic   Reply to topic    DEVPPL Forum Index -> PHP and MySQL Forum All times are GMT + 1 Hour
Page 1 of 1

 
 
Welcome to DEVPPL.com
You are not logged in, which means that you can't post in the forums.
Click here to Register

If you are a current member here on DEVPPL, please login below:

User: Pass:
Log me on automatically each visit:

 


Powered by phpBB © 2001, 2005 phpBB Group - Modified by DEVPPL

Flash Games - Sitemap