<?php 
session_start();
require_once("fun/funsql.php");
require_once("fun/funlogic.php");
$fp=openfile("cache/newsconfig.txt");
$fps=explode(",,",$fp);
if($fps[7]==0){echo tanshow("系统不允许评论.","news.php?id=$nid");}
else{
$nid=@floatval(funstr($_GET["nid"]));
$c=@floatval(funstr($_GET["c"]));
if($nid==''){
  echo tanshow("传值错误","index.php");
}
else{

  if($c=='submit'){
    $users=@utf_substr(funstr($_POST["users"]),20);
	$mails=@utf_substr(funstr($_POST["mails"]),50);
	$qqs=@utf_substr(funstr($_POST["qqs"]),20);
	$mg=@utf_substr(funstr($_POST["mg"]),200);
	$checkcode=@utf_substr(funstr($_POST["checkcode"]),5);
	$ips=get_client_ip();
	$times=date("Y-m-d H:i:s");
	
	$mg=str_replace(">","&gt;",$mg);
	$mg=str_replace("<","&lt;",$mg);
	
	if($checkcode==$_SESSION["check"]){
	  $sql=query("insert into ".$dbz."comments(nid,users,mails,qqs,ips,mg,times,audits)values('$nid','$users','$mails','$qqs','$ips','$mg','$times',0)");
	  if($sql){echo tanshow("","news.php?id=$nid");}else{echo mysql_error();}
	}
	else{
	  echo tanshow("验证码错误","news.php?id=$nid");
	}
	
  }
  else{
    
  }
}
}
mysql_close();
?>