新葡亰496net 新葡亰编程 通达OA公共代码 php常用检测函数

通达OA公共代码 php常用检测函数

check_type.php 复制代码 代码如下:

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

写在前面的话. PW8 是个里程碑式的版本,有门户,有频道,等多元素多模式组成,
stwind高度伪静态(超级伪静态)的处理方法仅仅适用于论坛部分.
并尽力避免与其他操作和地址产生冲突.在这个版本,
改变了几个变量,一个是列表页的变量,一个是过滤特殊字符的变量, 
地址组成依然不变, 帖子也依然以 article 为前缀, 列表页以commtopics
链接.pw8里函数改动较大,所以修改也较为麻烦.
考虑到会被任意修改,以后版本考虑单个加密这个文件. 
本次依然沿用以前的风格. 
一,打开require/common.php
找到
function urlRewrite($url) {
    global $db_htmifopen, $db_dir, $db_ext;
    if (!$db_htmifopen) return $url;
    $tmppos = strpos($url, ‘#’);
    $add = $tmppos !== false ? substr($url, $tmppos) : ”;
    $turl = str_replace(array(‘.php?’, ‘=’, ‘&’, ‘&’, $add),
array($db_dir, ‘-‘, ‘-‘, ‘-‘, ”), $url);
新葡亰,    $turl != $url && $turl .= $db_ext;
    return $turl . $add;
}
替换成
function urlRewrite($url) {
    global $db_htmifopen, $db_dir, $db_ext;
    if(strpos($url, ‘thread.php?’) !== false){
         unset($URL_type);
         $Thread_array = explode(‘&’, substr(str_replace($add, ”,
$url), 11));
          foreach($Thread_array as $key => $value){
             $URL_array = explode(‘=’, $value, 2);
              if($URL_array[‘1’]){
               switch($URL_array[‘0’]){
                case ‘fid’:
                    $URL_type[‘fid’] = $URL_array[‘1’];
新葡亰496net,                    $URL_type[‘type’] < 1 && $URL_type[‘type’]
= 1;
                break;
                case ‘page’:
                    $URL_type[‘page’] = $URL_array[‘1’];
                    $URL_type[‘type’] < 2 && $URL_type[‘type’]
= 2;
                break;
                default:
                    $URL_type[‘type’] = 4;
                break;
                }}}
         switch($URL_type[‘type’]){
           case ‘1’:
               $url = “commtopics-” . $URL_type[‘fid’] ;
break;               
           case ‘2’:
               $url = “commtopics-” . $URL_type[‘fid’] . “-” .
$URL_type[‘page’] ;   break;
             }}elseif(strpos($url, ‘read.php?’) !== false){
                unset($URL_type);
             $tmppos = strpos($url, ‘#’);
           $add = $tmppos !== false ? substr($url, $tmppos) : ”;
              $Read_array = explode(‘&’, substr(str_replace($add, ”,
$url), 9));
                foreach($Read_array as $key => $value){
                $URL_array = explode(‘=’, $value, 2);
                if($URL_array[‘1’]){
                    switch($URL_array[‘0’]){
                        case ‘tid’:
                            $URL_type[‘tid’] = $URL_array[‘1’];
                            $URL_type[‘type’] < 1 &&
$URL_type[‘type’] = 1;
                            break;
                        case ‘page’:
                            $URL_type[‘page’] = $URL_array[‘1’];
                            $URL_type[‘type’] < 2 &&
$URL_type[type] = 2;
                            break;
                        case ‘fpage’:
                            $URL_type[‘fpage’] =
$URL_array[‘1’];
                            $URL_type[‘type’] < 3 &&
$URL_type[‘type’] = 3;
                            break;
                        default:
                            $URL_type[‘type’] = 4;
                            break;
                        }}}
          switch($URL_type[‘type’]){
             case ‘1’:
                 $url = “article-“.$URL_type[‘tid’].”.html” ;
                 break;
澳门葡亰娱乐场手机版,             case ‘2’:
                 $url = “article-“.$URL_type[‘tid’] . “-” .
$URL_type[‘page’].”.html” ;
                 break;
             case ‘3’:
                 $url = “article-“. $URL_type[‘tid’] . “-” .
$URL_type[‘page’] . “-” . $URL_type[‘fpage’].”.html” ;
                 break;
                 }
             }
        //      $url .= $db_ext;  很多人以为后缀问题,故作特处理。
    return $url . $add;
}
规则如下.  添加到httpd.ini或者.htaccess 或者其他
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^thread-htm-tid-(d+)-(.*).html  thread.php?fid=$1
RewriteRule ^read-htm-tid-(d+)-(.*).html  read.php?tid=$1
RewriteRule ^commtopics-(d+)-(.*)  thread.php?fid=$1&page=$2
RewriteRule ^commtopics-(.*)       thread.php?fid=$1&page=$2
RewriteRule ^article-(d+)-(d+)-(.*).html 
read.php?tid=$1&page=$2&fpage=$3
RewriteRule ^article-(d+)-(d+).html       read.php?tid=$1&page=$2
RewriteRule ^article-(.*).html             read.php?tid=$1
RewriteRule ^(.*)-htm-(.*).html    $1.php?$2
RewriteRule ^(.*)/simple/([a-z0-9_]+.html)$
$1/simple/index.php?$2
</IfModule>

auth.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;
}
?>

utility_all公用函数 复制代码 代码如下:

auth.php登录验证

“; } if { message( “错误”, itask_last_error; exit; } } } $REMARK =
str_replace( “‘”, “\'”, $REMARK ); $REMARK = str_replace(
“\\'”, “\'”, $REMARK ); $query = “insert into SYS_LOG
(USER_ID,TIME,IP,TYPE,REMARK) values
(‘”.$OPERATOR.”‘,'{$CUR_TIME}’,'{$USER_IP}’,'{$TYPE}’,'{$REMARK}’)”;
exequery( $connection, $query ); if ( 21 < $TYPE && !find_id ||
get_code_name == “” ) { $query1 = “INSERT INTO `SYS_CODE` (
`CODE_NO` , `CODE_NAME` , `CODE_ORDER` , `PARENT_NO` ,
`CODE_FLAG` ) VALUES (‘”.$TYPE.”‘, ‘未知类型’, ’99’, ‘SYS_LOG’,
‘1’);”; exequery( $connection, $query1 ); } return $query; } function
affair_sms { include_once( “inc/utility_sms1.php” ); global
$connection; global $LOGIN_USER_ID; $CUR_DATE = date; $CUR_TIME =
date( “Y-m-d H:i:s”, time; $query = “SELECT * from AFFAIR where
USER_ID='”.$LOGIN_USER_ID.”‘ and BEGIN_TIME <='{$CUR_TIME}’ and
(LAST_REMIND”.$CODE_NAME.”n”; } else if { $OPTION_STR .=
“”.$CODE_NAME.”n”; } else if { $OPTION_STR .= “”.$CODE_NAME.”n”;
} } return $OPTION_STR; } function get_code_array( $PARENT_NO,
$REVERSE = FALSE ) { $CODE_ARRAY = array; if { return $CODE_ARRAY; }
global $connection; $query = “select CODE_NO,CODE_NAME from SYS_CODE
where PARENT_NO='”.$PARENT_NO.”‘ order by CODE_ORDER”; $cursor =
exequery( $connection, $query ); while ( $ROW = mysql_fetch_array {
$CODE_NO = $ROW[‘CODE_NO’]; $CODE_NAME = $ROW[‘CODE_NAME’]; if {
$CODE_ARRAY[$CODE_NO] = $CODE_NAME; } else {
$CODE_ARRAY[$CODE_NAME] = $CODE_NO; } } return $CODE_ARRAY; }
function sms_type_url( $SMS_TYPE, $CONTENT ) { switch { case “0” :
$URL = “/general/sms/receive/”; return $URL; case “1” : $URL =
“/general/notify/show/”; return $URL; case “2” : $URL =
“/general/email/inbox/?BOX_ID=0”; return $URL; case “3” : $URL =
“/general/netmeeting/”; return $URL; case “4” : $URL =
“/general/salary/report/”; return $URL; case “5” : $URL =
“/general/calendar/”; return $URL; case “6” : if ( strstr && strstr &&
strstr { $URL = “/general/attendance/manage/”; return $URL; } $URL =
“/general/attendance/personal/”; return $URL; case “7” : $URL =
“/general/workflow/list”; return $URL; case “8” : $URL =
“/general/meeting/manage/”; return $URL; case “9” : if ( strstr { if (
strstr { } } if ( strstr || strstr && strstr { $URL =
“/general/vehicle/checkup/”; return $URL; } if ( strstr { $URL =
“/general/vehicle/dept_manage/”; return $URL; } $URL =
“/general/vehicle/”; return $URL; case “10” : $URL =
“/general/mobile_sms/”; return $URL; case “11” : $URL =
“/general/vote/show/”; return $URL; case “12” : $URL =
“/general/work_plan/show/”; return $URL; case “13” : $URL =
“/general/diary/”; return $URL; case “14” : $URL =
“/general/news/show/”; return $URL; case “15” : $URL =
“/general/score/submit/”; return $URL; case “16” : $URL =
“/general/file_folder/index1.php”; return $URL; case “17” : $URL =
“/general/netdisk”; return $URL; case “18” : $URL = “/general/bbs”;
return $URL; case “20” : $URL =
“/general/file_folder?FILE_SORT=2&SORT_ID=0”; return $URL; case “30”
: $URL = “/general/training/manage/show”; return $URL; case “31” : if (
strstr || strstr || strstr { $URL = “/general/training/train/apply/”;
return $URL; } $URL = “/general/training/manage/apply_manage/”; return
$URL; case “32” : $URL = “/general/training/train/survey/”; return $URL;
case “33” : $URL = “/general/training/train/information/”; return $URL;
case “34” : $URL = “/general/training/train/assessment/”; return $URL;
case “35” : $URL = “/general/hrms/manage/”; } return $URL; } function
avatar_size { global $ROOT_PATH; global $connection; global
$AVATAR_WIDTH; global $AVATAR_HEIGHT; $FILENAME =
$ROOT_PATH.”images/avatar/”.$AVATAR.”.gif”; if ( !$AVATAR_WIDTH &&
!$AVATAR_HEIGHT ) { $query = “SELECT AVATAR_WIDTH,AVATAR_HEIGHT from
INTERFACE”; $cursor = exequery( $connection, $query ); if ( $ROW =
mysql_fetch_array { $AVATAR_WIDTH = $ROW[‘AVATAR_WIDTH’];
$AVATAR_HEIGHT = $ROW[‘AVATAR_HEIGHT’]; } } $IMG_ATTR =
@getimagesize; if ( $AVATAR_WIDTH < $IMG_ATTR[0] ) {
$IMG_ATTR[0] = $AVATAR_WIDTH; } if ( $AVATAR_HEIGHT <
$IMG_ATTR[1] ) { $IMG_ATTR[1] = $AVATAR_HEIGHT; } if {
$IMG_ATTR[0] = 15; } if { $IMG_ATTR[1] = 15; } return
“width=””.$IMG_ATTR[‘0’].”” height=”{$IMG_ATTR[‘1’]}””; }
function format_cvs { $STR = str_replace; $STR = str_replace; $STR =
str_replace; $STR = str_replace; if === FALSE ) { return $STR; } $STR
= “””.$STR.”””; return $STR; } function keyed_str { $ENCRYPT_KEY =
md5; $CTR = 0; $TMP = “”; $I = 0; for ( ; $I < strlen { if ( $CTR ==
strlen { $CTR = 0; } $TMP .= substr ^ substr( $ENCRYPT_KEY, $CTR, 1 );
++$CTR; } return $TMP; } function encrypt_str { srandmicrotime;
$ENCRYPT_KEY = md5; $CTR = 0; $TMP = “”; $I = 0; for ( ; $I < strlen
{ if ( $CTR == strlen { $CTR = 0; } $TMP .= substr( $ENCRYPT_KEY, $CTR,
1 ).( substr ^ substr( $ENCRYPT_KEY, $CTR, 1 ) ); ++$CTR; } return
keyed_str; } function decrypt_str { $TXT = keyed_str; $TMP = “”; $I =
0; for ( ; $I < strlen { $MD5 = substr; ++$I; $TMP .= substr ^ $MD5;
} return $TMP; } function get_client_ip { if ( getenv && strcasecmp(
getenv, “unknown” ) ) { $onlineip = getenv; return $onlineip; } if (
isset( $_SERVER[‘REMOTE_ADDR’] ) && $_SERVER[‘REMOTE_ADDR’] &&
strcasecmp( $_SERVER[‘REMOTE_ADDR’], “unknown” ) ) { $onlineip =
$_SERVER[‘REMOTE_ADDR’]; return $onlineip; } if ( getenv &&
strcasecmp( getenv, “unknown” ) ) { $onlineip = getenv; return
$onlineip; } if ( getenv( “HTTP_X_FORWARDED_FOR” ) && strcasecmp(
getenv( “HTTP_X_FORWARDED_FOR” ), “unknown” ) ) { $onlineip = getenv(
“HTTP_X_FORWARDED_FOR” ); } return $onlineip; } function
dept_long_name { global $SYS_DEPARTMENT; include_once(
“inc/department.php” ); if ( is_array { } if ( !array_key_exists(
$DEPT_ID, $SYS_DEPARTMENT ) ) { include_once( “inc/utility_org.php”
); cache_department; include( “inc/department.php” ); } return
$SYS_DEPARTMENT[$DEPT_ID][‘DEPT_LONG_NAME’]; } function
sms_remind( $SMS_TYPE, $SMS_CHECKED = “” ) { global $connection;
global $LOGIN_USER_ID; $query = “select * from SYS_PARA where
PARA_NAME=’SMS_REMIND'”; $cursor = exequery( $connection, $query ); if
( $ROW = mysql_fetch_array { $PARA_VALUE = $ROW[‘PARA_VALUE’]; }
$REMIND_ARRAY = explode; $SMS_REMIND = $REMIND_ARRAY[0];
$SMS2_REMIND = $REMIND_ARRAY[1]; $SMS3_REMIND =
$REMIND_ARRAY[2]; if ( find_id( $SMS3_REMIND, $SMS_TYPE ) ) { echo
“使用内部短信提醒”; } $query = “select * from SMS2_PRIV”; $cursor =
exequery( $connection, $query ); if ( $ROW = mysql_fetch_array {
$TYPE_PRIV = $ROW[‘TYPE_PRIV’]; $SMS2_REMIND_PRIV =
$ROW[‘SMS2_REMIND_PRIV’]; } if ( find_id( $TYPE_PRIV, $SMS_TYPE )
&& find_id( $SMS2_REMIND_PRIV, $LOGIN_USER_ID ) ) { echo
“使用手机短信提醒”; } } function sms_select_remind( $SMS_TYPE,
$SMS_CHECKED = “” ) { return “手动选择被提醒人员rn
提醒全部有权限人员
rn rn

复制代码 代码如下:

rn rn
添加rn
清空”; } function
sms2_select_remind( $SMS_TYPE, $SMS_CHECKED = “” ) { global
$connection; global $LOGIN_USER_ID; $query = “select * from
SMS2_PRIV”; $cursor = exequery( $connection, $query ); if ( $ROW =
mysql_fetch_array { $TYPE_PRIV = $ROW[‘TYPE_PRIV’];
$SMS2_REMIND_PRIV = $ROW[‘SMS2_REMIND_PRIV’]; } if ( find_id(
$TYPE_PRIV, $SMS_TYPE ) && find_id( $SMS2_REMIND_PRIV,
$LOGIN_USER_ID ) ) { return “手动选择被提醒人员rn
提醒全部有权限人员
rn rn

/*********************/
/* */
/* 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( );
}
?>

标签:

相关文章

发表评论

电子邮件地址不会被公开。 必填项已用*标注

网站地图xml地图