#################################################
# xLinks 2002 #
#################################################
# © by Robert Klikics | http://x-dev.de #
# eMail: rob@x-dev.de #
#################################################
# License: GPL #
# please don't remove this copyright - thx #
#################################################
# FILE: jump.php #
#################################################
// die if no id set
if(!$id) die("
Script says: \"Sorry, i have no ID but i really need one\" ;)
");
#======================================================================#
# connect to mySQL
#======================================================================#
include("./inc/connect.php");
//set table-vars
$table_linkdata = $db_prefix."linkdata";
$table_cat = $db_prefix."cat";
$table_votes = $db_prefix."votes";
$table_languages = $db_prefix."languages";
//Connect to mySQL
$conn = @MYSQL_CONNECT($server, $user, $pass);
//Select DB
@MYSQL_SELECT_DB($mydb) or die ("Database '$mydb' does not exist or mySQL is not connected!
Please check your settings ...");
//Check
if(!$conn) die("
mySQL-Connection-Error
Check your settings ...
");
#======================================================================#
# jump to the url of an $id and count 'Hits' of $id + 1
#======================================================================#
if($id == "x") { header("Location: http://x-dev.de"); exit; } // link to home
if($id)
{
//read url from db
$go = MYSQL_QUERY("SELECT * FROM $table_linkdata WHERE id = $id");
// die if $id not found
if(!$go) { die("Script says: \"Sorry, not a valid ID (cannot find)\"
"); }
$home = MYSQL_FETCH_ARRAY($go);
// hitcounter + 1
MYSQL_QUERY("UPDATE $table_linkdata SET hits = hits + 1 WHERE id = $home[id]");
MYSQL_FREE_RESULT($go); //mem
//send header to browser
header("Location: $home[url]");
}
#======================================================================#
# END OF FILE
#======================================================================#
?>