<?php
$obj_tab_msgbook=new cls_tab_other_msgbook();
if(isset($get_act)&&$get_act=="save"&&isset($_POST["btn_ok"])&&$_POST["btn_ok"]!=""){
	$str_code=get_safecode($get_msgboxcode);
	if($str_code!=get_cookie("user_code_msgbox")){
		$obj_msg->alert("验证码不正确！");
		$obj_msg->on_history_back();
		exit;
	}

	$arr_fields=array();
	if(!isset($get_msg_name)||$get_msg_name==""){
		$obj_msg->alert("咨询姓名不能为空！");
		$obj_msg->on_history_back();
		exit;
	}
	if(!isset($get_msg_msg)||$get_msg_msg==""){
		$obj_msg->alert("咨询内容不能为空！");
		$obj_msg->on_history_back();
		exit;
	}
	$arr_fields["msg_name"]=$get_msg_name;
	$arr_fields["msg_area"]=$get_msg_area;
	$arr_fields["msg_msg"]=$get_msg_msg;
	$arr_msg=$obj_tab_msgbook->on_save($arr_fields);
	if($arr_msg["err"]!=""){
		$obj_msg->alert($arr_msg["err"]);
	}else{
		$obj_msg->alert("成功提交，请关注回复！");
	}
}
$int_pagesize=20;
(isset($get_page))?$get_page=intval($get_page):$get_page=1;
$str_where=" where msg_hide=0";
$obj_rs  = $obj_db->get_one("SELECT count(*) as num FROM ".DB_PRE."other_msgbook".$str_where);
$int_total=$obj_rs["num"];
$int_pages= ceil($int_total/$int_pagesize);
$get_page = min($int_pages, $get_page);
$get_page = max($get_page, 1);
$page_split_page=get_pages_html($int_total, $get_page, $int_pagesize,"?app=".$get_app);
$int_offset = $int_pagesize*($get_page-1);
$str_limit = " limit ".$int_offset.",".$int_pagesize;
$obj_result = $obj_db->query("SELECT * FROM ".DB_PRE."other_msgbook".$str_where." order by msg_addtime desc".$str_limit);
$arr_msgbook=array();
while($obj_rs = $obj_db->fetch_array($obj_result)){
	$obj_rs["addtime"]=format_date($obj_rs["msg_addtime"],"Y-m-d");
	$arr_msgbook[]=$obj_rs;
}
?>