<?php
require('include/header.php');
$result = mysql_query("SELECT * FROM ".$prefix."categories");
$num_rows = mysql_num_rows($result);
$vertables = $num_rows/4;
$tablecount = 0;
$lus = 0;
$query1 = mysql_query("SELECT * FROM ".$prefix."categories");
echo "<table border='0' width='850'>";
echo "<tr>";
echo "<td valign='top'>";
while ($row1 = mysql_fetch_array($query1)) {
$lus = $lus + 1;
include ('include/positioning.php');
$catname = $row1['cat_name'];
$catid = $row1['cat_id'];
$catinfo = $row1['cat_info'];
echo "<table class='table' width='200' class='table'>
<tr class='table_header'>
<td colspan='2'>$catname</td>
</tr>";
echo "<tr class='cell_content'>
<td class='cell_content' colspan='2'><center>$catinfo</center></td>
</tr>";
$query2 = mysql_query("SELECT * FROM ".$prefix."links WHERE link_category='".$catid."'");
while ($row2 = mysql_fetch_array($query2)) {
$linkid = $row2['link_id'];
$linkname = $row2['link_name'];
$linkurl = $row2['link_url'];
$linkclicks = $row2['link_clicks'];
$description = $row2['link_description'];
echo "<tr class='cell_content'>
<td class='cell_content'><a target='_blank' title='$description' href='outgoing.php?linkid=$linkid'>$linkname</a></td>";
$query4 = mysql_query("SELECT * FROM ".$prefix."settings WHERE id=1");
while ($row4 = mysql_fetch_array($query4)) {
$clicks = $row4['clicks'];
if ($clicks == 1) {
echo "<td class='cell_content'>";
echo $linkclicks;
echo "</td>";
}
}
echo "</tr>";
}
$query3 = mysql_query("SELECT * FROM ".$prefix."settings WHERE id=1");
while ($row3 = mysql_fetch_array($query3)) {
$link_request = $row3['link_request'];
if ($link_request == 1) {
echo "<tr class='row3'>";
echo "<td colspan='2'><a href='link_req.php'>Add your link</a></td>";
echo "</tr>";
}
}
echo "</table><br>";
$tablecount = $tablecount + 1;
if ($tablecount >= $vertables) {
echo "</td>";
echo "<td valign='top'>";
$tablecount = 0;
}
}
echo "</td>";
echo "</tr>";
echo "</table>";
require('include/footer.php');
?>