<?php
if(!defined('IN_MYMPS')) exit('Forbidden');
require MEMBERDIR.'/include/common.func.php';

if($ac == 'del'){

	empty($selectedids) && write_msg('','?m=shoucang&error=1&page='.$page);
	$db -> query("DELETE FROM `{$db_mymps}shoucang` {$where} AND id ".create_in($selectedids));
	write_msg('','?m=shoucang&success=3&page='.$page);

}elseif($ac == 'delthis'){
	
	if(!$id) write_msg('','?m=shoucang&error=1&page='.$page);
	$db->query("DELETE FROM `{$db_mymps}shoucang` WHERE id = '$id' AND userid = '$s_uid'");
	write_msg('','?m=shoucang&success=3&page='.$page);
	
} else {
	
	$sql = "SELECT a.*,b.catname,b.dir_typename,b.cityid FROM {$db_mymps}shoucang AS a LEFT JOIN {$db_mymps}information AS b ON a.infoid = b.id $wherea ORDER BY a.id DESC";
	
	$rows_num = mymps_count("shoucang",$where);
	$param	  = setParam(array("m"));
	$list     = array();
	
	foreach(page1($sql) as $k => $row){
		$arr['id']          = $row['id'];
		$arr['title']  	    = SpHtml2Text($row['title']);
		$arr['intime']   	= get_format_time($row['intime']);
		$arr['url']  		= Rewrite('info',array('id'=>$row['infoid'],'dir_typename'=>$row['dir_typename'],'cityid'=>$row['cityid']));
	
		$list[]= $arr;
	}
	$location = location();
	include mayi_tpl('shoucang');
	
}
?>