Heim  >  Artikel  >  php教程  >  挑战最棒的留言本的源码(四)

挑战最棒的留言本的源码(四)

WBOY
WBOYOriginal
2016-06-13 12:39:21793Durchsuche

config.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 '

Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn