Does anyone know how to fix this? I want to display top 50 downloaded files . The files are displayed , but only those who were downloaded less than 10 times (like 9,8,7..etc)Here is the php code. Thanks
PHP Code:
<?php
define('_IN_JOHNCMS', 1);
$headmod = 'loadtop';
require_once ("../incfiles/core.php");
$filesroot = "../download";
$loadroot = "$filesroot/files";
$cat = intval($_GET['cat']);
$sort = $_GET['sort'];
require_once ("../incfiles/head.php");
echo'<div class="phdr">Top 50</div>';
$req = mysql_query("SELECT * FROM `download` ORDER BY `download`.`ip` DESC LIMIT 0 , 50");
$total = mysql_result($req, 0);
$zap = mysql_query("SELECT * FROM `download` ORDER BY `download`.`ip` DESC LIMIT 0 , 50");
while ($newf = mysql_fetch_array($zap)) {
echo $i % 2 ? '<div class="list2">' : '<div class="list1">';
$fsz = filesize("$newf[adres]/$newf[name]");
$fsz = round($fsz / 1024, 2);
$ft = functions::format("$newf[adres]/$newf[name]");
switch ($ft) {
case "mp3" :
$imt = "mp3.png";
break;
case "zip" :
$imt = "rar.png";
break;
case "jar" :
$imt = "jar.png";
break;
case "gif" :
$imt = "gif.png";
break;
case "jpg" :
$imt = "jpg.png";
break;
case "png" :
$imt = "png.png";
break;
default :
$imt = "file.gif";
break;
}
if ($newf['text'] != "") {
$tx = $newf['text'];
if (mb_strlen($tx) > 100) {
$tx = mb_substr(strip_tags($tx), 0, 90);
$tx = "<br/>$tx...";
}
else {
$tx = "<br/>$tx";
}
}
else {
$tx = "";
}
echo '<img src="' . $filesroot . '/img/' . $imt . '" alt=""/><a href="index.php?act=view&file=' . $newf['id'] . '">' . htmlentities($newf['name'], ENT_QUOTES, 'UTF-8') . '</a> (' . $fsz . ' Kb)' . $tx . '<br/>';
$nadir = $newf['refid'];
$pat = "";
while ($nadir != "") {
$dnew = mysql_query("select * from `download` where type = 'cat' and id = '" . $nadir . "'");
$dnew1 = mysql_fetch_array($dnew);
$pat = "$dnew1[text]/$pat";
$nadir = $dnew1['refid'];
}
$l = mb_strlen($pat);
$pat1 = mb_substr($pat, 0, $l - 1);
echo "[$pat1]</div>";
++$i;
}
echo '<div class="phdr">' . $lng['total'] . ': 50</div>';
echo "<p><a href='index.php?'>" . $lng['back'] . "</a></p>";
require_once ('../incfiles/end.php');
?>
Comment