<?php
	include_once("admin/include/config.php");
	define("THIS_PAGE","job");
	if(!$hm_arr = get_seo(1)){
		$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"]);
	$job_id = trim($_GET["job_id"]);
	if(!check_is_numb($job_id) || $job_id < 1)
		show_err("职位信息参数出错，请返回重新操作");
	$filter_arr[0] = array("0",$job_id,false);
	if(!$hm_arr = get_job($filter_arr))
		show_err("系统中没有你要应聘的职位信息");
	if($action == "save"){
		unset($hm_arr);
		check_site_url();
		array_pop($_POST);//表单提交上来的数据都存入$_POST数组中，现在弹出最后一个数组值，因为最后一个是按纽
		extract($_POST);//把数组名作为变量名，数组值作为变量值

		$user_name = trim($user_name);
		(strlen($user_name) < 1 || check_bad_str($user_name)) ? show_err("请输入你的姓名，或姓名中有非法字符") : $user_name = addslashes($user_name);
		$user_address = trim($user_address);
		(strlen($user_address) < 1 || check_bad_str($user_address)) ? show_err("请输入你的住址，或住址中有非法字符") : $user_address = addslashes($user_address);
		$job_xl = trim($job_xl);
		!is_numeric($job_xl) && show_err("请选择您的学历");
		$user_zy = trim($user_zy);
		(strlen($user_zy) < 1 || check_bad_str($user_zy)) ? show_err("请输入你的专业，或专业中有非法字符") : $user_zy = addslashes($user_zy);
		$user_contact = trim($user_contact);
		(strlen($user_contact) < 1 || check_bad_str($user_contact)) ? show_err("请输入你的联系方式，或联系方式中有非法字符") : $user_contact = addslashes($user_contact);
		
		strlen($job_content) < 9 ? show_err("请输入至少10个英文字符或5个中文字的职位要求") : $job_content = addslashes($job_content);
		mysql_query("insert into hmcss_job_detail (job_id,user_name,user_address,user_xl,user_zy,user_contact,job_content,user_time) values ($job_id,'$user_name','$user_address','$job_xl','$user_zy','$user_contact','$job_content','" . date("Y-m-d H:i:s",time()) . "')")
			or show_err("应聘该职位出错，请联系管理员");
		show_err("您已成功应该该职位","hrm_job_list.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">
input,select{margin:4px auto;}
#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; overflow:hidden;}
</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="index.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_over"></span><span class="left_menu_con"><a href="hrm_job_list.php">企业招聘</a></span>
    </div>
    <div class="left_menu">
    	<span class="left_arr_normal"></span><span class="left_menu_con"><a href="hrm_get.php">福利待遇</a></span>
    </div>
</div>
<div id="right">
	<form id="form1" name="form1" method="post" action="get_job.php?action=save&job_id=<?php echo $job_id; ?>">
	<div class="hrm_job">
    	<ul>
        	<li style="width:100px; font-weight:bold;">所聘职位：</li>
            <li style="width:150px; text-align:center; text-indent:0px;" title="<?php echo stripslashes($hm_arr[0][1]); ?>"><?php echo stripslashes($hm_arr[0][1]); ?></li>
            <li style="width:80px; font-weight:bold;">地点：</li>
            <li style="width:130px; text-align:center; text-indent:0px;" title="<?php echo stripslashes($hm_arr[0][2]); ?>"><?php echo stripslashes($hm_arr[0][2]); ?></li>
            <li style="width:100px; font-weight:bold;">学历要求：</li>
            <li style="width:232px; text-align:center; text-indent:0px;" title=" <?php echo get_user_xl($hm_arr[0][3]); ?>"><?php echo get_user_xl($hm_arr[0][3]); ?></li>
        	<li style="width:100px; font-weight:bold;">姓名：</li>
            <li style="width:150px; text-align:center;">
                <input name="user_name" type="text" id="user_name" size="15" maxlength="10" />
            </li>
            <li style="width:80px; font-weight:bold;">学历：</li>
            <li style="width:130px; text-align:center;">
              <?php echo get_user_xl(); ?>
            </li>
            <li style="width:100px; font-weight:bold;">所学专业：</li>
            <li style="width:232px; text-align:center;">
              <input name="user_zy" type="text" id="user_zy" size="28" maxlength="50" />
            </li>
            <li style="width:100px; font-weight:bold;">住址：</li>
            <li style="width:362px; text-align:center;">
              <input name="user_address" type="text" id="user_address" size="50" maxlength="100" />
            </li>
            <li style="width:100px; font-weight:bold;">联系方式：</li>
            <li style="width:232px; text-align:center;">
              <input name="user_contact" type="text" id="user_contact" size="28" maxlength="50" />
            </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="job_content" name="job_content" rows="10" style="margin:0px auto;"></textarea>
                 <script type="text/javascript">
            if (typeof CKEDITOR == 'undefined') {
            	document.write('加载CKEditor失败');
            	}
            	else {
            	var editor = CKEDITOR.replace('job_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>