<?php
if(!defined('IN_MYMPS')) exit('Forbidden');
$id = isset($_REQUEST['id']) ? intval($_REQUEST['id']) : '';
$action = isset($_GET['action']) ? htmlspecialchars($_GET['action']) : '';

@include 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 * FROM {$db_mymps}shoucang $where ORDER BY id DESC";
	
	$rows_num = mymps_count("shoucang",$where);
	$param	  = setParam(array("m"));
	$list     = array();

/**
 *@2015/2/1修复手机版收藏点击链接不跳转到手机界面bug
 *@网路者工作室
 *@wangluzhe.com、
 *@ltrim(substr_replace());
 */	
	foreach(page1($sql) as $k => $row){
		$arr['id']          = $row['id'];
		$arr['title']  	    = SpHtml2Text($row['title']);
		$arr['intime']   	= get_format_time($row['intime']);
		$arr['url']  		= $mymps_global['SiteUrl'].$row['url']; 
	//==========start=========//
		$str = $row['url'];
		$arr['url'] = $mymps_global['SiteUrl']."/m/index.php?mod=".ltrim(substr_replace($str,"information&id=",0,20));

		//echo $arr['url'] ;
		//die;
	//==========end=========//
		$list[]= $arr;
		
	}
	//$location = location();
	include mymps_tpl('member_shoucang');  //修复加载模板文件名错误
	
}
?>