php代码
2088shop商城购物系统是商城系统中功能最全的一个版本:非会员购物、商品无限级分类、不限商品数量、商品多级会员定价、上货库存、Word在线编辑器、订单详情销售报表、商品评论、留言簿、管理员多级别、VIP积分、会员注册积分奖励、智能新闻发布、滚动公告、投票调查、背景图片颜色更换、店标上传、版权联系方式修改、背景音乐(好歌不断)、广告图片支持Flash、弹出浮动广告、搜索引擎关健词优化、图文友情联
无远程图片";
if(preg_match('/(http:\/\/)/i', $row['goods_desc'])){
$aa="Go Get It";
}
echo $row['goods_id']." ".$row['goods_name']." ".$aa."
";
}
exit();
}
sleep(1);
$sql="select `goods_desc` from `p_goods` where `goods_id`='$id' limit 1";
$res=mysql_fetch_array(mysql_query($sql));
preg_match_all('/src=[\'|"]([^"|^\']+)[\'|"]/i', $res[0], $picurl);
$urlArr=$picurl[1];
/*
print_r($urlArr);
die();
$urlArr[]="http://static.oschina.net/uploads/user/129/258733_50.jpg";
$urlArr[]="http://static.oschina.net/uploads/img/201302/16195715_kPci.png";
*/
$num= isset($_GET['num']) ? $_GET['num'] : 1;
$all=count($urlArr);
$url=$urlArr[$num-1];
if(!preg_match('/(http:\/\/)/i', $url)){
if($num >= $all) {
exit('
all done!');
}
echo $url."
已处理";
echo "";
exit();
}
$array=@get_headers($url,1);
echo $url."
";
if(preg_match('/200/',$array[0])){
ob_start();
readfile($url);
$img = ob_get_contents();
ob_end_clean();
$dir="images/goods_desc";
if (!file_exists($dir))
{
mkdir($dir, 0777);
}
$filename=$dir."/".mt_rand(11111,9999999999).time().".jpg";
$f=fopen($filename,'a');
$fres=fwrite($f,$img);
fclose($f);
if($fres!=false){
$goods_desc=str_replace($url,"/".$filename,$res[0]);
$sql="update `p_goods` set `goods_desc` = '$goods_desc' where `goods_id`='$id' limit 1 ";
mysql_query($sql);
}
}
echo $num."/".$all;
if($num >= $all) {
exit('
all done!');
}
else{
echo "";
}
?>









