// Copyright 2001 Steve Gliebe. All rights reserved.
require("common.php");
######### CLICK COUNT #########
if ($QUERY_STRING && $LID && $URL) {
mysql_query("UPDATE $link_table SET Clicks = Clicks+1 WHERE ID = $LID"); // add 1 to click count
header("Location: $URL"); // send user to website
}
######### PRINT HEADER/MENU #########
require("$header_html");
if ($public_add == "yes" || $QUERY_STRING) {
echo "\n
\n";
echo "
\n";
echo " \n";
echo " \n";
}
if ($public_add == "yes" && $action != "add_link") {
echo " Add a link\n";
}
if ($mode == "flat" && $action == "add_link") {
echo " Back to links\n";
}
if ($mode == "leveled" && $QUERY_STRING) {
echo " Back to categories\n";
}
if ($public_add == "yes" || $QUERY_STRING) {
echo " | \n";
echo "
\n";
echo "
\n";
echo "\n";
}
######### FLAT MODE #########
if ($mode == "flat" && !$QUERY_STRING) {
$query = "SELECT $link_table.ID AS LID, Clicks, Website, URL, $link_table.Description AS LDescription, $cat_table.ID AS CID, Category, $cat_table.Description AS CDescription FROM $cat_table, $link_table WHERE $cat_table.ID = $link_table.Cat_ID ORDER BY $cat_order, $links_order";
print_table ($query, $PHP_SELF, $tbl_border, $tbl_cellpadding, $tbl_cellspacing, $tbl_width, $tbl_align, $row1_color, $row2_color, $row3_color, $Category, $CDescription, $LID, $URL, $Website, $LDescription, $Clicks, $show_clicks, $show_credit, $credit_html, $new_window, $cat_table, $link_table);
}
######### LEVELED MODE #########
if ($mode == "leveled" && !$LID && !$URL) {
// print categories
if (!$QUERY_STRING) {
$query = "SELECT * FROM $cat_table ORDER BY $cat_order";
$result = mysql_query($query) or die("Error: No data exists.
\n