PHP Classes

File: testccclass.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in Bookmark in
  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: 11 years ago
Size: 1,765 bytes


Class file image Download
//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))
  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>
  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: "
  Type: "
  Can Accept: "
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>";
<TITLE>Test container for Credit Card Validation class</TITLE>
<?PHP echo "$out" ?>