Location: PHPKode > scripts > Startpage > startpage/index.php
<?
//***************************************************
//	Startpage v1.1 by Matthijs Draijer
//	
//	Use of this script is free, as long as
//	it's not commercial and you don't remove
//	my name.
//
//***************************************************

include ("config.php");
include ("functions.php");
connect_db();

$id = $_REQUEST[id];
$more = $_REQUEST[more];

if($id != "") {
	$LinkQuery = "SELECT * FROM $cfgTableData WHERE $cfgDataID = $id";
	$FindLink = mysql_query($LinkQuery);
	$Results = mysql_fetch_array($FindLink);
	
	$Time = time();
	$UpdateLog = mysql_query("INSERT INTO $cfgTableLog ($cfgLogPage, $cfgLogTime) VALUES ('$id', '$Time')");
	$UpdateData = mysql_query("UPDATE $cfgTableData SET $cfgDataVisit = '$Time' WHERE $cfgDataID = $id");
	
	$url="Location: $Results[$cfgDataURL]";
	header($url);
} else {
	include ("PageTop.php");
	
	if($cfgSortUse) {
		if(isset($_REQUEST[more])) {
			$Pages	= getPages();
			$Points = getPoint();
			$Order	= getOrder($Pages, $Points);
		} else {
			$Points = getPoint();
			
			foreach($Points as $key => $value) {
				$Order[] = $key;
			}		
		}
	} else {			
		if(isset($_REQUEST[more])) {
			$Pages	= getPages();
			$Order	= getOrderAlpha($Pages);
		} else {
			$Points = getPoint();
			
			foreach($Points as $key => $value) {
				$temp_order[] = $key;
			}
			
			$Order	= getOrderAlpha($temp_order);
		}
	}
	
	$NumberHits = count($Order);
	
	if ($cfgRefreshTime != 0)	echo "<META HTTP-EQUIV='Refresh' CONTENT='$cfgRefreshTime; URL=$_SERVER[PHP_SELF]'>\n";

	echo "	<table width='100%'>". NL;
	echo "	<tr>". NL;
	echo "		<td width='50%' valign='top'>". NL;
	echo "		<table width='100%'>". NL;
			
	foreach($Order as $key => $page) {
		$LinkQuery	= "SELECT * FROM $cfgTableData WHERE $cfgDataID = $page";
		$FindLinks	= mysql_query($LinkQuery);
		$Results	= mysql_fetch_array($FindLinks);
	
		echo "<tr>". NL;
		echo "	<td><a href='$_SERVER[PHP_SELF]?id=$page' target='_blank'>$Results[$cfgDataTitle]</a></td>". NL;
		echo "	<td>". ($Results[$cfgDataVisit] != 0 ? date("d-m H:i", $Results[$cfgDataVisit]) : '') ."</td>". NL;
		echo "</tr>";
		
		$counter ++;
		
		if($counter >= $NumberHits/2) {
			echo "	</table>". NL;
			echo "	</td><td width='50%' valign='top'>". NL;
			echo "	<table width='100%'>". NL;
			$counter = 0;
		}			
	}
	
	echo "</table>". NL;
	echo "</td>". NL;
	echo "</tr>". NL;
	
	if(isset($_REQUEST[more])) {
		echo "<tr>". NL;
		echo "	<td colspan='2' align='right'><a href='$_SERVER[PHP_SELF]'><<<<</a></td>". NL;
		echo "</tr>";
	} else {
		echo "<tr>". NL;
		echo "	<td colspan='2' align='right'><a href='$_SERVER[PHP_SELF]?more=true'>>>>></a></td>". NL;
		echo "</tr>";
	}
	echo "	</table>". NL;
	
	include ("PageBottom.php");
}
?>
Return current item: Startpage