<?php 
require ("link.php");

$image=make_safe($_POST["check_image"]);
$username=make_safe($_POST["check_username"]);
$qq=make_safe($_POST["check_qq"]);
$weixin=make_safe($_POST["check_weixin"]);
$email=make_safe($_POST["check_email"]);
$formprivate=make_safe($_POST["check_formprivate"]);
$content=safe($_POST["check_content"]);
$yzm=make_safe($_POST["check_yzm"]);
$modi_date=date("Y-m-d H:i:s");
$hf_content="";

session_start();

if ($username=="" or  $content=="" )
	{
		echo "{\"success\":false,\"msg\":\"输入有空，提交失败\"}";	
	}
if($yzm!=$_SESSION["Checknum"]){

		echo "{\"success\":false,\"msg\":\"验证码输入失败\"}";		
}
else
{
	mysql_connect($se_name,$sedb_name,$db_pass) or die("无法连接数据库，请重来");
	mysql_select_db($db_name) or die("无法选择数据库，请重来");
	$sql = "insert into ly(head,name,qq,weixin,email,content,private,hf_content,modi_date) values('$image','$username','$qq','$weixin','$email','$content','$formprivate','$hf_content','$modi_date')";
	$result=mysql_query($sql);
	if(mysql_affected_rows())
		{
			echo "{\"success\":true,\"msg\":\"留言成功!\"}";	
		}else{
			echo "{\"success\":false,\"msg\":\"留言失败!\"}";	
		}
}


?>


