宝马娱乐在线112222 > 网络应用 > 宝马娱乐在线112222通达OA公共代码 php常用检测函

原标题:宝马娱乐在线112222通达OA公共代码 php常用检测函

浏览次数:123 时间:2019-10-01

 代码如下

check_type.php(使用类型检验函数)

function format_money( $STR )
{
        if ( $STR == "" )
        {
                return "";
        }
        if ( $STR == ".00" )
        {
                return "0.00";
        }
        $TOK = strtok( $STR, "." );
        if ( strcmp( $STR, $TOK ) == "0" )
        {
                $STR .= ".00";
        }
        else
        {
                $TOK = strtok( "." );
                $I = 1;
                for ( ;    $I <= 2 - strlen( $TOK );    ++$I    )
                {
                        $STR .= "0";
                }
        }
        if ( substr( $STR, 0, 1 ) == "." )
        {
                $STR = "0".$STR;
        }
        return $STR;
}

复制代码 代码如下:

<?php
/*********************/
/* */
/* Version : 5.1.0 */
/* Author : RM */
/* Comment : 071223 */
/* */
/*********************/
function is_number( $str )
{
if ( substr( $str, 0, 1 ) == "-" )
{
$str = substr( $str, 1 );
}
$length = strlen( $str );
$i = 0;
for ( ; $i < $length; ++$i )
{
$ascii_value = ord( substr( $str, $i, 1 ) );
if ( 48 <= $ascii_value && $ascii_value <= 57 )
{
continue;
}
return FALSE;
}
if ( $str != "0" )
{
$str = intval( $str );
if ( $str == 0 )
{
return FALSE;
}
}
return TRUE;
}
function is_decimal( $str )
{
if ( substr( $str, 0, 1 ) == "-" )
{
$str = substr( $str, 1 );
}
$length = strlen( $str );
$i = 0;
for ( ; $i < $length; ++$i )
{
$ascii_value = ord( substr( $str, $i, 1 ) );
if ( 0 < $i && $ascii_value == 46 || 48 <= $ascii_value && $ascii_value <= 57 )
{
continue;
}
return FALSE;
}
return TRUE;
}
function is_money( $str )
{
$dot_pos = strpos( $str, "." );
if ( !$dot_pos )
{
return FALSE;
}
$str1 = substr( $str, 0, $dot_pos );
if ( 14 < strlen( $str1 ) )
{
return FALSE;
}
if ( !is_number( $str1 ) )
{
return FALSE;
}
$str2 = substr( $str, $dot_pos + 1, strlen( $str ) - $dot_pos );
if ( strlen( $str2 ) != 2 )
{
return FALSE;
}
if ( !is_number( $str2 ) )
{
return FALSE;
}
return TRUE;
}
function is_money_len( $str, $int_len, $dot_len )
{
$dot_pos = strpos( $str, "." );
if ( !$dot_pos )
{
return FALSE;
}
$str1 = substr( $str, 0, $dot_pos );
if ( $int_len < strlen( $str1 ) )
{
return FALSE;
}
if ( !is_number( $str1 ) )
{
return FALSE;
}
$str2 = substr( $str, $dot_pos + 1, strlen( $str ) - $dot_pos );
if ( strlen( $str2 ) != $dot_len )
{
return FALSE;
}
if ( !is_number( $str2 ) )
{
return FALSE;
}
return TRUE;
}
function is_date( $str )
{
$YEAR = "";
$MONTH = "";
$DAY = "";
$len = strlen( $str );
$offset = 0;
$i = strpos( $str, "-", $offset );
$YEAR = substr( $str, $offset, $i - $offset );
$offset = $i + 1;
if ( $len < $offset )
{
return FALSE;
}
if ( $i )
{
$i = strpos( $str, "-", $offset );
$MONTH = substr( $str, $offset, $i - $offset );
$offset = $i + 1;
if ( $len < $offset )
{
return FALSE;
}
if ( $i )
{
$DAY = substr( $str, $offset, $len - $offset );
}
}
if ( $YEAR == "" || $MONTH == "" || $DAY == "" )
{
return FALSE;
}
if ( !checkdate( intval( $MONTH ), intval( $DAY ), intval( $YEAR ) ) )
{
return FALSE;
}
return TRUE;
}
function is_time( $str )
{
$TEMP = "";
$HOUR = "";
$MIN = "";
$SEC = "";
$TEMP = strtok( $str, ":" );
$HOUR = $TEMP;
if ( $HOUR == "" || 24 <= $HOUR || $HOUR < 0 || !is_number( $HOUR ) )
{
return FALSE;
}
$TEMP = strtok( ":" );
$MIN = $TEMP;
if ( $MIN == "" || 60 <= $MIN || $MIN < 0 || !is_number( $MIN ) )
{
return FALSE;
}
$TEMP = strtok( ":" );
$SEC = $TEMP;
if ( $SEC == "" || 60 <= $SEC || $SEC < 0 || !is_number( $SEC ) )
{
return FALSE;
}
return TRUE;
}
function is_date_time( $DATE_TIME_STR )
{
if ( $DATE_TIME_STR == NULL || strlen( $DATE_TIME_STR ) == 0 )
{
return FALSE;
}
$DATE_TIME_ARRY = explode( " ", $DATE_TIME_STR );
if ( is_date( $DATE_TIME_ARRY[0] ) && is_time( $DATE_TIME_ARRY[1] ) )
{
return TRUE;
}
return FALSE;
}
?>

auth.php登录验证

复制代码 代码如下:

<?php
/*********************/
/* */
/* Version : 5.1.0 */
/* Author : RM */
/* Comment : 071223 */
/* */
/*********************/
if ( $USER_ID == "" || $PASSWORD == "" )
{
echo "201#|#用户名或密码为空";
exit( );
}
if ( $USER_ID != "OfficeTask" )
{
echo "205#|#用户名错误";
exit( );
}
include_once( "../inc/conn.php" );
include_once( "../inc/utility.php" );
ob_end_clean( );
$query = "select * from EXT_USER where USER_ID='".$USER_ID."'";
$cursor = exequery( $connection, $query );
if ( $ROW = mysql_fetch_array( $cursor ) )
{
$PWD = $ROW['PASSWORD'];
$USE_FLAG = $ROW['USE_FLAG'];
$AUTH_MODULE = $ROW['AUTH_MODULE'];
$POSTFIX = $ROW['POSTFIX'];
if ( md5( $PWD ) != $PASSWORD )
{
echo "203#|#密码错误";
exit( );
}
if ( $USE_FLAG == "0" )
{
echo "204#|#帐号已停用";
exit( );
}
}
else
{
echo "202#|#".$USER_ID;
exit( );
}
?>

本文由宝马娱乐在线112222发布于网络应用,转载请注明出处:宝马娱乐在线112222通达OA公共代码 php常用检测函

关键词:

上一篇:syntax error, unexpected T_CONCAT_EQUAL宝马娱乐在线1122

下一篇:没有了