PHP Developers Network

A community of PHP developers offering assistance, advice, discussion, and friendship.
 
Loading
It is currently Mon Sep 23, 2019 8:31 am

All times are UTC - 5 hours




Post new topic Reply to topic  [ 8 posts ] 
Author Message
PostPosted: Thu Apr 05, 2012 12:28 pm 
Offline
Forum Newbie

Joined: Thu Apr 05, 2012 12:24 pm
Posts: 1
Hello
I have a website with an online email newsletter subscription form in PHP.

Current status:

Step1/- A visitor fills in his email address.
Step 2/- Next, I get visitor email address inside my INBOX.

Current PHP form consist of two pages

================================================
[[[ Page with PHP Form Code | Page NO.1 Formpage.php ]]]

<html><body>
<form name="myform" method="post" action="SEND.php"><br>

<input name="email" type="text" id="email" />


<input type="submit" name="Submit" value="Submit" />
</form>
</body></html>
================================================
[[[ Confirmation Page Code | Page NO.2 SEND.php ]]]

<?php
$email = $_REQUEST['email'] ;
mail( "myemail@mydomain.com", "Newsletter Request", "From: $email" );
?>
================================================
I have heard about php code injection, malicious script and spam.
How can I secure this simple php two pages form?

Best wishes,
Dave
============


Top
 Profile  
 
PostPosted: Thu Apr 05, 2012 6:09 pm 
Offline
DevNet Master
User avatar

Joined: Sun Feb 15, 2009 12:08 pm
Posts: 2794
Location: .za

_________________
“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” - Mosher’s Law of Software Engineering


Top
 Profile  
 
PostPosted: Thu Apr 05, 2012 6:14 pm 
Offline
Moderator
User avatar

Joined: Tue Nov 09, 2010 3:39 pm
Posts: 6425
Location: Montreal, Canada

_________________


Top
 Profile  
 
PostPosted: Fri Apr 06, 2012 12:30 am 
Offline
DevNet Master
User avatar

Joined: Sun Feb 15, 2009 12:08 pm
Posts: 2794
Location: .za

_________________
“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” - Mosher’s Law of Software Engineering


Top
 Profile  
 
PostPosted: Fri Apr 06, 2012 6:31 am 
Offline
Moderator
User avatar

Joined: Tue Nov 09, 2010 3:39 pm
Posts: 6425
Location: Montreal, Canada
A simple honeypot can consist of a form field hidden by CSS. Humans won't see it, so they won't fill it in. Bots will see it, however, and tend to fill in everything. If that field contains data, discard the post.

_________________


Top
 Profile  
 
PostPosted: Fri Apr 06, 2012 5:28 pm 
Offline
DevNet Master
User avatar

Joined: Sun Feb 15, 2009 12:08 pm
Posts: 2794
Location: .za
Ah ok; thanks for the idea :)

_________________
“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” - Mosher’s Law of Software Engineering


Top
 Profile  
 
PostPosted: Thu Apr 26, 2012 7:37 am 
Offline
Forum Contributor

Joined: Fri Dec 24, 2010 1:48 am
Posts: 143
Location: India
Thanks Celauran for the idea of honeypot..:D


Top
 Profile  
 
PostPosted: Thu Apr 26, 2012 10:07 am 
Offline
Forum Contributor

Joined: Tue Apr 17, 2012 12:57 pm
Posts: 160


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 8 posts ] 

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 5 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group