Hallo,
ich habe dieses Kreditkarten Überprüfungsscript. (siehe unten)
Und möchte, wenn die Karte gültig ist, das Formular = die Formularfelder an
http://www.muenchen-hotel.de/formula...nchen-hotel.de weitergeben - posten.
Wer kann mir dabei bitte helfen?
DANKE
Thomas
P.S. Beipsiellink:
www.badeplatz.de/kreditkarte/kreditkarte2.php
<?
$date=time(); /* get current date */
/* Get this year and this month and put them in variables */
$thisyear=date("Y",$date);
$thismonth=date("m",$date);
/* if the card is void then make the form */
if ($carta==0){
?>
<HTML>
<FORM ACTion="<?echo($PHP_SELF); ?>" method=POST>
<p>Name:
<input name="name" type="text" id="name">
</p>
<p>Card Number:
<input type="text" name="carta" >
<BR>
Expiration date:
<?/* Create month names */?>
<select name="month">
<? for ($j=1;$j!=13;$j++){ ?>
<option value="<?echo($j);?>"><? echo(date("M",3600*24*29*$j));?></option>
<? } ?>
</SELECT>
<?/* create a 5 year list from this year */?>
<SELECT name="year">
<? for ($j=2000;$j!=$thisyear+6;$j++){ ?>
<option value="<?echo($j);?>"><? echo($j);?></option>
<? } ?>
</SELECT>
</p>
<P>
<input type="submit">
</form>
<? }
/* If card number is not void then try to validate it */
if ($carta!=0){
/* if the month of exp is passed,this year, card is expired */
/* Remember that the card will never be a year in the past as the year list */
/* has been created starting from $thisyear (see next)*/
if($month<$thismonth and $year==$thisyear) exit("Card has expired!");
$cclen=strlen($carta);
/* Check card number lenght: must be 15 or 13 or 16 */
if ($cclen!=13 and $cclen!=15 and $cclen!=16) exit("Credit card not valid: check
spelling.");
/* Check if the card has a pair or odd number of digits */
/* the % give the rest of a division, like: 5 divided 2 -> give 1 */
if ($cclen%2==0) {
$p=0; } /* PAIR */
else {$p=2;} /* ODD */
/* Get each number of the card and put it in an array */
for($a=0;$a!=$cclen;$a++){
$X[$a]=substr($carta,$a,1);
}
/* Algorithm Mod10 modificated (by me :-) */
for ($nume=($p/2);$nume!=$cclen-$p;$nume=$nume+2){
$X[$nume]=$X[$nume]*2;
if ($X[$nume]>=10) {
$X1=substr($X[$nume],0,1);
$X2=substr($X[$nume],1,1);
$X[$nume]=substr($X[$nume],0,1)+substr($X[$nume],1,1);
}
}
/* Sums each value of the modificated array */
/* Check the result of the algorithm */
for ($i=0;$i!=$cclen;$i++){
$val=$val+$X[$i];
}
/* Please note: if the second number of the result of algorithm is not 0 */
/* then the card is NOT valid */
if ($val==0) exit("Credit Card not valid: check spelling");
if (substr($val,1,1)!=0){ $valida="not";}
echo ("The card: $carta seems to be: $valida valid");
exit();
}
/* This condition in the case $card contains characters */
exit("Maybe the Card Number inserted contains characters ? Only numbers
please!");
?>