<?php
// 你的用戶名和密碼,以及數(shù)據(jù)庫名,和表名,在這里一次定義!!!
// 由于怕用戶名和密碼被別人通過瀏覽器看到,所以用了php的擴(kuò)展名,這樣通過瀏覽就看不到了!!!.

$username='your_name " /> 蜜桃成熟时2电影免费观看d,中国xxxxx,99 久久99久久精品免观看

天天躁日日躁狠狠躁AV麻豆-天天躁人人躁人人躁狂躁-天天澡夜夜澡人人澡-天天影视香色欲综合网-国产成人女人在线视频观看-国产成人女人视频在线观看

挑戰(zhàn)最棒的留言本的源碼(四)

config.php文件

<?php  
// 你的用戶名和密碼,以及數(shù)據(jù)庫名,和表名,在這里一次定義!!!
// 由于怕用戶名和密碼被別人通過瀏覽器看到,所以用了php的擴(kuò)展名,這樣通過瀏覽就看不到了!!!.

     $username='your_name';          //用戶名
     $password='your_password';          //密碼

     $hostname='localhost';              //主機(jī)名,一般都為localhost     

     $db_name='your_db_name';           //數(shù)據(jù)庫名
     $table_name='your_liuyan_table';        //存放留言的表名  

     $table_name_control='your_control_table';    //控制表名

     $number_records_to_display=5;  //每頁顯示的留言條數(shù)!


     $hang_zifu_number=50;  //換行的一行字符數(shù)!



// 連接數(shù)據(jù)庫,在這里連好!!!

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

// 處理參數(shù),以后所有參數(shù)都可以通過 $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;
     }
  }

// 一些出錯處理函數(shù)!

  function affy_footer() {
    echo '</body></html>';
  }

  function affy_header($title) {
    echo '<html><head><title>';
    echo "$title";
    echo '</title></head><body>';
  }

  function affy_message($msg) {
    echo '<table>';
    echo '<tr><td>';
    echo "$msg";
    echo '</td></tr>';
    echo '</table>';
  }

  function affy_error_exit($msg) {
      $errno = mysql_errno();
      $error = mysql_error();
      echo '<html><head><title>Error</title></head><body>';
      echo $msg;
      echo "<br>Error: ($errno) $error<br>";
      echo '</body></html>';
        exit();
  }

// 一些message處理函數(shù)!!!



//$test="2123.1.45.189";

function ip_question($msg)
{
//echo $msg;
//echo "<br>";
$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 "<br>";  

}
$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 "<br>";

$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 "<br>";
//$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);
                       // 前面49個處理完!

                   $temp=short_one($temp);  //從50個中減去一個.

             }  



         
         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 "<br>";
//$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;

?>


【本文版權(quán)歸作者與奧索網(wǎng)共同擁有,如需轉(zhuǎn)載,請注明作者及出處】    


php技術(shù)挑戰(zhàn)最棒的留言本的源碼(四),轉(zhuǎn)載需保留來源!

鄭重聲明:本文版權(quán)歸原作者所有,轉(zhuǎn)載文章僅為傳播更多信息之目的,如作者信息標(biāo)記有誤,請第一時間聯(lián)系我們修改或刪除,多謝。

主站蜘蛛池模板: 免费看国产曰批40分钟 | 国产亚洲精品看片在线观看 | 亚洲成A人片在线观看中文不卡 | 欧洲老妇人bb | 操他射他影院 | 男女夜晚在爽视频免费观看 | 国产欧美无码亚洲 | WWW夜片内射视频在观看视频 | sm主人调教揉花蒂H SM双性精跪趴灌憋尿调教H | 国产在线精品视频资源 | 国产在线观看免费观看不卡 | 亚洲蜜桃AV色情精品成人 | 一抽一出BGM免费3分钟 | 欧美亚洲韩日午夜 | 龙岩综合频道 | 2021扫黑风暴在线观看免费完整版 | 99久久精品互换人妻AV | 久久99re7在线视频精品 | 武侠古典久久亚洲精品 | 亚洲一区二区三不卡高清 | 亚婷婷洲AV久久蜜臀无码 | 777米奇色狠狠俺去啦 | 激情内射亚州一区二区三区爱妻 | 国产精品热久久高潮AV袁孑怡 | 无码观看AAAAAAAA片 | 国产亚洲精品欧洲在线视频 | 黄色三级三级三级免费看 | 孕妇高潮抽搐喷水30分钟 | 亚洲精品高清中文字幕完整版 | 亚洲欧洲日产国产 最新 | 人人碰国产免费线观看 | 9277高清在线观看视频 | 性生交片免费无码看人 | 91日本在线观看亚洲精品 | 国产专区青青草原亚洲 | 国产亚洲精品品视频在线 | 日本中文字幕伊人成中文字幕 | FERRCHINA内入内射 | 纯肉高H种马艳遇风流多 | 亚洲 日韩 自拍 视频一区 | 强开乳罩摸双乳吃奶视频 |