Contact Us form php issue

Hello
I have a website with an online subscription form in PHP.

Current status:

Step1/- A visitor fills in his name and email address.
Step 2/- Next, I get visitor name and email address inside my INBOX.
Step 3/- Next, I send an email to confirm his email address.
(Like…Just reply me back to confirm your email address etc…)

Current PHP form

[[[ Page with PHP Form Code ]]]



Name*
E-mail*

<input id="submit" type="image" src="images.png"value="submit"

name=“submit” rntsubmit=“true”>


===========================
[[[ Confirmation Page Code ]]]

<?php
$name = $_REQUEST[‘name’] ;
$email = $_REQUEST[‘email’] ;
$body = “A user $name send data \n”.
“Name: $name\n”.
“Email: $email \n”.
mail( "[email protected]", “User Data via Web Form”, $body );
?>

Question:
I want to automate the step 2 and step 3.
Like,… I get visitor data inside my inbox but at the same time website visitor also gets an

automatic email message from my side.

Best wishes,
Dave

Just a guess,

but couldn’t you also send an email to their inbox aswell in step 2, since you have their email address, with a confirmation link to complete their account signup?

Using say their email address in a hash variable to a page on your site to signup their account?
I’ve never set this up before but off the top off my head it would work.

Current status:

Step 1/- A visitor fills in his email address.
Step 2/- Next, I get visitor email address inside my INBOX.
Step 3/- Next, I send him a following email message, manually.
=============Start Message==========
Subject: Verification required - Newsletter Subscription
Body:
Welcome to MY DOMAIN NAME.com
You, or someone using your email address, has applied
at http://mydomainname.com to receive our newsletter

“Just reply us back to confirm your email address”

If this is an error, ignore this email and you will be removed from our
mailing list.

Regards,
http://My Domain Name - Team
============= End Message==========

Current PHP form consist of two pages

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




================================================== [[[ Confirmation Page Code | Page NO.2 SEND.php ]]]

<?php
$email = $_REQUEST[‘email’] ;
mail( "[email protected]", “Newsletter Request”, “From: $email” );
?>

Question:
I want to automate the step 2 and step 3.
Like,… I get visitor Email address inside my inbox but at the same time website visitor also gets an automatic email verification message from my side. I just want that visitor to reply me back to confirm his e-mail address.

What code I write to send an auto-email to $email?

Best wishes,
Dave

[php]<?php
$email = $_REQUEST[‘email’] ;
mail( "[email protected]", “Newsletter Request”, “From: $email” );

mail( “$email”, “Please confirm your email”, “From: $yourdomain” );
?>[/php]

I’m not sure if mail can send twice, but worth a shot.
Then make a php code to confirm is email address in a database on a seperate page and include that link in his email he gets. such as, emailconfirm.php?e=(his email address)(or a hash of it)

Hi

I did a little search about headers and my problem has solved.
My PHP script is working fine. Thanks to good forum and quick members.

Now, there is another issue. It is about security!
I have heard that spammers use php code injection, malicious script and do spamming.

How can I secure this simple two pages php form?

Best wishes,
Dave

Current PHP form consist of two pages

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




================================================= [[[ Confirmation Page Code | Page NO.2 SEND.php ]]] <?php $email = $_REQUEST['email'] ; mail( "[email protected]", "Newsletter Request", "From: $email" ); ?> <?php $subject="Verification required - Newsletter Subscription"; $body =" Welcome to MY DOMAIN NAME.com You, or someone using your email address, has applied at http://mydomainname.com to receive our newsletter Just reply us back to confirm your email address If this is an error, ignore this email and you will be removed from our mailing list. Regards, http://My Domain Name - Team "; $headers = 'From: [email protected]' . "\r\n" . 'Reply-To: [email protected]' . "\r\n" . 'X-Mailer: PHP/' . phpversion(); mail( $email, $subject, $body, $headers ); ?>

=================================================

Use a captive image field.

Easiest way is to write on an image a string of characters using php and then compare it to the users input in the form.

[php]
$im = imagecreate(*width, *height);
$bg = imagecolorallocate($im, *hex, *hex, *hex);
$text_color = imagecolorallocate($im, *hex, *hex, *hex);

// Center the text
CenterImageString($im, 120, captivetext, 3, 3, $text_color);
// Output the image
imagepng($im, ‘captiveimg.png’);

// Free up memory
imagedestroy($im);

function CenterImageString($image, $image_width, $string, $font_size, $y, $color)
{
$text_width = imagefontwidth($font_size)*strlen($string);
$center = ceil($image_width / 2);
$x = $center - (ceil($text_width/2));
ImageString($image, $font_size, $x, $y, $string, $color);
return true;
} [/php]
All you have to do is write the code to output a string to the image and compare the imagetext and the user input.

Sponsor our Newsletter | Privacy Policy | Terms of Service