Hallo,
Het onderste script laat alles zien wil graag dat er maar 10 wordt weergegeven en kom er helaas niet zelf uit heb $rows=mysql_num_rows($result); en limit probeert!
Wie weet hoe dat moet
Gr,
Destre
<?php
$replace_site_name=array(
'url1.com'=>'sitename 1',
'site2.com'=>'sitename 2'
);
$sort=sql_inj_str($sort);
$order=sql_inj_str($_GET[ratiodata]);
$timelength=sql_inj_str($_GET[timelength]);
if($_GET[sort]=="desc"){$sort="asc";}else{$sort="desc";}
?>
<table>
<tr>
<td><a href=?ratiodata=url&sort=<?php print $sort;?>&timelength=<?php print $timelength;?>>URL</a></td>
<td><a href=?ratiodata=clicksin&sort=<?php print $sort;?>&timelength=<?php print $timelength;?>>In</a></td>
<td><a href=?ratiodata=clicksout&sort=<?php print $sort;?>&timelength=<?php print $timelength;?>>Out</a></td>
<td><a href=?ratiodata=ratio&sort=<?php print $sort;?>&timelength=<?php print $timelength;?>>Ratio</a></td>
</tr>
<?php
if($_GET[ratiodata]==""){$order="url";}
if($timelength=="" OR $timelength=="total")
{
$result=mysql_query("SELECT url,time,count(*) as clicksin,sum(clicks) as clicksout,(count(*)/sum(clicks)) as ratio FROM data_submit_ratio GROUP BY
url ORDER BY $order $sort") or die (mysql_error());
}
elseif($timelength=="today")
{
$daytime=time()-86400;
$result=mysql_query("SELECT url,time,count(*) as clicksin,sum(clicks) as clicksout,(count(*)/sum(clicks)) as ratio FROM data_submit_ratio GROUP BY
url HAVING time>$daytime ORDER BY $order $sort") or die (mysql_error());
}
while($row=mysql_fetch_array($result))
{
@$ratio=$row[clicksin]/$row[clicksout];
$ratio=ceil($ratio*100);
if(array_key_exists($row[url],$replace_site_name)){$site_name=$replace_site_name[$row[url]];}else{$site_name=$row[url];}
?>
<tr>
<td><a href=out.php?url=<?php print $row[url];?> target=_new><?php print $site_name;?></a></td>
<td><?php print $row[clicksin];?></td>
<td><?php print $row[clicksout];?></td>
<td><?php print $ratio;?>%</td>
</tr>
<?php
}
?>
<tr>
<td colspan=4 align=center><a href=?timelength=total>Total</a> - <a href=?timelength=today>Today</a></td
</table>
352 views