473,386 Members | 1,745 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Email confirmation via sum

Several of my websites are getting hosed by automated scripts that insert
all kinds of jiberish into the forms and newsletter sign-up fields.
Sometimes I get a hundred an hour.

I noticed the other day http://www.emailbattles.com has a nice method to
confirm "Add Comments" forms are filled in by a person. They put a field in
the form that requires you to add two numbers and give the sum.

I'm not a php guru but I can tinker. Below is one of the newsletter sign-up
forms. Can someone show me how to add the ability to do what
EmailBattles.com does with their forms?

----------------------------------------

<HTML>

Enter your email address to subscribe</font><p>

<form method="post"
action="http://www.sitename.org/lists/lhpc-list-news.php"

Sitename.org Newsletter <a
href="http://www.sitename.org/pages.php?page=Newsletter-Registration">(details)</a><br>

<input type="text" name="Email" size="20">

<input type="submit" name="Submit" value="Go"></form>

</HTML>

----------------------------------------

<PHP>

<?
if (!isset($Email)) {
header( "Location: http://www.sitename.org/pages.php?page=Thanks" );
}
elseif (($Email == "")) {
header( "Location: http://www.sitename.org/pages.php?page=Error" );
}
else {
mail( "re*******@sitename.org", "New Subscriber",
"[News] New Subscriber
--------------------------------------------
$Email",

"From: $Email");
mail( "ne************@sitename.org", "", "","From: $Email");
header( "Location: http://www.sitename.org/pages.php?page=Thanks" );
}
?>

</PHP>
Thanks for the help.

BTW, if the above is a sloppy method for a sign-up field for a newsletter
feel free to let me know.
--

Ken

_____________________________________
Kenneth Farmer <>< 336-736-7376

Nov 29 '05 #1
3 1601
"Krustov" <kr****@krustov.co.uk.INVALID> wrote in message
news:MP************************@no-cancel.newsreader.com...
<comp.lang.php , Kenneth Farmer , kf*****@NOSPAM.spyderbyte.com>
<x6********************@twister.southeast.rr.com >
<Tue, 29 Nov 2005 00:17:33 GMT>
I'm not a php guru but I can tinker. Below is one of the newsletter
sign-up
forms. Can someone show me how to add the ability to do what
EmailBattles.com does with their forms?


Too late at night - but this should get you started .
$z1=(rand()%9)+1;
$z2=(rand()%9)+1;

$z3=$z1+$z2;

$z1 + $z2 = <input type="text" name="summ" size="25">

<input type="hidden" name="demo" size="0" value="<?php print $z3; ?>">
On the next page .....

$aaa=$_POST['summ'];
$bbb=$_POST['demo'];

if ($aaa<>$bbb) {print "take a hike spammer <br>";}

Thanks for your help.

I'm afraid I don't know how to add it to the form and php script. :(

Here's the form and script again.
----------------------------------------

<HTML>

Enter your email address to subscribe</font><p>
<form method="post"
action="http://www.sitename.org/lists/lhpc-list-news.php"
<input type="text" name="Email" size="20">
<input type="submit" name="Submit" value="Go"></form>

</HTML>

----------------------------------------

<PHP>

<?
if (!isset($Email)) {
header( "Location: http://www.sitename.org/pages.php?page=Thanks" );
}
elseif (($Email == "")) {
header( "Location: http://www.sitename.org/pages.php?page=Error" );
}
else {
mail( "re*******@sitename.org", "New Subscriber",
"[Newsletter] New Subscriber

$Email",

"From: $Email");
mail( "ne************@sitename.org", "", "","From: $Email");
header( "Location: http://www.sitename.org/pages.php?page=Thanks" );
}
?>

</PHP>

----------------------------------------
Thanks again to anyone who can help.

Ken

_____________________________________
Kenneth Farmer <>< 336-736-7376

Nov 29 '05 #2
"Krustov" <kr****@krustov.co.uk.INVALID> wrote in message
news:MP************************@no-cancel.newsreader.com...
<comp.lang.php , Kenneth Farmer , kf*****@NOSPAM.spyderbyte.com>
<5d********************@twister.southeast.rr.com >
<Tue, 29 Nov 2005 14:03:45 GMT>
> if ($aaa<>$bbb) {print "take a hike spammer <br>";}

Thanks for your help.

I'm afraid I don't know how to add it to the form and php script. :(

Here's the form and script again.


Should have been the following anyway :-)

if ($aaa<>$bbb) {print "take a hike spammer <br>"; exit;}
From what I can gather people on here dont mind helping others but they
arnt too keen on writing things for others as the other person will
never learn anything if they do .

You said in your original post you had basic tinkering skills and if you
arnt at least willing to have go and say what part you get stuck on then
your only hope is somebody on here will write the full thing for you .

:)

Ok, I'll give it a shot.

Ken

_____________________________________
Kenneth Farmer <>< 336-736-7376

Nov 29 '05 #3
Kenneth Farmer wrote:
Several of my websites are getting hosed by automated scripts that insert
all kinds of jiberish into the forms and newsletter sign-up fields.
Sometimes I get a hundred an hour.

<snip>

Google for Captcha and turning number.

--
<?php echo 'Just another PHP saint'; ?>
Email: rrjanbiah-at-Y!com Blog: http://rajeshanbiah.blogspot.com/

Dec 2 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Jeebu | last post by:
hi, let me explain my problem with a scenario. after completing a registration procees of a user ,an email will be sent to the user for confirmation.the email contains a link and when the user...
5
by: Mark A. Sam | last post by:
Hello, I am sending two emails from the same procedure, one to myself (while testing) and another (a comfirmation) to the user on the website. I was having difficulty finding a relay server to...
4
by: Ken D. | last post by:
I have an asp page that collects data on referrals. The user inputs the information and selects the rep to receive the referral. My data is being saved to a backend database (SQL) and the user is...
2
by: Tatyana | last post by:
Hello, I'm having problems to Style Order Confirmation Email Body. I'm sending it out as HTML. Everything looks fine in Outlook, but hotmail accounts (checked it on yahoo and hotmail) seem to...
23
by: codefire | last post by:
Hi, I am trying to get a regexp to validate email addresses but can't get it quite right. The problem is I can't quite find the regexp to deal with ignoring the case james..kirk@fred.com, which...
2
by: Nathan Sokalski | last post by:
I have an ASP.NET 2.0 application that is supposed to send an email after a certain form is submitted. When it tries to send the email, I receive the following error: Transaction failed. The...
2
by: kaka | last post by:
I am developping a sns site. I was wondering if i send user's email addresses as a part of confirmation link so that when a user receives the confirmation email, he can just click on the link to...
5
stepterr
by: stepterr | last post by:
Hi Everyone, I'm new to PHP and have been working on an existing from that had been in Coldfusion but needed to be converted to PHP. I have most of it working except I ran into a problem when...
28
tdw
by: tdw | last post by:
Hi all, I am trying to add a feature to our database that automates sending emails. When entering a new order, I want the option to send an email to the company the order came from, attaching a...
8
by: nargis2009 | last post by:
Hi, I have been encountering problems with my web page which is supposed to send email, and wondered if anybody can help find error. Initially I had all codes in one page and on click of...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.