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].".";
//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;
?>
【本文版权归作者与奥索网共同拥有,如需转载,请注明作者及出处】
<?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].".";
//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;
?>
【本文版权归作者与奥索网共同拥有,如需转载,请注明作者及出处】
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
暂无评论...
更新日志
2024年11月25日
2024年11月25日
- 凤飞飞《我们的主题曲》飞跃制作[正版原抓WAV+CUE]
- 刘嘉亮《亮情歌2》[WAV+CUE][1G]
- 红馆40·谭咏麟《歌者恋歌浓情30年演唱会》3CD[低速原抓WAV+CUE][1.8G]
- 刘纬武《睡眠宝宝竖琴童谣 吉卜力工作室 白噪音安抚》[320K/MP3][193.25MB]
- 【轻音乐】曼托凡尼乐团《精选辑》2CD.1998[FLAC+CUE整轨]
- 邝美云《心中有爱》1989年香港DMIJP版1MTO东芝首版[WAV+CUE]
- 群星《情叹-发烧女声DSD》天籁女声发烧碟[WAV+CUE]
- 刘纬武《睡眠宝宝竖琴童谣 吉卜力工作室 白噪音安抚》[FLAC/分轨][748.03MB]
- 理想混蛋《Origin Sessions》[320K/MP3][37.47MB]
- 公馆青少年《我其实一点都不酷》[320K/MP3][78.78MB]
- 群星《情叹-发烧男声DSD》最值得珍藏的完美男声[WAV+CUE]
- 群星《国韵飘香·贵妃醉酒HQCD黑胶王》2CD[WAV]
- 卫兰《DAUGHTER》【低速原抓WAV+CUE】
- 公馆青少年《我其实一点都不酷》[FLAC/分轨][398.22MB]
- ZWEI《迟暮的花 (Explicit)》[320K/MP3][57.16MB]