search
Homephp教程php手册php通用检测函数集(1)

php通用检测函数集(1)

Jun 13, 2016 am 10:20 AM
checkMoneyphpdataexamineDetectionUniversal

// ※CheckMoney($C_Money) 检查数据是否是99999.99格式
// ※CheckEmailAddr($C_mailaddr) 判断是否为有效邮件地址
// ※CheckWebAddr($C_weburl) 判断是否为有效网址
// ※CheckEmpty($C_char) 判断字符串是否为空
// ※CheckLengthBetween($C_char, $I_len1, $I_len2=100) 判断是否为指定长度内字符串
// ※CheckUser($C_user) 判断是否为合法用户名
// ※CheckPassword($C_passwd) 判断是否为合法用户密码
// ※CheckTelephone($C_telephone) 判断是否为合法电话号码
// ※CheckValueBetween($N_var, $N_val1, $N_val2) 判断是否是某一范围内的合法值
// ※CheckPost($C_post) 判断是否为合法邮编(固定长度)
// ※CheckExtendName($C_filename,$A_extend) 判断上传文件的扩展名
// ※CheckImageSize($ImageFileName,$LimitSize) 检验上传图片的大小
// ※AlertExit($C_alert,$I_goback=0) 非法操作警告并退出
// ※Alert($C_alert,$I_goback=0) 非法操作警告
// ※ReplaceSpacialChar($C_char) 特殊字符替换函数
// ※ExchangeMoney($N_money) 资金转换函数
// ※WindowLocation($C_url,$C_get="",$C_getOther="") PHP中的window.location函数
//-----------------------------------------------------------------------------------
-------


//-----------------------------------------------------------------------------------
-------
// 函数名:CheckMoney($C_Money)
// 作 用:检查数据是否是99999.99格式
// 参 数:$C_Money(待检测的数字)
// 返回值:布尔值
// 备 注:无
//-----------------------------------------------------------------------------------
-------
function CheckMoney($C_Money)
{
if (!ereg("^[0-9][.][0-9]$", $C_Money)) return false;
return true;
}
//-----------------------------------------------------------------------------------
-------


//-----------------------------------------------------------------------------------
-------
// 函数名:CheckEmailAddr($C_mailaddr)
// 作 用:判断是否为有效邮件地址
// 参 数:$C_mailaddr(待检测的邮件地址)
// 返回值:布尔值
// 备 注:无
//-----------------------------------------------------------------------------------
-------
function CheckEmailAddr($C_mailaddr)
{
if (!eregi("^[_a-z0-9-]+(.[_a-z0-9-]+)*@[a-z0-9-]+(.[a-z0-9-]+)*$",
$C_mailaddr))
//(!ereg("^[_a-zA-Z0-9-]+(.[_a-zA-Z0-9-]+)*@[_a-zA-Z0-9-]+(.[_a-zA-Z0-9-]+)*$",
$c_mailaddr))
{
return false;
}
return true;
}
//-----------------------------------------------------------------------------------
-------


//-----------------------------------------------------------------------------------
-------

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool

SecLists

SecLists

SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!