Location: PHPKode > projects > DDL CMS > Upload these files to your webspace/topsites/out.php
<?PHP
require_once('./data/variables');


if( !isset($_GET['id']) )
{
    header("Location: {$GLOBALS['FORWARD_URL']}");
    exit;
}

$DB = mysql_connect($GLOBALS['HOSTNAME'], $GLOBALS['USERNAME'], $GLOBALS['PASSWORD']);
mysql_select_db($GLOBALS['DATABASE'], $DB);


## Update the outgoing hit count
$username = mysql_real_escape_string($_GET['id'], $DB);
mysql_query("UPDATE topsites_Accounts SET Current_Out=Current_Out+1, Total_Out=Total_Out+1 WHERE Username='$username'", $DB);


## Give a productivity bonus
if( isset($_COOKIE['topsites_bonus']) && $_COOKIE['topsites_bonus'] != $username && !strstr(",{$_COOKIE['topsites_bonus_click']},", ",$username,") )
{
    $bonus_username = $_COOKIE['topsites_bonus'];

    mysql_query("UPDATE topsites_Accounts SET Current_Prod=Current_Prod+1, Total_Prod=Total_Prod+1 WHERE Username='$bonus_username'", $DB);

    $cookie_value = isset($_COOKIE['topsites_bonus_click']) ? join(',', array($username, $_COOKIE['topsites_bonus_click'])) : $username;

    setcookie('topsites_bonus_click', $cookie_value, time() + 86400);
}


## Get the site URL that we should forward surfers to
$result = mysql_query("SELECT Site_URL FROM topsites_Accounts WHERE Username='$username'");
$account = mysql_fetch_array($result);
mysql_free_result($result);

mysql_close($DB);

if( !$account )
{
    header("Location: {$GLOBALS['FORWARD_URL']}");
}
else
{
    header("Location: {$account['Site_URL']}");
}

?>
Return current item: DDL CMS