<?php
/*
'**************************************************************************************************
' 软件名称: 搜一次 Content Management System
' 版本编号: Version 1.X
' 官方网站: http://www.syccms.com
' 官方论坛：http://bbs.syccms.com
' 版权所有: 搜一次运营团队
' 法律顾问: 杭州市元茂律师事务所 严飞律师
' 郑重声明:
'    1、任何个人或组织不得在未经授权的情况下删除、修改、拷贝本软件及其他副本上一切关于版权的信息；
'    2、搜一次网络事业部保留此软件的法律追究权利
'**************************************************************************************************
*/
include "include/label.php";
include "include/userset.php";
$Syc_Name=SafeRequest("names","get");
$S_Content=SafeRequest("content","get");
if(is_utf8($S_Content)) $S_Content=convert_encoding($S_Content, 'GBK' ,'UTF-8');
$S_ID=SafeRequest("id","get");
if(defined('S_Mcode') && S_Mcode=='1'){
	$codehtml="验证码：<input type=\"text\" size=\"4\" id=\"codes\" name=\"codes\" style=\"background:#fffff9;border:1px #eaeaea solid;\" onClick=\"javascript:$('#imgcode').css('display','')\">&nbsp;<img src=\"include/code.php\"   id=\"imgcode\" style=\"display:none\">";
}else{
	$codehtml='';
	}
if(isset($_COOKIE['S_Name'])){
	$mname=$_COOKIE['S_Name'];
}else{
	$mname=Syc_Name;
 }	
$Gbook="<script type=\"text/javascript\">var _SYC_PATH_ = '".S_SitePath."'; window.jQuery || document.write(unescape(\"%3Cscript%20type%3D%22text/javascript%22%20src%3D%22%0A\")+_SYC_PATH_+unescape(\"js/jquery.js%22%3E%3C/script%3E\"));</script>
<script type=\"text/javascript\" src=\"js/gbookajax.js\"></script><div id=\"syccms_message\" style=\"width:100%;\"><img src=\"images/faces/loading.gif\"><font style=\"font-size:12px;\">&nbsp;&nbsp;加载留言内容,请稍等......</font></div>
<div id=\"syccms_message_add\" style=\"border:1px solid #B5D6E6; height:200px; width:99.8%; margin-top:20px; font-size:12px;\">
<form name=\"form1\" id=\"form1\" action=\"\"><input type=hidden value=\"".$S_ID."\" id=\"vid\">
	<div style=\"width:98%; height:30px; line-height:30px; margin-top:5px;\">&nbsp;你的网名：<input type=\"text\" name=\"names\" id=\"names\" size=\"15\" value=".$mname.">&nbsp;<font color=\"red\">＊</font><span id=\"info\" style=\"color:red\"></span></div>
	<div style=\"margin-top:5px; height:110px; width:100%; \">
		<div style=\"float:left; height:110px; width:70%; margin-left:2px;  \"><textarea name=\"content\" id=\"content\" style=\"width:95%; float:left;\" rows=\"7\"  >".$S_Content."</textarea>&nbsp;<font color=\"red\">＊</font></div>
        <div style=\"float:left; height:80px; color:#36C;  font-size:12px;line-height:20px;\">声明：您如果有什么建议或意见<br/>请在这里给管理员留言<br/>您所发的信息不能触犯国家法律<br/>否者您需对自己言行负全部责任！</div>
    </div>
	<div style=\"margin-top:5px;\">&nbsp;&nbsp;".$codehtml."<input type=\"button\" value=\"我要留言\" style=\" background:url(images/common/btn.gif); border:0px solid #CCC; color:#39F; height:31px; width:96px; border-left:0px solid red; margin-top:5px; font-weight:bold; \" id=\"add\" ></div>
    </form></div>
    </div>
    </div>
";
if(file_exists(_SYC_ROOT_.S_Templateurl."gbook.html")){
	$Mark_Text=GetTemp("gbook.html",0);
	$Mark_Text=ReplaceStr($Mark_Text,"{syccms:gbook}",$Gbook);
	echo $Mark_Text;
	}
else{
	die("留言本模版不存在!");
	}
	
function is_utf8($string) {
// From http://w3.org/International/questions/qa-forms-utf-8.html
return preg_match('%^(?:
[\x09\x0A\x0D\x20-\x7E] # ASCII
| [\xC2-\xDF][\x80-\xBF] # non-overlong 2-byte
| \xE0[\xA0-\xBF][\x80-\xBF] # excluding overlongs
| [\xE1-\xEC\xEE\xEF][\x80-\xBF]{2} # straight 3-byte
| \xED[\x80-\x9F][\x80-\xBF] # excluding surrogates
| \xF0[\x90-\xBF][\x80-\xBF]{2} # planes 1-3
| [\xF1-\xF3][\x80-\xBF]{3} # planes 4-15
| \xF4[\x80-\x8F][\x80-\xBF]{2} # plane 16
)*$%xs', $string);

} // function is_utf8 	
?>