Domenii
  Top Expert
1 queensoft 95835
2 djbrain 44355
3 subofferul 5220
4 robica 4610
5 krystyana84 3980
  Top Statistici
Membri inscrisi 96335
Intrebari 35399
Raspunsuri 162295
  Contact
nume
email
Introduceti textul din imagine
(pentru evitarea spam-ului):
Numar random
 
introduceti mesajul
email admin: adip.at.myexpert.ro
Consultanta ISO, Audituri Interne - Business Advising Team
Vizualizare intrebare
Intrebare
bullet MODUL ?? SAU SCRIPT de dacia1980
ce ziceti de acest modul
se POATE MODIFICA INCIT SA PROCESEZE O PLATA
ACUMA EL CE FACE DE FAPT


<?php

//  
//
//  ****************************************************
//   THIS IS A PHP PORT OF PERL CC VALIDATION SCRIPT
//  
//    If you want the PERL version of this script, goto
//        www.planetsourcecode.com and search for
//    
//        "Credit Card Format Validation Script"
//
//  ****************************************************
//
//
//  Feel free to use this script all you want, for commercial use,
//  non-commecial use, whatever.
//
//  All I ask is that you keep name up there at the top of the
//  script!  =P
//
//  I wrote this out of necessity one night after about 12 cups of
//  jasmine tea, and I wasn't really in the mood to comment code,
//  but I think any absolutely necessary comments are there.
//
//  Enjoy!
//
//
//
//
//  Use:  IsCCNumberValid($ccNumber, $cardType);
//        If you pass cardType as 0, it will check to see if the given
//           number is valid for any card type.
//  Ex:   IsCCNumberValid("4111111111111111", 0);
//
//  Return Values:  1 'Number Is Valid
//                  0 'Number Is Invalid
//
//
//  Card Types:
//       MASTERCARD.....................1
//       VISA...........................2
//       AMEX...........................3
//       Diners Club / Carte Blanche....4
//       Discover.......................5
//       enRoute........................6
//       JCB............................7
//
//
//
//
//
//  If you specify the card type, it will see if the number is valid for
//  that particular card type, otherwise, it will see if the number fits
//  any of the credit card types.  Since most credit card processing
//  companies don't r==uire you to have the credit card type, it is
//  generally easier just to pass the number, and not the type.  But, if
//  you feel that you want to take the time to gather that one extra field
//  and pass it to this function, then by all means do so!  =)
//
//

$MCRD = 1;
$VISA = 2;
$AMEX = 3;
$DCCB = 4;
$DISC = 5;
$ENRT = 6;
$JCBC = 7;
$retval = 0;

function IsCCNumberValid($ccNumber, $cardType)
{
if($cardType)
{
   if($cardType == $MCRD){$retval = isMCRD($ccNumber);}
   elseif($cardType == $VISA){$retval = isVISA($ccNumber);}
   elseif($cardType == $AMEX){$retval = isAMEX($ccNumber);}
   elseif($cardType == $DCCB){$retval = isDCCB($ccNumber);}
   elseif($cardType == $DISC){$retval = isDISC($ccNumber);}
   elseif($cardType == $ENRT){$retval = isENRT($ccNumber);}
   elseif($cardType == $JCBC){$retval = isJCBC($ccNumber);}
}
else
{
   if(!$retval){$retval = isMCRD($ccNumber);}
   if(!$retval){$retval = isVISA($ccNumber);}
   if(!$retval){$retval = isAMEX($ccNumber);}
   if(!$retval){$retval = isDCCB($ccNumber);}
   if(!$retval){$retval = isDISC($ccNumber);}
   if(!$retval){$retval = isENRT($ccNumber);}
   if(!$retval){$retval = isJCBC($ccNumber);}
}
return $retval;
}

function isMCRD($ccNum)
{
$preFix = substr($ccNum, 0, 2);
if($preFix == 51 ||
   $preFix == 52 ||
   $preFix == 53 ||
   $preFix == 54 ||
   $preFix == 55)
{
   if(strlen($ccNum) == 16){return  modTen($ccNum);}
}
else
{
   return 0;
}
}

function isVISA($ccNum)
{
$preFix = substr($ccNum, 0, 1);
if($preFix == 4){
   if(strlen($ccNum) == 13 || strlen($ccNum) == 16){
   return  modTen($ccNum);}}
else
{
   return 0;
}
}

function isAMEX($ccNum)
{
$preFix = substr($ccNum, 0, 2);
if($preFix == 34 || $preFix == 37){
   if(strlen($ccNum) == 15){
   return  modTen($ccNum);}}
else
{
   return 0;
}
}

