Location: PHPKode > projects > SiteX > links.php
<?PHP
ob_start();
session_start();

include("includes/globals.php.inc");
include("includes/functions.php");
include("lang/English.php");
if(strtolower($sxSetup['Language']) != 'english') include("lang/".$sxSetup['Language'].".php");
include("themes/$THEME_FOLDER/config.php.inc");

protectComponentPage(5);

$sxTitleAddendum = getComponentName("5");
include("themes/$THEME_FOLDER/header.php");
?>
<div class="bodyWrapper">
	<h1><?PHP echo getComponentName("5"); ?></h1>
<?PHP
	if($category)
	{
		$query = "SELECT * FROM $DB_Links_Groups WHERE id='$category'";
		$result = mysql_query($query, $Link) or queryError("8", mysql_error());
		while($ROW = mysql_fetch_object($result))
		{
			echo '<div align="right"><a href="' . $PHP_SELF . '"><span class="sxSmallText">' . $sxLang['LinksButtonBack'] . '</span></a></div>';
			echo '<p><strong>' . htmlspecialchars($ROW->name) . '</strong></p><ul>';
			
			$query2 = "SELECT * FROM $DB_Links WHERE groupid='$ROW->id' ORDER BY name ASC";
			$result2 = mysql_query($query2, $Link) or queryError("8", mysql_error());
			while($ROW2 = mysql_fetch_object($result2))
			{
				if($ROW2->hits == 1)
					$sxHits = $sxLang['Hit'];
				else
					$sxHits = $sxLang['Hits'];
				echo '<li><a href="redirect.php?linkid=' . $ROW2->id . '" target="_blank">' . htmlspecialchars($ROW2->name) . '</a><span class="shadowText"> (' . $ROW2->hits . ' ' . $sxHits . ')</span></li>';
			}
			echo '</ul>';
		}
	}
	else
	{
		$query = "SELECT * FROM $DB_Links_Groups ORDER BY position ASC";
		$result = mysql_query($query, $Link) or queryError("8", mysql_error());
		while ($ROW = mysql_fetch_object($result))
		{
			echo '<p><strong>' . htmlspecialchars($ROW->name) . '</strong></p><ul>';
			
			$query2 = "SELECT * FROM $DB_Links WHERE groupid='$ROW->id'";
			$result2 = mysql_query($query2, $Link) or queryError("8", mysql_error());
			$totalLinks = mysql_num_rows($result2);
			
			if($sxSetup['LinkTruncation'])
				$queryTrunc = "LIMIT 0, ".$sxSetup['LinkTruncationLength'];
			
			$query2 = "SELECT * FROM $DB_Links WHERE groupid='$ROW->id' ORDER BY name ASC $queryTrunc";
			$result2 = mysql_query($query2, $Link) or queryError("8", mysql_error());
			while($ROW2 = mysql_fetch_object($result2))
			{
				if($ROW2->hits == 1)
					$sxHits = $sxLang['Hit'];
				else
					$sxHits = $sxLang['Hits'];

				echo '<li><a href="redirect.php?linkid=' . $ROW2->id . '" target="_blank">' . htmlspecialchars($ROW2->name) . '</a><span class="shadowText"> (' . $ROW2->hits . ' ' . $sxHits . ')</span></li>';
			}
			
			echo '</ul>';
			if (($totalLinks > $sxSetup['LinkTruncationLength']) AND ($sxSetup['LinkTruncation'])) 
				echo '<a href="' . "$PHP_SELF?category=$ROW->id" . '"><span class="sxSmallText">' . $sxLang['LinksViewMore'] . '</span></a>';
		}
	}
  ?>
</div>
<?PHP
include("themes/$THEME_FOLDER/footer.php");
ob_end_flush();
?>
Return current item: SiteX