i am trying to do credit card validation. the card details are entered n creditcard.php and process in creditcard-process.php
and this is the error for creditcard-process.php.. can i check whats wrong with creditcard-process.php ?
Notice: Use of undefined constant ccnum - assumed 'ccnum' in D:\xampp\htdocs\book\creditcard-process.php on line 109
Notice: Undefined variable: POST_ in D:\xampp\htdocs\book\creditcard-process.php on line 109
Notice: Use of undefined constant cardtype - assumed 'cardtype' in D:\xampp\htdocs\book\creditcard-process.php on line 109
Notice: Undefined variable: POST_ in D:\xampp\htdocs\book\creditcard-process.php on line 109
Notice: Undefined variable: verified in D:\xampp\htdocs\book\creditcard-process.php on line 73
Notice: Undefined variable: denum in D:\xampp\htdocs\book\creditcard-process.php on line 75
Credit card invalid. Please make sure that you entered a valid credit card
<?php
session_start();
if (!(isset($_SESSION['email']) && $_SESSION['email'] != '')) {
header ("Location: login.php");
}
?>
<?php
include ('includes\header.php');
//function validateCC($cc_num, $type) {
function validateCC($cc_num, $type) {
if($type == "American") {
$denum = "American Express";
} elseif($type == "Dinners") {
$denum = "Diner's Club";
} elseif($type == "Discover") {
$denum = "Discover";
} elseif($type == "Master") {
$denum = "Master Card";
} elseif($type == "Visa") {
$denum = "Visa";
}
if($type == "American") {
$pattern = "/^([34|37]{2})([0-9]{13})$/";//American Express
if (preg_match($pattern,$cc_num)) {
$verified = true;
} else {
$verified = false;
}
} elseif($type == "Dinners") {
$pattern = "/^([30|36|38]{2})([0-9]{12})$/";//Diner's Club
if (preg_match($pattern,$cc_num)) {
$verified = true;
} else {
$verified = false;
}
} elseif($type == "Discover") {
$pattern = "/^([6011]{4})([0-9]{12})$/";//Discover Card
if (preg_match($pattern,$cc_num)) {
$verified = true;
} else {
$verified = false;
}
} elseif($type == "Master") {
$pattern = "/^([51|52|53|54|55]{2})([0-9]{14})$/";//Mastercard
if (preg_match($pattern,$cc_num)) {
$verified = true;
} else {
$verified = false;
}
} elseif($type == "Visa") {
$pattern = "/^([4]{1})([0-9]{12,15})$/";//Visa
if (preg_match($pattern,$cc_num)) {
$verified = true;
} else {
$verified = false;
}
}
if($verified == false) {
//Do something here in case the validation fails
echo "Credit card invalid. Please make sure that you entered a valid <em>" . $denum . "</em> credit card ";
} else { //if it will pass...do something
echo "Your <em>" . $denum . "</em> credit card is valid";
}
}
?>
<div id="central_content">
<!-- BEGIN central slogan and rss feed -->
<!-- <div class="rss">Stay tuned with our<a href="#">Feed RSS</a>
<div id="rss_logo"></div>
</div> -->
<div class="question1 ha">Credit Card Payment</div>
<!-- <div class="question2 ha">New</div>
<div class="question1 ha">Here?</div> -->
<div style="clear:both;"></div>
<div class="slogan">Please enter your credit card detailst</div>
<br />
<br />
<!-- END central slogan and rss feed -->
<!-- BEGIN central products -->
<div class="central_products">
<span class="slogan" style="padding-top: 12px">
<?
echo validateCC($POST_[ccnum],$POST_[cardtype]);
//echo validateCC("1738292928284637", "Dinners");
?>
</span>
</div>
<?php
include ('includes\footer.html');
?>