<?php
!defined('IN_MYMPS') && exit('FORBIDDEN');
define('IN_MYMPS',true);
define('MEMBERDIR',MYMPS_ROOT.'/member');
require MYMPS_DATA."/config.db.php";
require MYMPS_INC."/db.class.php";
require MYMPS_INC."/member.class.php";

if(!$id) write_msg('删除的信息主题ID不能为空！');
if(!$infoid = $db->getOne("SELECT id FROM `{$db_mymps}information` WHERE id = '$id' AND info_level > 0")) write_msg('您要删除的信息不存在或者正在审核中!','olmsg');

$post	= is_member_info($id);
$manage_pwd = isset($manage_pwd) ? trim($manage_pwd) : '';

if(empty($manage_pwd) && !$post['ismember']){
	
	include MYMPS_ROOT.'/template/box/info_write_pwd.tpl.php';

}elseif(!empty($manage_pwd)||$post['ismember']==1){

	if($post['ismember'==0] && $post['managepwd'] == md5($manage_pwd)){
		$db->query("UPDATE `{$db_mymps}information` SET info_level = '-1' WHERE id = '$id'");
		write_msg("成功删除编号为 $id 的信息主题！",'olmsg');
	}else{
		write_msg("您输入了错误的管理密码，或者该信息不是游客发布的！",'olmsg');
	}

	if($post['ismember'] == 1){
		if(!$member_log -> chk_in()){
			@include MYMPS_DATA.'/caches/authcodesettings.php';
			$authcodesettings = $data;
			$data = NULL;
			$gourl = 'delinfo';
			include MYMPS_ROOT.'/template/box/login.tpl.php';
			$authcodesettings = NULL;
			exit;
		} elseif($s_uid != $post['userid']){
			write_msg("删除失败！该信息不是您发布的！","olmsg");
			exit;
		}
	}

}
?>