<?php
 /*
 * 74cms 举报
 * ============================================================================
 * 版权所有: 骑士网络，并保留所有权利。
 * 网站地址: http://www.74cms.com；
 * ----------------------------------------------------------------------------
 * 这不是一个自由软件！您只能在不用于商业目的的前提下对程序代码进行修改和
 * 使用；不允许对程序代码以任何形式任何目的的再发布。
 * ============================================================================
*/
define('IN_QISHI', true);
require_once(dirname(__FILE__).'/../include/common.inc.php');
$act = isset($_REQUEST['act']) ? trim($_REQUEST['act']) : 'report';
require_once(QISHI_ROOT_PATH.'include/mysql.class.php');
require_once(QISHI_ROOT_PATH.'include/fun_user.php');
$db = new mysql($dbhost,$dbuser,$dbpass,$dbname);

if ($_SESSION['uid']=='' || $_SESSION['username']=='')
{
	$captcha=get_cache('captcha');
	$smarty->assign('verify_userlogin',$captcha['verify_userlogin']);
	$smarty->display('plus/ajax_login.htm');
	exit();
}
if ($_SESSION['utype']!='1' && $_SESSION['utype']!='3')
{
	exit('<div class="floatContent">
			<div class="float_common_box">
				<div class="float_tips">
					<div>必须是企业会员/猎头会员才可以举报通讯录信息！</div>
				</div> 
			</div>
		</div>');
}
if($_SESSION['utype']=="1")
{
	require_once(QISHI_ROOT_PATH.'include/fun_company.php');
}
elseif($_SESSION['utype']=="3")
{
	require_once(QISHI_ROOT_PATH.'include/fun_hunter.php');
}
$user=get_user_info($_SESSION['uid']);
if ($user['status']=="2") 
{
	exit('<div class="floatContent">
			<div class="float_common_box">
				<div class="float_tips">
					<div>您的账号处于暂停状态，请联系管理员设为正常后进行操作！</div>
				</div> 
			</div>
		</div>');
}
if ($act=="report")
{		
	$id=isset($_GET['list_id'])?$_GET['list_id']:exit("id 丢失");
	$list_info=get_list_one($id);
	if (empty($list_info))
	{
		exit('<div class="floatContent">
				<div class="float_common_box">
					<div class="float_tips">
						<div>举报信息失败！</div>
					</div> 
				</div>
			</div>');
	}
	if (check_list_report($_SESSION['uid'],intval($_GET['list_id'])))
	{
		exit('<div class="floatContent">
				<div class="float_common_box">
					<div class="float_tips">
						<div>您已经举报过此通讯录！</div>
					</div> 
				</div>
			</div>');
	}
?>
<script type="text/javascript">
$(".but80").hover(function(){$(this).addClass("but80_hover")},function(){$(this).removeClass("but80_hover")});
//计算今天申请数量

//验证
$("#ajax_report").die().click(function() {
	var content=$("#content").val();
	if (content=="")
	{
	alert("请输入具体描述");
	}
	else
	{
		$("#report").hide();
		$("#waiting").show();
		$.post("<?php echo $_CFG['site_dir'] ?>user/user_report_list.php", { "list_id": $("#list_id").val(),"title": $("#title").val(),"content": $("#content").val(),"type": $("#type").val(),"act":"report_save"},

	 	function (data,textStatus)
	 	 {
			if (data=="ok")
			{
				$("#report").hide();
				$("#waiting").hide();
				$("#app_ok").show();
				$("#app_ok .closed").click(function(){
				});
			}
			else
			{
				$("#report").hide();
				$("#waiting").hide();
				$("#app_ok").show();
				$(".float_auth_success").html("举报失败！"+data);

			}
	 	 });
	}
});
function DialogClose()
{
	$("#FloatBg").hide();
	$("#FloatBox").hide();
}
</script>

<div class="floatContent" id="report">
	<div class="float_common_box">
		<table class="float_auth_table">
			<tbody>
				<input type="hidden" id="list_id" value="<?php echo intval($_GET['list_id']);?>">
				<input type="hidden" id="title" value="<?php echo trim($_GET['title']);?>">
				<tr height="40">
					<td align="right">投诉的通讯录：</td>
					<td>
						<div class="float_control">
							<?php echo trim($_GET['title']);?>
						</div>
					</td>
				</tr>
				<tr height="40">
					<td align="right">投诉类型：</td>
					<td>
						<div class="float_control">
							<select name="type" id="type">
								<option value="1">内容虚假违法</option>
								<option value="2">内容不符</option>
								<option value="3">其他</option>
							</select>
						</div>
					</td>
				</tr>
				<tr height="40">
					<td align="right">其他描述：</td>
					<td>
						<div class="float_control">
							<textarea name="content" id="content"  style="width:300px; height:60px; line-height:180%; font-size:12px;border：1px solid "></textarea>
						</div>
					</td>
				</tr>
			</tbody>
		</table>
		<div class="float_btn_guoup">
			<input type="submit" value="提交" name="Submit2" class="float_but55lan" id="ajax_report">&nbsp;&nbsp;&nbsp;
			<input type="button" value="取消" class="float_but55hui DialogClose">
		</div>
	</div>
</div>
<div class="floatContent" style="display:none" id="waiting" >
	<div class="float_common_box" >
		<img src="<?php echo  $_CFG['site_template']?>images/30.gif" style="margin-left:110px;"  border="0"/>
	</div>
</div>
<div class="floatContent" style="display:none" id="app_ok" >
	<div class="float_common_box" >
		<div class="float_auth_success">举报成功，管理员会认真处理</div>
	</div>
</div>
<?php
}

elseif ($act=="report_save")
{
	$setsqlarr['uid']=intval($_SESSION['uid']);
	$setsqlarr['utype']=intval($_SESSION['utype']);
	$member = $db->getone("select * from ".table('members')." where uid =".$_SESSION['uid']." limit 1");
	$setsqlarr['username']=intval($member['username']);
	$setsqlarr['list_id']=$_POST['list_id']?intval($_POST['list_id']):exit("出错了");
	$setsqlarr['list_title']=trim($_POST['title'])?trim($_POST['title']):exit("出错了");
	$setsqlarr['report_type']=intval($_POST['type']);
	$setsqlarr['content']=trim($_POST['content'])?trim($_POST['content']):exit("出错了");
	$setsqlarr['addtime']=time();
	
	$list=get_list_one($setsqlarr['list_id']);
	if (empty($list))
	{
		exit("通讯录丢失");
	}
	else
	{
		$insert_id = inserttable(table('report_list'),$setsqlarr,1);
	}
	if($insert_id)
	{
		exit("ok");
	}
}

?>
