日期:2013-01-10  浏览次数:20379 次

config.php文件

<?php  
// 你的用户名和密码,以及数据库名,和表名,在这里一次定义!!!
// 由于怕用户名和密码被别人通过浏览器看到,所以用了php的扩展名,这样通过浏览就看不到了!!!.

     $username='your_name';          //用户名
     $password='your_password';          //密码

     $hostname='localhost';              //主机名,一般都为localhost     

     $db_name='your_db_name';           //数据库名
     $table_name='your_liuyan_table';        //存放留言的表名  
        
     $table_name_control='your_control_table';    //控制表名

     $number_records_to_display=5;  //每页显示的留言条数!
      

     $hang_zifu_number=50;  //换行的一行字符数!



// 连接数据库,在这里连好!!!

     $id_link=@mysql_connect($hostname,$username,$password);
     if (! $id_link) {
        affy_message("The connection to the local dtabase has failed.");}
   
// 处理参数,以后所有参数都可以通过 $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;
     }
  }

// 一些出错处理函数!

  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处理函数!!!



//$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].".