Home >Backend Development >PHP Tutorial >Free Guestbook Challenge the best guestbook source code (4)

Free Guestbook Challenge the best guestbook source code (4)

WBOY
WBOYOriginal
2016-07-29 08:34:09944browse

config.php file
//Your username and password, as well as database name, and table name, are defined here!!!
//Because you are afraid that your username and password will be seen by others through the browser, so Use the php extension, so you can’t see it by browsing!!!.
                                                                                                                                                   $username='your_name';         . /Host name, usually localhost
  $db_name='your_db_name';         //Database name
    $table_name='your_liuyan_table';                                    $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 "English";
}
//$num5=short_one($test);
//echo $num5;
function computer_message($msg,$hang_zifu_number)
{
$msg=pian_question($msg);
$arr_ph/n/",$ msg);
$num=count($arr_phone);
//echo $num;
//echo "
";
//$num2=strlen($arr_phone[0]);
//echo {
           $first_line=0;
             $workstr=$arr_phone[$i];                                            $pattern_ all($pattern_pre50,$workstr,$matches);
$temp=$matches[0][0];
                                                                                                                                           short
                   $ pattern_replace="/^.{".$hang_zifu_shortone ."}/";
                                  $replacement='';                                                                                                                                                                                                Processed!
                                                                                                                                                                                                                               .
                    $pattern_replace="/^.{".$hang_zifu_number ."}/";
              $replacement='';
              $arr_phone[$i]=preg_replace($pattern_replace,$replacement,$workstr);
            }  
  
         $message=$message . $temp."
";
      }
   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 ."
";
     }
   else
       $message=$message .$arr_phone[$i]."
";
}
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 "
";
    // echo $passwd;
    // echo "
";
     if ($record->value==$passwd)
        return(1);
     else
        return(0);    
   }
//$msg=computer_message($test,$hang_zifu_number);
//echo $msg;
?>
【本文版权归作者与奥索网共同拥有,如需转载,请注明作者及出处】    

以上就介绍了免费留言本 挑战最棒的留言本的源码(四),包括了免费留言本方面的内容,希望对PHP教程有兴趣的朋友有所帮助。

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn