ÌôÕ½×î°ôµÄÁôÑÔ±¾µÄÔ´Â루ËÄ£©

5年以前  |  阅读数:215 次  |  编程语言:PHP 

config.phpÎļþ

<?php
// ÄaµÄÓû§ÃuºÍÃÜÂe,ÒÔ¼°Êý¾Ý¿aÃu,ºÍ±iÃu,ÔÚÕaÀiÒ»´Î¶¨Òa!!!
// ÓÉÓÚÅÂÓû§ÃuºÍÃÜÂe±»±ðÈËͨ¹ýa¯ÀÀÆ÷¿´µ½,ËuÒÔÓÃÁËphpµÄÀ(C)Õ¹Ãu,ÕaÑuͨ¹ýa¯ÀÀ¾Í¿´²»µ½ÁË!!!.

 $username='your_name';          //Óû§Ãu   
 $password='your_password';          //ÃÜÂe   

 $hostname='localhost';              //Ö÷»uÃu,Ò»°a¶¼Îªlocalhost       

 $db_name='your_db_name';           //Êý¾Ý¿aÃu   
 $table_name='your_liuyan_table';        //´ae*ÅÁoÑԵıiÃu    

 $table_name_control='your_control_table';    //¿ØÖƱiÃu   

 $number_records_to_display=5;  //ÿҳÏÔʾµÄÁoÑÔÌoÊý!   


 $hang_zifu_number=50;  //»»ÐеÄÒ»ÐÐ×Ö*uÊý!   

// Á¬½ÓÊý¾Ý¿a,ÔÚÕaÀiÁ¬ºÃ!!!

 $id_link=@mysql_connect($hostname,$username,$password);   
 if (! $id_link) {   
    affy_message("The connection to the local dtabase has failed.");}   

// ´¦Ài²ÎÊý,ÒÔºoËuÓвÎÊý¶¼¿ÉÒÔͨ¹ý $arr_request['name']µÃµ½,²»¹ÜÊÇpostµÄ»¹ÊÇgetµÄ!!!

$arr_request=array();
if (count($HTTP_GET_VARS)) {
while (list($key,$value)=each($HTTP_GET_VARS)) {
$arr_request[strtolower($key)]=$value;
}
}

if (count($HTTP_POST_VARS)) {
while (list($key,$value)=each($HTTP_POST_VARS)) {
$arr_request[strtolower($key)]=$value;
}
}

// Ò»Ð(C)³o´i´¦Àiº¯Êý!

function affy_footer() {
echo '';
}

function affy_header($title) {
echo '';<br /> echo "$title";<br /> echo '';
}

function affy_message($msg) {
echo '

';
echo '';
echo '
';
echo "$msg";
echo '
';
}

function affy_error_exit($msg) {
$errno = mysql_errno();
$error = mysql_error();
echo 'Error';
echo $msg;
echo "
Error: ($errno) $error
";
echo '';
exit();
}

// Ò»Ð(C)message´¦Àiº¯Êý!!!

//$test="2123.1.45.189";

function ip_question($msg)
{
//echo $msg;
//echo "
";
$ip=preg_split("/./",$msg);
$num=count($ip);
//echo $num;
$result="";
for($i=0;$i<$num-1;$i++)
{ $result=$result .$ip[$i].".";
//echo $ip[$i];
//echo "
";

}
$result=$result ."XX";
return($result);
}

//$result=ip_question($test);
//echo $result;

function add_blankto50($msg,$hang_zifu_number)
{
$num=strlen($msg);

$num_need=$hang_zifu_number-$num;
$str_suffix="";
for ($i=0;$i<$num_need;$i++)
{
$str_suffix=$str_suffix." ";

}
//$num6=strlen($str_suffix);
//echo $num6;
//echo "
";

$pattern='/^(.*)/';
$replacement="\1$str_suffix";

$msg=preg_replace($pattern,$replacement,$msg);

return($msg);

}

function check_en_num($msg)
{
$pattern='/[x00-x7f]/';

preg_match_all($pattern,$msg,$matches);

$num2=count($matches[0]);

return($num2%2);

}

function short_one($msg)
{
$pattern='/.$/';
$replacement='';
$result=preg_replace($pattern,$replacement,$msg);

return($result);

}

