Commit 6f0ceff9 authored by Andrew's avatar Andrew

list

parent f22357e5
<?
function repare_ad($ad, $ip=0){
if(!$ip)
$ip=ip2long("127.0.0.1");
$data=$ad['data'][$ip%sizeof($ad['data'])];
unset($ad['data']);
$ad['price']=str_replace('$[price]', $data['price'], $ad['price']);
$ad['ad_id'].="_".$data['l_path'];
$ad['link'] ="//".$_SERVER['HTTP_HOST'].'/tgo?l='.$ad['link'].$data['l_path'].'&s='.$ad['ad_id'];
$ad['image']= "//".$_SERVER['HTTP_HOST'].'/timg/'.$ad['image'];
return $ad;
}
\ No newline at end of file
...@@ -5,6 +5,8 @@ if($_SERVER['REQUEST_URI']=='/dsp') ...@@ -5,6 +5,8 @@ if($_SERVER['REQUEST_URI']=='/dsp')
else if(preg_match("/^\/ndsp\?/", $_SERVER['REQUEST_URI'])) else if(preg_match("/^\/ndsp\?/", $_SERVER['REQUEST_URI']))
require("pages/ndsp.php"); require("pages/ndsp.php");
else if(preg_match("/^\/ndsp_list/", $_SERVER['REQUEST_URI']))
require("pages/ndsp_list.php");
else if(preg_match("/^\/go\?/", $_SERVER['REQUEST_URI'])) else if(preg_match("/^\/go\?/", $_SERVER['REQUEST_URI']))
require("pages/go.php"); require("pages/go.php");
......
...@@ -9,20 +9,16 @@ $ip=ip2long($_GET['ip']); ...@@ -9,20 +9,16 @@ $ip=ip2long($_GET['ip']);
if(!$ip) if(!$ip)
die; die;
require_once("inc/func.php");
require_once("inc/goods.php"); require_once("inc/goods.php");
$res=array(); $res=array();
foreach ($goods as $ads) { foreach ($goods as $ads) {
$ad=$ads[mt_rand(1,10000)%sizeof($ads)]; $ad=$ads[mt_rand(1,10000)%sizeof($ads)];
$data=$ad['data'][$ip%sizeof($ad['data'])]; $ad=repare_ad($ad, $ip);
unset($ad['data']);
$ad['price']=str_replace('${price}', $data['price'], $ad['price']);
$ad['ad_id'].="_".$data['l_path'];
$ad['link'] ="//".$_SERVER['HTTP_HOST'].'/tgo?l='.$ad['link'].$data['l_path'].'&s='.$ad['ad_id'];
$ad['image']= "//".$_SERVER['HTTP_HOST'].'/timg/'.$ad['image'];
$ad['cpc']=0.02; $ad['cpc']=0.02;
if(iconv_strlen($ad['title'])<=50 && iconv_strlen($ad['description'])<=50)
$res[]=$ad; $res[]=$ad;
} }
......
<?
require_once("inc/goods.php");
require_once("inc/func.php");
$res=array();
foreach ($goods as $ads) {
foreach ($ads as $ad) {
$ad=repare_ad($ad);
echo '<table width=800><tr><td width=150>';
echo '<img width=150 height=150 src="'.$ad['image'].'"></td>';
echo '<td><a href="'.$ad['link'].'"><span'.((iconv_strlen($ad['title'])>50)?' style="color:red"':'').'>'.$ad['title'].'</span></a><br>';
echo '<span'.((iconv_strlen($ad['description'])>50)?' style="color:red"':'').'>'.$ad['description']."</span><br><i>".$ad['price']."</i></td></tr></table>";
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment