I run a contest from my website where ppl fill out an html form to enter.
Required info: fname, lname, phone, location, email, etc..
I wanted to be able to control how many times per day a person can enter the contest (I want it to be ONCE per day!)
Seemed easy enough, for someone that has expert knowledge (aka...not me!)
when my form is submitted - it calls action="file.php"
the php file is set to do a serverside validation.
then, contact mysql database and put all the info into a table.
then, it sends me an email with some info and to let me know someone has entered.
then, my contests started getting bigger and i wanted to control how many entries per day a person could send.
so, i thought, ppl have a unique email address that i can use as my control
so, when a person tries to enter and puts an email into the html form...my php file contacts my database and searchs for that email they just entered. if the email isn't in the table at all, it lets it go thru.
i also have it look at the date of the entries via that email address, if the email address is found and the date matches the current date. bam...no entry and i redirect them to a sorry you can't enter again today html page.
EVERYTHING works awesome...except ONE thing!
case sensitivity of the email address!
i tested this and i just changed one letter to upper case...and...
it went thru...it saw it as a different email address.
can someone help me!
ps. sorry for the long drawn out message! if i knew how to speak in technical terms i would..i just wanted to fully explain everything
(also, i am aware of the most obvious problem! - fake email addresses - one thing at a time)
here is a copy of my php file that my html form calls.
//This page should not be accessed directly. Need to submit the form.
echo "ERROR: You need to submit the form - You do not have permission from WBSnightout.com to see this page!";
$FNAME = $_POST['FNAME'];
$LNAME = $_POST['LNAME'];
$LOCATION = $_POST['LOCATION'];
$PHONE = $_POST['PHONE'];
$EMAIL = $_POST['EMAIL'];
$TRACKING = $_POST['TRACKING'];
$NEWSLETTER = $_POST['NEWSLETTER'];
$ANSWER = $_POST['ANSWER'];
$CONTEST = $_POST['CONTEST'];
$HELPFUL = $_POST['HELPFUL'];
$COMMENTS = $_POST['COMMENTS'];
$TERMS = $_POST['terms'];
$nowdate = date("Y-m-d");
echo "Full Name is Manditory!";
echo "Location is Manditory!";
echo "Phone Number is Manditory!";
echo "Phone Number is Manditory!";
echo "Email is Manditory!";
mysql_connect ("localhost", "username", "pword") or die ('I cannot connect to the database because: ' . mysql_error());
// Get a specific result from the database_table
$result = mysql_query("SELECT * FROM BEAUTYGIVEAWAY
WHERE EMAIL='$EMAIL'") or die(mysql_error());
// get the first and loop until all entries are found with the above result
while($row = mysql_fetch_array($result))
// compare the entry from the form to the result of the sql_table & the date of entry into table
if($EMAIL == $row['EMAIL'] && $nowdate == $row['DATETIME'])
// if no entry that day - insert into sql_table
$query="INSERT INTO BEAUTYGIVEAWAY (ID, DATETIME, FNAME, LNAME, LOCATION, PHONE, EMAIL, TRACKING, NEWSLETTER, ANSWER, FAVBEAUTY, CONTEST_SUG, HELPFUL, COMMENTS, TERMS)VALUES ('NULL', '$nowdate', '$FNAME', '$LNAME', '$LOCATION', '$PHONE', '$EMAIL', '$TRACKING', '$NEWSLETTER', '$ANSWER', '$FAVBEAUTY', '$CONTEST_SUG', '$HELPFUL', '$COMMENTS', '$TERMS')";
mysql_query($query) or die ('Error updating database');
// Start the email
$email_from = 'email@example.com;//<== update the email address
$email_subject = "THIS IS JUST A TEST";
$email_body = "A new Entry for the Cosmetologist Contest has been receieved by the Database. \n".
"The entry has been sent by: \n".
"Name: $FNAME $LNAME \n".
"Phone: $PHONE \n".
$to = "firstname.lastname@example.org";//<== update the email address
$headers = "From: $email_from \r\n";
$headers .= "Reply-To: $email \r\n";
//Send the email!
//done. redirect to thank-you page.
my brain hurts - when i try to ask google this question - it doesn't seem to understand.
if i should post this somewhere else in the forum please let me know...any if you need anything else!