0

0

php实现通用的信用卡验证类

php中文网

php中文网

发布时间:2016-06-06 20:05:59

|

1418人浏览过

|

来源于php中文网

原创

这篇文章主要介绍了php实现通用的信用卡验证类,涉及信用卡的规则与php字符串操作的相关技巧,具有一定参考借鉴价值,文中有英文原文注释说明,有助于更直观的了解源

本文实例讲述了php实现通用的信用卡验证类。分享给大家供大家参考。

原文说明如下:

Credit Card Validation Solution (PHP Edition)
Version 3.5

Description
Credit Card Validation Solution™ uses a four step process to ensure credit card numbers are keyed in correctly. This procedure accurately checks cards from American Express, Australian BankCard, Carte Blache, Diners Club, Discover/Novus, JCB, MasterCard and Visa.
For more information, please read the comments in the code itself.

Installation Instructions
Select the text between the two lines indicated, below.
Copy the text.
Open up a text editor.
Paste the text.
Save that file. When saving it, make sure to:
save it in a directory on your webserver, and
name it with an extension that your server will recognize needs parsing by PHP.
To see it in action, open up that file in your web browswer.

具体代码如下:

天天团购系统
天天团购系统

天天团购系统是一套强大的开源团购程序,采用PHP+mysql开发,系统内置支付宝、财付通、GOOGLE地图等接口,支持短信发送团购券和实物团购快递发货等;另外可通过Ucenter模块,与网站已有系统无缝整合,实现用户同步注册、登陆、退出。 天天团购系统是一套创新的开源团购程序,拥有多达10项首创功能,同时支持虚拟和实物团购,内置类似淘宝的快递配送体系,并提供强大的抽奖、邀请返利等营销功能,让您轻松

下载

= 3000 and $NumberLeft = 3600 and $NumberLeft = 3800 and $NumberLeft = 3400 and $NumberLeft = 3700 and $NumberLeft = 3528 and $NumberLeft = 3890 and $NumberLeft = 4000 and $NumberLeft 14) { $ShouldLength = 16; } elseif ($NumberLength The Visa number entered, $Number, in is 14 digits long.
Visa cards usually have 16 digits, though some have 13.
Please check the number and try again.

n"; return FALSE; } } elseif ($NumberLeft >= 5100 and $NumberLeft The first four digits of the number entered are $NumberLeft.
If that's correct, we don't accept that type of credit card.
If it's wrong, please try again.

n"; return FALSE; } # 3) Is the number the right length? if ($NumberLength $ShouldLength) { $Missing = $NumberLength - $ShouldLength; if ($Missing The $CardName number entered, $Number, is missing " . abs($Missing) . " digit(s).
Please check the number and try again.

n"; } else { echo "
The $CardName number entered, $Number, has $Missing too many digit(s).
Please check the number and try again.

n"; } return FALSE; } # 4) Does the number pass the Mod 10 Algorithm Checksum? if (Mod10Solution($Number) == TRUE) { return TRUE; } else { echo "
The $CardName number entered, $Number, is invalid.
Please check the number and try again.

n"; return FALSE; } } function OnlyNumericSolution ($Number) { # Remove any non numeric characters. # Ensure number is no more than 19 characters long. return substr( ereg_replace( "[^0-9]", "", $Number) , 0, 19); } function Mod10Solution ($Number) { $NumberLength = strlen($Number); $Checksum = 0; # Add even digits in even length strings # or odd digits in odd length strings. for ($Location = 1 - ($NumberLength % 2); $Location The $CardName number entered, $Number, is valid.
n"; } } else { $Number = ""; } # Setup an input form. Posting it calls this page again. echo "

n"; echo "
Credit Card Number: n"; echo "n"; echo "

n"; # # ------------ END SAMPLE USER INTERFACE SECTION ------------- ?>

希望本文所述对大家的php程序设计有所帮助。

360借条
360借条

3分钟审核,最快5分钟放款,极速到账,低服务费,年化综合息费率7.2%起。

下载

相关标签:

php

本站声明:本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn

相关专题

更多
PPT动态图表制作教程大全
PPT动态图表制作教程大全

本专题整合了PPT动态图表制作相关教程,阅读专题下面的文章了解更多详细内容。

13

2026.01.07

c++ Libcurl用法详解
c++ Libcurl用法详解

本专题整合了c++ Libcurl用法详解,阅读专题下面的文章了解更多详细内容。

0

2026.01.07

c++ Libcurl用法大全
c++ Libcurl用法大全

本专题整合了c++ Libcurl用法详解,阅读专题下面的文章了解更多详细内容。

0

2026.01.07

C++ vector用法汇总
C++ vector用法汇总

本专题整合了C++中vector的用法大全,阅读专题下面的文章了解更多详细内容。

2

2026.01.07

C++ vector用法大全
C++ vector用法大全

本专题整合了C++中vector的用法大全,阅读专题下面的文章了解更多详细内容。

0

2026.01.07

2026年漫蛙最新官网地址
2026年漫蛙最新官网地址

漫蛙官网访问入口为https://manwa.me,另提供manwa.cc、manwa.vip、manwa.site等多节点备用链接,支持跨设备同步、个性化阅读及HTTPS安全加密。本专题为大家提供相关的文章、下载、课程内容,供大家免费下载体验。

60

2026.01.07

php做exe需要在什么样的环境
php做exe需要在什么样的环境

PHP无法真正编译为EXE,所谓打包实为将解释器、脚本及依赖库封装成自解压容器;主流方案是ExeOutputforPHP(商业、Windows)和PHPDesktop(开源、跨平台),需手动处理扩展依赖、路径适配与运行时限制。本专题为大家提供相关的文章、下载、课程内容,供大家免费下载体验。

1

2026.01.07

抖音抖币官方充值渠道汇总
抖音抖币官方充值渠道汇总

抖音官方抖币充值官网入口为https://pay.douyin.com/,具备直连支付系统、全端统一鉴权、HTTPS加密传输、多设备实时同步等特性,支持微信/支付宝/银联/话费等多种支付方式及严密账户安全机制。本专题为大家提供相关的文章、下载、课程内容,供大家免费下载体验。

5

2026.01.07

vscode创建html的教程
vscode创建html的教程

在 Visual Studio Code 中创建 HTML 文件的步骤如下:打开 VSCode并创建新文件。选择 "HTML" 模板。输入 HTML 代码。保存文件。(可选)预览文件。本专题为大家提供相关的文章、下载、课程内容,供大家免费下载体验。

3

2026.01.07

热门下载

更多
网站特效
/
网站源码
/
网站素材
/
前端模板

精品课程

更多
相关推荐
/
热门推荐
/
最新课程
PHP课程
PHP课程

共137课时 | 8.4万人学习

JavaScript ES5基础线上课程教学
JavaScript ES5基础线上课程教学

共6课时 | 6.9万人学习

PHP新手语法线上课程教学
PHP新手语法线上课程教学

共13课时 | 0.8万人学习

关于我们 免责申明 举报中心 意见反馈 讲师合作 广告合作 最新更新
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送

Copyright 2014-2026 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号