addnote.php
m month d day H:i:s A"); $ip=$REMOTE_ADDR;//The message ip address $name=trim($name); $email=trim($email); $title= strip_tags($top); $nnote=nl2br(strip_tags($content));//Remove the html tag first, and then convert the line breaks to .N if (! $ Name ||! $ Email ||! $ Title ||! $ Nnote) {// Check whether to fill in the complete ECHO "Sorry, you must fill in all the content! >Return"; exit; }elseif(!ereg('^[-!#$%&'*+./0-9=?A-Z^_`a-z{|}~]+' .'@'.'[-!#$%&'*+/0-9=?A-Z^_`a-z{|}~]+.'.'[-!#$%&'*+./0 -9 =? A-Z^_`a-Z {|} ~]+$ ', $ email) // email legitimacy verification ) { echo "email!" "; exit; exit } //Write to database $sql="INSERT INTO notebook (name,email,time,face,ip,title,nnote) VALUES ('$name','$ email','$time','$face','$ip','$title','$nnote')"; $result = mysql_query($sql,$db); mysql_close($db); echo "Message successfully!"; } ?>
delnote.php include ("config.php"); if ($superadmin){ //如果已经进行管理员登陆,进行密码验证 if (!($user==$username)||!($psw==$password)){ echo "密码错误"; exit; } }else{ //管理员登陆 echo ""; exit; } if($del==1){ //判断是否要删除 mysql_query("delete from notebook where time='$time'",$db); //以留言时间为删除标志 echo "删除成功!"; } ?> $result = mysql_query("SELECT * FROM notebook ",$db); $row=mysql_num_rows($result);//查看结果有多少行 $max=$row; //帖子总数 //设每页显示10篇,$p总页数,$page第几页,$low 从第几行开始读,$x 读取几行 if (!$page){$page=1;} $p=ceil($max/10); $low=10*($page-1); if($page==$p&&($max%10)<>0){$x=($max%10);} else {$x=10;}//如果是最后一页,且不是10的整倍数,读取$max除以10的余数,否则取10 if($max==0){$x=0;}//如果没有帖子,$x取0 $result = mysql_query("select * from notebook ORDER BY time DESC limit $low,$x",$db); ?>
|