function pian_question($msg)
{
$pattern="/'/";
$replacement="'";
$temp=preg_replace($pattern,$replacement,$msg);

$pattern="/\'/";
$replacement="'";
$result=preg_replace($pattern,$replacement,$temp);

return($result);

}

function check_last($msg)
{

$pattern='/.$/';

preg_match($pattern,$msg,$match);

if ($match[0]>'~')
return(1);
else
return(0); // echo "Ó¢ÎÄ";

}

//$num5=short_one($test);
//echo $num5;

function computer_message($msg,$hang_zifu_number)
{
$msg=pian_question($msg);

$arr_phone=preg_split("/n/",$msg);

$num=count($arr_phone);
//echo $num;
//echo "
";
//$num2=strlen($arr_phone[0]);
//echo $num2;
$first_line=1;

for ($i=0;$i<$num;$i++)
{
while($str_num=strlen($arr_phone[$i])>$hang_zifu_number)
{

     $first_line=0;   
     $workstr=$arr_phone[$i];   



     $pattern_pre50="/.{".$hang_zifu_number ."}/";   

     preg_match_all($pattern_pre50,$workstr,$matches);   
     $temp=$matches[0][0];   

     if ((check_last($temp)==1)and(check_en_num($temp)==1))  //  ji shu and chinese   
        {         
               $hang_zifu_shortone=$hang_zifu_number-1;   

               $pattern_replace="/^.{".$hang_zifu_shortone ."}/";   

               $replacement='';   
               $arr_phone[$i]=preg_replace($pattern_replace,$replacement,$workstr);   
                   // Ç°Ãae49¸o´¦ÀiÍe!   

               $temp=short_one($temp);  //´Ó50¸oÖмoÈ¥Ò»¸o.   

         }    




     else     
        {   

          $pattern_replace="/^.{".$hang_zifu_number ."}/";   

          $replacement='';   
          $arr_phone[$i]=preg_replace($pattern_replace,$replacement,$workstr);   

        }    


     $message=$message . $temp."<br>";   

  }   

if (($first_line==1)and(strlen($arr_phone[$i])<$hang_zifu_number))
{

   $first_line=0;   
   $temp_addblank=$arr_phone[$i];   

   $temp_addblank=add_blankto50($temp_addblank,$hang_zifu_number);   

   $message=$temp_addblank ."<br>";   

 }   

else

   $message=$message .$arr_phone[$i]."<br>";   

}
return($message);

}

//$num1=strlen($test);
//echo $num1;
//echo $test;

//echo "
";
//$mes=add_blankto50($test);
//$num9=strlen($mes);
//echo $num9;
//$result=ip_question($test);
//computer_message($test);
//echo $result;

function checkpass($passwd,$action,$db_name,$table_name_control,$id_link)
{

 if ($action="delete")   
    $str_sql="select value from $table_name_control where leibie='delete';";   
 else if ($action="huifu")   
    $str_sql="select value from $table_name_control where leibie='huifu';";   
 else    
    echo "error";   



 $result=mysql_db_query($db_name,$str_sql,$id_link);   

 if (! $result) {   
        affy_error_exit('SQL Execution has failed.');}   


 $record= mysql_fetch_object($result);   
// echo $record->value;   
// echo "<br>";   
// echo $passwd;   
// echo "<br>";   
 if ($record->value==$passwd)   
    return(1);   
 else   
    return(0);      

}

//$msg=computer_message($test,$hang_zifu_number);

//echo $msg;

?>

¡¾±¾ÎÄ°aeȨ¹e×÷ÕßÓe°ÂË÷Íø¹²Í¬ÓµÓУ¬ÈçÐeתÔØ£¬Çe×¢Ã÷×÷Õß¼°³o´¦¡¿

 相关文章:
PHP分页显示制作详细讲解
SSH 登录失败:Host key verification failed
获取IMSI
将二进制数据转为16进制以便显示
获取IMEI
文件下载
贪吃蛇
双位运算符
PHP自定义函数获取搜索引擎来源关键字的方法
Java生成UUID
发送邮件
年的日历图
提取后缀名
在Zeus Web Server中安装PHP语言支持
让你成为最历害的git提交人
Yii2汉字转拼音类的实例代码
再谈PHP中单双引号的区别详解
指定应用ID以获取对应的应用名称
Python 2与Python 3版本和编码的对比
php封装的page分页类完整实例