function isDCCB($ccNum)
{
$preFix = substr($ccNum, 0, 3);
if($preFix == 300 ||
   $preFix == 301 ||
   $preFix == 302 ||
   $preFix == 303 ||
   $preFix == 304 ||
   $preFix == 305)
{
   if(strlen($ccNum) == 14){return  modTen($ccNum);}
}
else
{
   return 0;
}
$preFix = substr($ccNum, 0, 2);
if($preFix == 36 || $preFix == 38){
   if(strlen($ccNum) == 14){
   return  modTen($ccNum);}}
else
{
   return 0;
}
}

function isDISC($ccNum)
{
$preFix = substr($ccNum, 0, 4);
if($preFix == 6011){
   if(length($ccNum) == 16){
   return  modTen($ccNum);}}
else
{
   return 0;
}
}

function isENRT($ccNum)
{
$preFix = substr($ccNum, 0, 4);
if($preFix == 2014 || $preFix == 2149){
   if(length($ccNum) == 15){
   return  1;}}
else
{
   return 0;
}
}

function isJCBC($ccNum)
{
$preFix = substr($ccNum, 0, 1);
if($preFix == 3){
   if(length($ccNum) == 15 || length($ccNum) == 16){
   return  modTen($ccNum);}}
else
{
   return 0;
}
$preFix = substr($ccNum, 0, 4);
if($preFix == 1800 || $preFix == 2131){
   if(length($ccNum) == 15 || length($ccNum) == 16){
   return  modTen($ccNum);}}
else
{
   return 0;
}
}

function modTen($ccNum)
{
$numLen = strlen($ccNum);
for($x = $numLen; $x > 0; $x-=2){$tot+=substr($ccNum, $x - 1, 1);}
for($x = $numLen - 1; $x > 0; $x-=2)
{
   $y = substr($ccNum, $x - 1, 1) * 2;
   if(strlen($y) == '1'){$tot+=$y;}
   if(strlen($y) == '2'){$tot+=substr($y, 0, 1); $tot+=substr($y, 1, 1); }
}
if(substr($tot, strlen($tot) - 1, 1) == '0'){return 1;}
else{return 0;}
}

?>
Tags:
5
puncte
1549
vizualizari
12-09-2011 16:14:52
Data intrebarii:
(0.00 - 0 voturi)
Ratings: 
Pentru a putea bifa optiunea de notificare in email in cazul adaugarii de comentarii la aceasta intrebare trebuie sa fiti logat.
Daca nu aveti cont, click Aici
Raspunsuri
Comentariul lui:
12-09-2011 16:17:28
Data:
Acest script sau modul, cum vrei tu sa zici, face exact ce spune la inceput: valideaza un numar de card de credit.
Nu are nici o legatura cu plata efectiva.
Tu nici macar nu ai spus ce folosesti pentru procesarea platilor, ce servicii. 
* ComentariuVoturi: 1 Voteaza


Link sponsorizat

Comentariul lui:
12-09-2011 16:17:43
Data:
verifica daca e bun nr de pe card, verifica tipul cardului, si returneaza 0 sau 1 (fals sau adevrat) pentru cardul respectiv 
* ComentariuVoturi: 1 Voteaza

Comentariul lui:
12-09-2011 17:06:48
Data:
si se poate modifica de catre un programator incit sa proceseze o plata la add bank account adica transfer bancar 
* Comentariul autorului


Link sponsorizat

Comentariul lui:
12-09-2011 17:32:35
Data:
Nu, bineinteles.
Este o simpla verificare a unui numar de card.
Procesarea unei plati este mult mai complicata.
Plus ca, de fapt, nici nu prea ai nevoie de acest modul pentru procesarea platii. 
* Raspuns acceptatVoturi: 3 Voteaza

Comentariul lui:
25-09-2011 15:19:06
Data:


|*>
| Nu uita sa acorzi punctele, daca am fost de ajutor. Multumesc anticipat.
| Apare buton "acorda punctele" in dreapta, la 24 de ore dupa intrebare.
|*>
 
* ComentariuVoturi: 1 Voteaza

Link sponsorizat
Raspunde / Comenteaza
Adauga un comentariu / raspuns:
Va rugam sa selectati unul din campuri: Utilizator nou Utilizator inregistrat
Ataseaza fisiere» (Max 200KB)
Filipo berio
Kerry Gold
Cauta lucrari si profesionisti
Call Log Monitor
Unlimited Call Log
SMS and Call Log Backup
Import si distributie produse alimentare serpico