Inserting Luhn Algorithm
Posted: Mon Sep 08, 2003 5:16 pm
Hi. Forgive the newbie naivte of this question but I'm in deep and am hoping there's a simple answer. Babtism by fire.
Q: Is it a simple copy & paste of the Luhn Algorithminto this .php form processing page below? I want to verify characters in the Credit Card ($cc_no) field. If so, where? I've tried and I suspect it's more complicated. Examples, shoves in the right direction, are much appreciated. Thanks in advance. Markian
/////////////////////////////////////////////////////////
<body>
<?
if (($name=="")||($street_address=="")||($city=="")||($state=="")||($zip=="")||($country=="")||($email=="")||($transport_program=="")||($cc_no=="")||($exp==""))
{
echo "<font face=verdana size=2>Please fill out the application completely before submitting. To return to the Membership Application Page, press the BACK button on your browser.";
}
else
{
$fp=fopen("../results/memapp.txt", "a") ; //w will append or create a new file
flock($fp, LOCK_EX);//lock the file
fwrite($fp,"$name has applied for Membership.\n\n");
fwrite($fp,"CREDENTIALS:\n");
fputs($fp,"MSN:$msn\n");
fputs($fp,"RN:$rn\n");
fputs($fp,"EMT-P:$emtp\n");
fputs($fp,"CFRN:$cfrn\n");
fputs($fp,"CCN:$ccn\n");
fputs($fp,"CEN:$cen\n\n");
fputs($fp,"OTHER CREDENTIALS:$other_credentials\n\n");
fputs($fp,"STREET ADDRESS: $street_address\n");
fputs($fp,"CITY: $city\n");
fputs($fp,"STATE: $state\n");
fputs($fp,"ZIP: $zip\n");
fputs($fp,"COUNTRY: $country\n");
fputs($fp,"HOME PHONE: $home_phone\n");
fputs($fp,"WORK PHONE: $work_phone\n");
fputs($fp,"EMAIL: $email\n");
fputs($fp,"LICENSE NUMBER: $license_number\n");
fputs($fp,"TRANSPORT PROGRAM: $transport_program\n");
fputs($fp,"PAYMENT METHOD: $payment_method\n");
fputs($fp,"CC#: $cc_no\n");
fputs($fp,"EXP: $exp\n");
fputs($fp,"DESIRED MEMBERSHIP LEVEL: $membership_level\n");
fputs($fp,"APPLICANT STATUS: $applicant_status\n\n");
fwrite($fp,"<%>*<$>*<%>*<%>*<$>*<%>*<%>*<$>*<%>*<%>*<$>*<%>*<%>*<$>*<%>\n\n\n");
flock($fp, LOCK_UN); //unlock the file
fclose($fp);
mail ("info@domain.com", "Membership Application Added", wordwrap("$name has applied for Membership.\nTheir e-mail address is: $email. Applicant information has been received.", 72, "\n", 1), "Return-Path:<info@domain.com>\nFrom: Web Site");
mail ("$email", "Thanks for applying for Membership!", wordwrap ("Thank You, $name, for applying for Membership! An representative will be contacting you. This is an auto-reply generated message. Do Not Respond.", 72, "\n", 1), "Return-Path:
<info@domain.com>\nFrom: domain");
echo "<font face=verdana size=2>Thank You, ". $name . ", for applying for Membership! An representative will be contacting you. To return to the website, click your browser BACK button.";
}
?>
</body>
</html>
Q: Is it a simple copy & paste of the Luhn Algorithminto this .php form processing page below? I want to verify characters in the Credit Card ($cc_no) field. If so, where? I've tried and I suspect it's more complicated. Examples, shoves in the right direction, are much appreciated. Thanks in advance. Markian
/////////////////////////////////////////////////////////
<body>
<?
if (($name=="")||($street_address=="")||($city=="")||($state=="")||($zip=="")||($country=="")||($email=="")||($transport_program=="")||($cc_no=="")||($exp==""))
{
echo "<font face=verdana size=2>Please fill out the application completely before submitting. To return to the Membership Application Page, press the BACK button on your browser.";
}
else
{
$fp=fopen("../results/memapp.txt", "a") ; //w will append or create a new file
flock($fp, LOCK_EX);//lock the file
fwrite($fp,"$name has applied for Membership.\n\n");
fwrite($fp,"CREDENTIALS:\n");
fputs($fp,"MSN:$msn\n");
fputs($fp,"RN:$rn\n");
fputs($fp,"EMT-P:$emtp\n");
fputs($fp,"CFRN:$cfrn\n");
fputs($fp,"CCN:$ccn\n");
fputs($fp,"CEN:$cen\n\n");
fputs($fp,"OTHER CREDENTIALS:$other_credentials\n\n");
fputs($fp,"STREET ADDRESS: $street_address\n");
fputs($fp,"CITY: $city\n");
fputs($fp,"STATE: $state\n");
fputs($fp,"ZIP: $zip\n");
fputs($fp,"COUNTRY: $country\n");
fputs($fp,"HOME PHONE: $home_phone\n");
fputs($fp,"WORK PHONE: $work_phone\n");
fputs($fp,"EMAIL: $email\n");
fputs($fp,"LICENSE NUMBER: $license_number\n");
fputs($fp,"TRANSPORT PROGRAM: $transport_program\n");
fputs($fp,"PAYMENT METHOD: $payment_method\n");
fputs($fp,"CC#: $cc_no\n");
fputs($fp,"EXP: $exp\n");
fputs($fp,"DESIRED MEMBERSHIP LEVEL: $membership_level\n");
fputs($fp,"APPLICANT STATUS: $applicant_status\n\n");
fwrite($fp,"<%>*<$>*<%>*<%>*<$>*<%>*<%>*<$>*<%>*<%>*<$>*<%>*<%>*<$>*<%>\n\n\n");
flock($fp, LOCK_UN); //unlock the file
fclose($fp);
mail ("info@domain.com", "Membership Application Added", wordwrap("$name has applied for Membership.\nTheir e-mail address is: $email. Applicant information has been received.", 72, "\n", 1), "Return-Path:<info@domain.com>\nFrom: Web Site");
mail ("$email", "Thanks for applying for Membership!", wordwrap ("Thank You, $name, for applying for Membership! An representative will be contacting you. This is an auto-reply generated message. Do Not Respond.", 72, "\n", 1), "Return-Path:
<info@domain.com>\nFrom: domain");
echo "<font face=verdana size=2>Thank You, ". $name . ", for applying for Membership! An representative will be contacting you. To return to the website, click your browser BACK button.";
}
?>
</body>
</html>