Login   Register  
PHP Classes
elePHPant
Icontem

File: testccclass.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of matthew heald  >  YACC (Yet another credit card validator)  >  testccclass.php  >  Download  
File: testccclass.php
Role: Example script
Content type: text/plain
Description: test container
Class: YACC (Yet another credit card validator)
Validate a credit card and determine its type
Author: By
Last change: This script provides an demonstration of the class.
*** NOTE *** You will need to change the include path to identify where the class library is located.
Date: 10 years ago
Size: 1,765 bytes
 

Contents

Class file image Download
<?PHP
//test script to check the function of the class "credit_card" implemented in cls_CreditCard.php.
include ("./incfiles/cls_CreditCard.php"); //note you will need to modify this to wherever you copy the class to
if (isset($CCNo))
$CC_Data=credit_card::check($CCNo,$VFr,$VTo);
  if (
$CC_Data['Valid']==true) {$cresult="";} else {$cresult="*** NOT ***";}
  if (
$CC_Data['CanAccept']==true) {$aresult="TRUE";} else {$aresult="FALSE";}
  
$out="<h1>Credit card class, test container</h1>
  <p>
  Credit Card: Number is "
.$cresult." valid.<BR>
  Credit Card: "
.$CCNo[0].$CCNo[1].$CCNo[2].$CCNo[3]." ".$CCNo[4].$CCNo[5].$CCNo[6].$CCNo[7]." ".$CCNo[8].$CCNo[9].$CCNo[10].$CCNo[11]." ".$CCNo[12].$CCNo[13].$CCNo[14].$CCNo[15]." <br>
  Index:       "
.$CC_Data['Index']."<br>
  Type:        "
.$CC_Data['Type']."<br>
  Can Accept:  "
.$aresult."<br>";
}
if (isset(
$VFr) or isset($VTo))
{ if (
$CC_Data['VTo']==FALSE) {$VToCode=" is ";} else {$VToCode=" is NOT ";}
  if (
$CC_Data['VFr']==FALSE) {$VFrCode=" is ";} else {$VFrCode=" is NOT ";}
}
$out .= "Issue No / Date from ".$VFrCode." valid<BR>";
$out .= "Date To ".$VToCode." valid</p><HR>";
$out .= "<form name=\"mainform\" action=\"testccclass.php\" method=\"$FrmAct\">";
$out .= "Card No:   <input type=\"text\" name=\"CCNo\" value=\"".$CCNo."\" width=\"30%\"><BR>";
$out .= "Valid From:<input type=\"text\" name=\"VFr\" value=\"".$VFr."\" width=\"30%\"><BR>";
$out .= "Valid To:  <input type=\"text\" name=\"VTo\" value=\"".$VTo."\" width=\"30%\"><BR>";
  
$out .= "<HR><div align=\"center\"><input type=\"submit\" name=\"cmdSearch\" value=\"Go Check\"></div><HR>";
  
$out.="</form>";
?>
<HTML>
<HEAD>
<TITLE>Test container for Credit Card Validation class</TITLE>
</HEAD>
<BODY>
<?PHP echo "$out?>
</BODY>
</html>