<?php
	include_once("admin/include/config.php");
	define("THIS_PAGE","ly");
	if(!$hm_arr = get_seo(2)){
		$hm_title = $hm_key = $hm_des = hmcss_default_config(1);
	}
	else{
		$hm_title = $hm_arr[0][2];
		$hm_key = $hm_arr[0][3];
		$hm_des = $hm_arr[0][4];
	}
	$action = trim($_GET["action"]);
	if($action == "save"){
		check_site_url();
		array_pop($_POST);//表单提交上来的数据都存入$_POST数组中，现在弹出最后一个数组值，因为最后一个是按纽
		extract($_POST);//把数组名作为变量名，数组值作为变量值
		$ly_user = trim($ly_user);
		(strlen($ly_user) <2 || check_bad_str($ly_user)) ? show_err("请输入留言名，您的输入中有非法字符") : $ly_user = addslashes($ly_user);
		$ly_contact = trim($ly_contact);
		check_bad_str($ly_contact) ? show_err("您输入的联系人中含有非法字符") : $ly_contact = addslashes($ly_contact);
		//产品介绍
		strlen($ly_content) < 9 ? show_err("请输入至少10个英文字符或5个中文字的留言信息") : $ly_content = addslashes($ly_content);
		mysql_query("insert into hmcss_ly_main (ly_user,ly_contact,ly_content,ly_time) values ('$ly_user','$ly_contact','$ly_content','" . date("Y-m-d H:i:s",time()) . "')")
			or show_err("添留言出错，请联系管理员");
		show_err("您已留言成功","online_ly.php");
	}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><?php echo $hm_title; ?></title>
<meta name="description" content="<?php echo $hm_des; ?>" />
<meta name="keywords" content="<?php echo $hm_key; ?>" />
<link rel="stylesheet" type="text/css" href="style.css" />
<style type="text/css">
#out{width:1000px; overflow:hidden; min-height:600px; height:auto; background-image:url(pics/bg/left_bg.gif); background-repeat:repeat-y;}
#right{width:800px; height:auto!important; height:auto; float:left; text-indent:2em; padding:10px 0px; line-height:20px;}
.hrm_job{margin:10px auto; width:798px; border-top:1px #CCC solid; border-left:1px #CCC solid; overflow:hidden;}
	.hrm_job ul{list-style:none; margin:0px; padding:0px;}
	.hrm_job li{list-style:none; float:left; text-indent:1em; color:#666; border-bottom:1px #CCC solid; border-right:1px #CCC solid; height:30px; line-height:30px;}
</style>
<script type="text/javascript" src="ckeditor/ckeditor.js"></script>
</head>

<body>
<?php require_once("top.php"); ?>
<div class="now_position"><span class="position_str">当前位置：<a href="index.php">首页</a>-><a href="online_ly.php">在线留言</a>->写新留言</span><span class="im_notice">
<marquee direction="left" scrolldelay="100" onmouseout="this.start()" onmouseover="this.stop()" style="width:400px;">
<?php hmcss_notice(); ?>
</marquee></span></div>
<div id="out">
<div id="left">
	<div class="left_menu">
    	<span class="left_arr_normal"></span><span class="left_menu_con"><a href="online_ly.php">留言查看</a></span>
    </div>
    <div class="left_menu">
    	<span class="left_arr_over"></span><span class="left_menu_con"><a href="online_ly_new.php">我要留言</a></span>
    </div>
</div>
<div id="right">
	<form id="form1" name="form1" method="post" action="online_ly_new.php?action=save">
	<div class="hrm_job">
    	<ul>
        	<li style="width:100px; font-weight:bold;">留言人：</li>
            <li style="width:130px; text-align:center;">
                <input name="ly_user" type="text" id="ly_user" size="10" maxlength="10" />
          </li>
            <li style="width:100px; font-weight:bold;">联系方式：</li>
            <li style="width:464px; text-align:center;">
              <input name="ly_contact" type="text" id="ly_contact" value="" size="40" maxlength="50" /> 
              您的固话、手机、QQ等
</li>
            <li style="width:797px; text-align:center; font-weight:bold;">留言内容</li>
            <li style="width:787px; height:auto; padding:5px; text-indent:0px;">
            	<textarea cols="80" id="ly_content" name="ly_content" rows="10" style="margin:0px auto;"></textarea>
                 <script type="text/javascript">
            if (typeof CKEDITOR == 'undefined') {
            	document.write('加载CKEditor失败');
            	}
            	else {
            	var editor = CKEDITOR.replace('ly_content');
            	}
                CKEDITOR.config.height = 400;
            </script>
            </li>
            <li style="width:777px; height:60px; text-align:center; padding:0px 10px;"><input type="image" src="pics/offer_jl.gif" style="margin:9px auto;" /></li>
        </ul>
    </div>
    </form>
</div>
</div>
<div id="foot"><?php unset($hm_arr,$filter,$hm_arr_news,$config_arr); hmcss_foot(); ?></div>
</body>
</html>