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

mt_srand((double)microtime() * 1000000);
$rand = mt_rand(1,2000000000);

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

if( isset($_GET['c']) )
{
    $_GET['c'] = mysql_real_escape_string($_GET['c'], $DB);
}

$result = mysql_query("SELECT Username,Site_URL FROM topsites_Accounts WHERE Suspended=0 AND Status='Approved' ORDER BY RAND($rand) LIMIT 1");
$account = mysql_fetch_array($result);
mysql_free_result($result);

if( $account )
{
    mysql_query("UPDATE topsites_Accounts SET Current_Out=Current_Out+1,Total_Out=Total_Out+1 WHERE Username='{$account['Username']}'");

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

mysql_close($DB);

?>
Return current item: DDL CMS