_load_plugins(array( array('modifier', 'replace', 'check_cc_number_script.tpl', 144, false),)); ?> function isSwitchSolo(cardType, cardNbr) { var result = false; var switchRules = new Array("490302,490309,18,1","490335,490339,18,1","491101,491102,16,1","491174,491182,18,1","493600,493699,19,1","564182,564182,16,2","633300,633300,16,0","633301,633301,19,1","633302,633349,16,0","675900,675900,16,0","675901,675901,19,1","675902,675904,16,0","675905,675905,19,1","675906,675917,16,0","675918,675918,19,1","675919,675937,16,0","675938,675940,18,1","675941,675949,16,0","675950,675962,19,1","675963,675997,16,0","675998,675998,19,1","675999,675999,16,0"); var soloRules = new Array("633450,633453,16,0","633454,633457,16,0","633458,633460,16,0","633461,633461,18,1","633462,633472,16,0","633473,633473,18,1","633474,633475,16,0","633476,633476,19,1","633477,633477,16,0","633478,633478,18,1","633479,633480,16,0","633481,633481,19,1","633482,633489,16,0","633490,633493,16,1","633494,633494,18,1","633495,633497,16,2","633498,633498,19,1","633499,633499,18,1","676700,676700,16,0","676701,676701,19,1","676702,676702,16,0","676703,676703,18,1","676704,676704,16,0","676705,676705,19,1","676706,676707,16,2","676708,676711,16,0","676712,676715,16,0","676716,676717,16,0","676718,676718,19,1","676719,676739,16,0","676740,676740,18,1","676741,676749,16,0","676750,676762,19,1","676763,676769,16,0","676770,676770,19,1","676771,676773,16,0","676774,676774,18,1","676775,676778,16,0","676779,676779,18,1","676780,676781,16,0","676782,676782,18,1","676783,676794,16,0","676795,676795,18,1","676796,676797,16,0","676798,676798,19,1","676799,676799,16,0"); switch(cardType) { case "SO": thisRules = soloRules; break; case "SW": thisRules = switchRules; break; default : thisRules = new Array(); break; } var ndx; var ruleDetails; var done = false; for(ndx = 0 ; ndx < thisRules.length && !done ; ++ndx) { thisRule = thisRules[ndx]; ruleDetails = thisRule.split(","); var hiPrefix = ruleDetails[0]; var loPrefix = ruleDetails[1]; var valLength = ruleDetails[2]; var issueLength = ruleDetails[3]; var startDateLength = ruleDetails[4]; var cardPrefix = cardNbr.substr(0,hiPrefix.length); if(cardPrefix >= hiPrefix && cardPrefix <= loPrefix) { if(cardNbr.length == valLength) { result = true; done = true; } } } return(result); } /* * This function cheks the checksum of CreditCard * @param cc - the string with credit card number * @param accepted - the array of allowed CC types * if(accepted==null) { all CC types are allowed } */ function isCreditCard(cc,accepted) { cc=String(cc); if(cc.length<4 || cc.length>30) return false; // Start the Mod10 checksum process... var checksum=0; // Add even digits in even length strings or odd digits in odd length strings. for (var location=1-(cc.length%2); location=3000 && t<3060 && l==14) type="Diners Club"; else if(isSwitchSolo("SW",cc.substring(0, cc.length))) type="Switch"; else if(isSwitchSolo("SO",cc.substring(0, cc.length))) type="Solo"; else if(t>=3400 && t<3500 && l==15) type="American Express"; else if(t>=3528 && t<3590 && l==16) type="JCB"; else if(t>=3600 && t<3700 && l==14) type="Diners Club"; else if(t>=3700 && t<3800 && l==15) type="American Express"; else if(t>=3800 && t<3890 && l==14) type="Diners Club"; else if(t>=3890 && t<3900 && l==14) type="Carte Blanche"; else if(t>=4000 && t<5000 && (l==13 || l==16)) type="Visa"; else if(t>=5100 && t<5600 && l==16) type="MasterCard"; else if(t==5610 && l==16) type="Australian BankCard"; else if(t==6011 && l==16) type="Discover/Novus"; else if(t==2014 && l==15) type="enRoute"; else if(t==2149 && l==15) type="enRoute"; else type="not"; // accepted and recognized types are not equal } else { // we don\'t know this card\'s type so pass it as correct return true; } if (accepted[0]==type) accept=true; else accept = false; return accept; } return true; } function checkCCNumber(field_cc,field_accepted) { '; ?> var card_types=new Array(); _sections['card_type'])) unset($this->_sections['card_type']); $this->_sections['card_type']['name'] = 'card_type'; $this->_sections['card_type']['loop'] = is_array($this->_tpl_vars['card_types']) ? count($this->_tpl_vars['card_types']) : max(0, (int)$this->_tpl_vars['card_types']); $this->_sections['card_type']['show'] = true; $this->_sections['card_type']['max'] = $this->_sections['card_type']['loop']; $this->_sections['card_type']['step'] = 1; $this->_sections['card_type']['start'] = $this->_sections['card_type']['step'] > 0 ? 0 : $this->_sections['card_type']['loop']-1; if ($this->_sections['card_type']['show']) { $this->_sections['card_type']['total'] = $this->_sections['card_type']['loop']; if ($this->_sections['card_type']['total'] == 0) $this->_sections['card_type']['show'] = false; } else $this->_sections['card_type']['total'] = 0; if ($this->_sections['card_type']['show']): for ($this->_sections['card_type']['index'] = $this->_sections['card_type']['start'], $this->_sections['card_type']['iteration'] = 1; $this->_sections['card_type']['iteration'] <= $this->_sections['card_type']['total']; $this->_sections['card_type']['index'] += $this->_sections['card_type']['step'], $this->_sections['card_type']['iteration']++): $this->_sections['card_type']['rownum'] = $this->_sections['card_type']['iteration']; $this->_sections['card_type']['index_prev'] = $this->_sections['card_type']['index'] - $this->_sections['card_type']['step']; $this->_sections['card_type']['index_next'] = $this->_sections['card_type']['index'] + $this->_sections['card_type']['step']; $this->_sections['card_type']['first'] = ($this->_sections['card_type']['iteration'] == 1); $this->_sections['card_type']['last'] = ($this->_sections['card_type']['iteration'] == $this->_sections['card_type']['total']); ?> card_types["_tpl_vars['card_types'][$this->_sections['card_type']['index']]['code']; ?> "]="_tpl_vars['card_types'][$this->_sections['card_type']['index']]['type']; ?> "; alert("_run_mod_handler('replace', true, $this->_run_mod_handler('replace', true, $this->_tpl_vars['lng']['txt_cc_number_invalid'], "\n", ' '), "\r", ' '); ?> "); var card_cvv2=new Array(); _sections['card_type'])) unset($this->_sections['card_type']); $this->_sections['card_type']['name'] = 'card_type'; $this->_sections['card_type']['loop'] = is_array($this->_tpl_vars['card_types']) ? count($this->_tpl_vars['card_types']) : max(0, (int)$this->_tpl_vars['card_types']); $this->_sections['card_type']['show'] = true; $this->_sections['card_type']['max'] = $this->_sections['card_type']['loop']; $this->_sections['card_type']['step'] = 1; $this->_sections['card_type']['start'] = $this->_sections['card_type']['step'] > 0 ? 0 : $this->_sections['card_type']['loop']-1; if ($this->_sections['card_type']['show']) { $this->_sections['card_type']['total'] = $this->_sections['card_type']['loop']; if ($this->_sections['card_type']['total'] == 0) $this->_sections['card_type']['show'] = false; } else $this->_sections['card_type']['total'] = 0; if ($this->_sections['card_type']['show']): for ($this->_sections['card_type']['index'] = $this->_sections['card_type']['start'], $this->_sections['card_type']['iteration'] = 1; $this->_sections['card_type']['iteration'] <= $this->_sections['card_type']['total']; $this->_sections['card_type']['index'] += $this->_sections['card_type']['step'], $this->_sections['card_type']['iteration']++): $this->_sections['card_type']['rownum'] = $this->_sections['card_type']['iteration']; $this->_sections['card_type']['index_prev'] = $this->_sections['card_type']['index'] - $this->_sections['card_type']['step']; $this->_sections['card_type']['index_next'] = $this->_sections['card_type']['index'] + $this->_sections['card_type']['step']; $this->_sections['card_type']['first'] = ($this->_sections['card_type']['iteration'] == 1); $this->_sections['card_type']['last'] = ($this->_sections['card_type']['iteration'] == $this->_sections['card_type']['total']); ?> card_cvv2["_tpl_vars['card_types'][$this->_sections['card_type']['index']]['code']; ?> "]="_tpl_vars['card_types'][$this->_sections['card_type']['index']]['cvv2']; ?> "; return true; "12") { alert("Month of expiration date isn\'t correct"); return false; } yy=ed.substring(2,4); // need to change "03" to variable if(yy<"03") { alert("Is this card expired?"); return false; } return true; } '; ?>