程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> 網頁編程 >> PHP編程 >> PHP綜合 >> 挑戰最棒的留言本的源碼(三)

挑戰最棒的留言本的源碼(三)

編輯:PHP綜合
action.php文件

<?php
require('config.php');   
$action=$arr_request['action'];
$key_liuyan=$arr_request['key_liuyan'];

if (!isset($PHP_AUTH_USER))  
  {
    Header('WWW-Authenticate:Basic realm="管理留言"');
    Header('HTTP/1.0 401 Unauthorized');
    echo '需要受權,你沒有這權限!<BR>';
    echo '單擊刷新來重試.<br>';
    exit;         

  }

else

  {

         if (strlen($PHP_AUTH_USER)!=0)
            {

             if ($action=="delete")   
              echo "對不起,你沒有刪除留言的權限!!!<br>";
             else if ($action="huifu")
              echo "對不起,你暫時還不能恢復,現在只有版主有這權限!!!<br>";
             else  
              echo "對不起,你沒有管理留言本的權限!!!";  
             exit;    
            }

         $pass=$PHP_AUTH_PW;
        // echo $pass;   
         $result=0;
         while($pass%10!=0)
             {
                $result=$result+$pass%10;
                $pass=($pass-$pass%10)/10;
               // echo $result;
               // echo "<br>";  

             }  

         $tt=$result*222;
         //echo $tt;
         if (!checkpass($tt,$action,$db_name,$table_name_control,$id_link))
            {
             if ($action=="delete")   
              echo "對不起,你沒有刪除留言的權限!!!<br>";
             else if ($action="huifu")
              echo "對不起,你暫時還不能恢復,現在只有版主有這權限!!!<br>";
             else  
              echo "對不起,你沒有管理留言本的權限!!!";  
             exit;    
            }



  }



if ($action=="delete")
  {
   //printf("delete");
   //echo $key_liuyan;
   $str_sql="delete from $table_name where key_liuyan=$key_liuyan";
   $re=mysql_db_query($db_name,$str_sql,$id_link);

   if (!$re)
      {
        echo "刪除出錯";
      }
   else

      {
          echo "成功刪除";   
          echo "<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">";
          echo "<HTML><HEAD><TITLE>發表文章</TITLE>";
          echo "<META content="text/html; charset=gb2312" http-equiv=Content-Type>";
          echo "<meta HTTP-EQUIV="REFRESH" CONTENT="2;URL=display.php">";
          echo "</head><body topmargin="0"><br>";
          echo "<ul>回復成功,將自動顯示留言內容";
          echo " <br>";
          echo "<a href=display.php>如果你的浏覽器沒有自動的返回到留言簿首頁,請點擊這裡";
          echo "</a></ul>";
       }           
   }
else if ($action=="huifu")

{
   //printf("huifu");
  // echo $key_liuyan;

     
?>

   <form action="action.php?action=ok" method="post">
   <input type="hidden" name="key" value="<?php echo $key_liuyan?>">

   <textarea name="huifu" cols="50" rows="6"></textarea>
   <input type="submit" value="回復">



   </form>

<?php



  }

else if ($action=="ok")
   {   
      $key=$arr_request['key'];
      $huifuold=$huifu;

      $time=date('Y/m/d H:i:s');
      $time='('.$time . ')<br>';

      $huifuold=$time .$huifuold ;

        
      $huifu_ok=computer_message($huifuold,$hang_zifu_number);       

      if (strlen($key)==0)
         {  echo "error";
            exit;    
         }
      $str_sql="update $table_name set huifu_biaozi=1,
                  huifu='$huifu_ok'  where key_liuyan=$key";    

   //   echo $str_sql;      

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

      if (!$re)
         {
            echo "更新出錯";
         }
      else
          {

  
            echo "回復成功";   

   


            echo "<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">";
            echo "<HTML><HEAD><TITLE>發表文章</TITLE>";
            echo "<META content="text/html; charset=gb2312" http-equiv=Content-Type>";
            echo "<meta HTTP-EQUIV="REFRESH" CONTENT="2;URL=display.php">";
            echo "</head><body topmargin="0"><br>";
            echo "<ul>回復成功,將自動顯示留言內容";
            echo " <br>";
            echo "<a href=display.php>如果你的浏覽器沒有自動的返回到留言簿首頁,?
            請點這裡返回.";
            echo "</a></ul>";


            exit;  

   
          }



   }


else

  printf("error");


?>


【本文版權歸作者與奧索網共同擁有,如需轉載,請注明作者及出處】    
  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved