<?php
/*
 * 74cms 个人会员中心
 * ============================================================================
 * 版权所有: 骑士网络，并保留所有权利。
 * 网站地址: http://www.74cms.com；
 * ----------------------------------------------------------------------------
 * 这不是一个自由软件！您只能在不用于商业目的的前提下对程序代码进行修改和
 * 使用；不允许对程序代码以任何形式任何目的的再发布。
 * ============================================================================
*/
if(!defined('IN_QISHI')) die('Access Denied!');
$page_select="user";
require_once(dirname(dirname(dirname(__FILE__))).'/include/common.inc.php');
$smarty->cache = false;
require_once(QISHI_ROOT_PATH.'include/mysql.class.php'); 
require_once(QISHI_ROOT_PATH.'include/fun_user.php');
require_once(QISHI_ROOT_PATH.'include/fun_hunter.php');
$db = new mysql($dbhost,$dbuser,$dbpass,$dbname);
$act = !empty($_REQUEST['act']) ? trim($_REQUEST['act']) : 'index';
	if ($_SESSION['uid']=='' || $_SESSION['username']=='')
	{
		header("Location: ".url_rewrite('QS_index')."");
	}
	elseif ($_SESSION['utype']!='3')
	{
		$link[0]['text'] = "会员中心";
		$link[0]['href'] = url_rewrite('QS_index');
		showmsg('您访问的页面需要 猎头会员 登录！系统将跳转到您的会员中心',1,$link);
	}
	$hunter_profile = get_hunter($_SESSION['uid']);
	$hunter_profile = array_map("addslashes", $hunter_profile);
	$smarty->assign('hunter_profile',$hunter_profile);	
	// 创建名片
	if(empty($hunter_profile['fullname']) && $act!="create_hunter" && $act!="create_hunter_save")
	{
		header('location:hunter_info.php?act=create_hunter');
	}
	// 实名认证，从业认证，照片认证
	if(($hunter_profile['card_audit']!="1" || $hunter_profile['belongcompany_audit']!="1" || $hunter_profile['avatars_audit']!="1") && $act!="auth_info" && $act!="auth_name_update" && $act!="auth_name_card_save" && $act!="auth_work_save" && $act!="auth_photo_save" &&  $act!="avatars_update" && $act!="profile" && $act!="profile_save" && $act!="create_hunter" && $act!="create_hunter_save" && $act!='collaborative_save' && $act!='collaborative_del' && $act!='binding')
	{
		$link[0]['text'] = "认证信息";
		$link[0]['href'] = 'hunter_info.php?act=auth_info';
		exit(showmsg('您还没有完成认证信息,请先认证信息！',1,$link));
	}
	$user=get_user_info($_SESSION['uid']);	
	if (empty($user))
	{
	unset($_SESSION['utype'],$_SESSION['uid'],$_SESSION['username']);
	header("Location: ".url_rewrite('QS_index')."");
	}
	elseif ($user['status']=="2" && $act!='index' && $act!='user_status'  && $act!='user_status_save') 
	{
		$link[0]['text'] = "设置账号状态";
		$link[0]['href'] = 'personal_user.php?act=user_status';
		$link[1]['text'] = "返回会员中心首页";
		$link[1]['href'] = 'personal_index.php?act=';
		exit(showmsg('您的账号处于暂停状态，请先设为正常后进行操作！',1,$link));	
	}

	if ($_CFG['login_per_audit_email'] && $user['email_audit']=="0" && $act!='user_email' && $act!='user_mobile')
	{
		$link[0]['text'] = "认证邮箱";
		$link[0]['href'] = 'personal_user.php?act=user_email';
		$link[1]['text'] = "网站首页";
		$link[1]['href'] = $_CFG['site_dir'];
		showmsg('您的邮箱未认证，认证后才能进行其他操作！',1,$link,true,6);
		exit();
	}
	$sms=get_cache('sms_config');
	if ($_CFG['login_per_audit_mobile'] && $user['mobile_audit']=="0" && $act!='user_mobile' && $act!='user_email' && $sms['open']=="1")
	{
		$link[0]['text'] = "认证手机";
		$link[0]['href'] = 'personal_user.php?act=user_mobile';
		$link[1]['text'] = "网站首页";
		$link[1]['href'] = $_CFG['site_dir'];
		showmsg('您的手机未认证，认证后才能进行其他操作！',1,$link,true,6);
		exit();
	}
	// 获取申请提醒未看的数目
	$sql1="SELECT COUNT(*) AS num FROM ".table("pms_sys")."  where uid={$_SESSION['uid']} and is_look=1 ";
	$count1=$db->get_total($sql1);
	$_SESSION['hunter_count']=intval($count1);
	$smarty->assign('sms',$sms);
?>