Location: PHPKode > projects > DDL CMS > Upload these files to your webspace/topsites/in.php
<?php
	define('TOPSITESDIR', dirname(__FILE__));
	define('WWWROOT', substr(TOPSITESDIR, 0, -8));
	define('BASEDIR', substr(WWWROOT, 0, ##BASEDIR##));
	require(BASEDIR . 'funcs.inc');
	require(BASEDIR . 'config.php');
	require_once(TOPSITESDIR . '/data/variables');
	$DB = NULL;
	if(isset($_POST) && is_array($_POST) && count($_POST) && !array_key_exists('id', $_POST) || array_key_exists('id', $_POST) && strlen($_POST['id']) == 0)
	{
		header("Location: {$GLOBALS['FORWARD_URL']}");
		exit;
	}
if( $_SERVER['REQUEST_METHOD'] == 'POST' )
{
    Givehit();
}
else
{
    if( isset($GLOBALS['O_GATEWAY']) )
    {
        DisplayGateway($_GET['id']);
    }
    else
    {
        GiveHit();
    }
}




function GiveHit()
{
    global $DB;

    $time = time();
    $forward = $GLOBALS['FORWARD_URL'];

    // If using gateway
    if( isset($GLOBALS['O_GATEWAY']) )
    {
        // Test for cookie enabled browser, if required
        if( isset($GLOBALS['O_REQ_COOKIES']) && !isset($_COOKIE['topsites_gateway']) )
        {
            HandleCheat('Hit_No_Cookies');
        }

        // Check for valid referrer
        if( !strstr($_SERVER['HTTP_REFERER'], $GLOBALS['IN_URL']) )
        {
            HandleCheat('Hit_Referrer');
        }

        // Check the session
        if( $time - $_POST['s'] > $GLOBALS['GATEWAY_EXPIRE'] )
        {
            HandleCheat('Hit_Exp_Session');
        }
    }

    // If using cookies to track clicks, check it
    if( isset($GLOBALS['O_COOKIES']) && isset($_COOKIE['topsites_'.$_REQUEST['id']]) )
    {
        HandleCheat('Hit_Cookie');
    }

    // Check for proxy
    if( isset($GLOBALS['O_PROXY']) && (isset($_SERVER['HTTP_VIA']) || isset($_SERVER['HTTP_X_FORWARDED_FOR'])) )
    {
        HandleCheat('Hit_Proxy');
    }

    // Check for valid browser
    if( !isset($_SERVER{'HTTP_ACCEPT'}) || !isset($_SERVER{'HTTP_USER_AGENT'}) )
    {
        HandleCheat('Hit_Browser');
    }


    // Check the IP address if using IP logging
    if( isset($GLOBALS['O_IPS']) )
    {
        CheckExistingIP($_SERVER['REMOTE_ADDR'], $_REQUEST['id']);
    }


    // Check for a banned IP
    if( isset($GLOBALS['O_BANNED_IPS']) )
    {
        CheckBannedIP($_SERVER['REMOTE_ADDR']);
    }


    // Set a cookie to mark that this browser has been used to register a hit
    if( $GLOBALS['O_COOKIES'] )
    {
        setcookie('topsites_'.$_REQUEST['id'], 'true', $time + $GLOBALS['COOKIE_EXPIRE']);
    }


    // Set a cookie so we know who to give productivity bonus to
    if( !isset($_COOKIE['topsites_bonus']) )
    {
        setcookie('topsites_bonus', $_REQUEST['id'], $time + 86400);
    }
    

    // Update account information with new hit count
    ConnectDB();

    $username = mysql_real_escape_string($_POST['id'], $DB);
    mysql_query("UPDATE topsites_Accounts SET Current_In=Current_In+1, Total_In=Total_In+1, Inactive=0 WHERE Username='$username'", $DB);

    CloseDB();

    // Forward surfer
    header("Location: $forward");
}




function DisplayGateway($theID)
{
	global $site_url, $skin, $site_name, $description, $keywords, $categories, $menualign, $cbusername;
    if( isset($GLOBALS['O_REQ_COOKIES']) )
    {
        setcookie('topsites_gateway', 'true', time() + 240);
    }

    $template = file_get_contents('./templates/in_gateway.tpl');

    $find = array('##In_URL##', '##ID##', '##Session##');
    $replace = array($GLOBALS['IN_URL'], $theID, time());

    $template = str_replace($find, $replace, $template);

	echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
	<html>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<meta http-equiv="Content-Language" content="en-us">
	<head>
	<title>'.$site_name.'</title>
	<META name=description content="'.$description.'">
	<META name=keywords content="'.$keywords.'">

	<link rel="stylesheet" href="'.$site_url.'/skins/'.$skin.'/stylesheet.css" type="text/css">
	</head>
	<body onLoad="if (self != top) top.location = self.location">
	<center>

	<h1><a title="' . $site_name . '" class="h1">' . $site_name . '</a></h1>
	<h2>' . $description . '</h2>
    <br />
    <br />';

	echo "<a title=\"All Files\">All Files</a> |" . "\n";
	for($i = 0; $i < count($categories); $i++)
	{
		echo "<a title=\"" . $categories[$i] . " Downloads\">" . $categories[$i] . "</a> |";
	}
	
	echo '
    <br />
    <br />

	<table border="0" align="center"><tr>
	<td width="300" align="center">
	<img src="'.$site_url.'/skins/'.$skin.'/arrow.gif" alt="Download" height="8" width="4" align="middle"> ';
	echo(file_get_contents("http://www.sharingzone.net/random.php?id=$cbusername"));
	echo '<br /><br /><img src="'.$site_url.'/skins/'.$skin.'/arrow.gif" height="8" width="4" alt="Download" align="middle"> ';
	echo(file_get_contents("http://www.sharingzone.net/random.php?id=$cbusername"));
	echo '<br /><br /><img src="'.$site_url.'/skins/'.$skin.'/arrow.gif" height="8" width="4" alt="Download" align="middle"> ';
	echo(file_get_contents("http://www.sharingzone.net/random.php?id=$cbusername"));
	echo '<br /><br /><img src="'.$site_url.'/skins/'.$skin.'/arrow.gif" height="8" width="4" alt="Download" align="middle"> ';
	echo(file_get_contents("http://www.sharingzone.net/random.php?id=$cbusername"));
	echo '</td>';
	echo '<td width=300 align=center>
	<img src="'.$site_url.'/skins/'.$skin.'/arrow.gif" height="8" width="4" alt="Download" align="middle"> ';
	echo(file_get_contents("http://www.sharingzone.net/random.php?id=$cbusername"));
	echo '<br /><br /><img src="'.$site_url.'/skins/'.$skin.'/arrow.gif" height="8" width="4" alt="Download" align="middle"> ';
	echo(file_get_contents("http://www.sharingzone.net/random.php?id=$cbusername"));
	echo '<br /><br /><img src="'.$site_url.'/skins/'.$skin.'/arrow.gif" height="8" width="4" alt="Download" align="middle"> ';
	echo(file_get_contents("http://www.sharingzone.net/random.php?id=$cbusername"));
	echo '<br /><br /><img src="'.$site_url.'/skins/'.$skin.'/arrow.gif" height="8" width="4" alt="Download" align="middle"> ';
	echo(file_get_contents("http://www.sharingzone.net/random.php?id=$cbusername"));
	echo '</td>';
	echo '<td width=300 align=center>
	<img src="'.$site_url.'/skins/'.$skin.'/arrow.gif" height="8" width="4" alt="Download" align="middle"> ';
	echo(file_get_contents("http://www.sharingzone.net/random.php?id=$cbusername"));
	echo '<br /><br /><img src="'.$site_url.'/skins/'.$skin.'/arrow.gif" height="8" width="4" alt="Download" align="middle"> ';
	echo(file_get_contents("http://www.sharingzone.net/random.php?id=$cbusername"));
	echo '<br /><br /><img src="'.$site_url.'/skins/'.$skin.'/arrow.gif" height="8" width="4" alt="Download" align="middle"> ';
	echo(file_get_contents("http://www.sharingzone.net/random.php?id=$cbusername"));
	echo '<br /><br /><img src="'.$site_url.'/skins/'.$skin.'/arrow.gif" height="8" width="4" alt="Download" align="middle"> ';
	echo(file_get_contents("http://www.sharingzone.net/random.php?id=$cbusername"));
	echo '</td>';
	echo '</tr></table>

    <br />
    <br />';

    echo $template;

	echo '
    <br />
    <br />

	<table border="0" align="center" cellpadding="10">
	<tr>
	<td style="align="center">';

 	include(WWWROOT . 'edit/adblock1.php');
	echo "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
 	include(WWWROOT . 'edit/adblock1.php');
	echo "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
 	include(WWWROOT . 'edit/adblock1.php');
	echo "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
 	include(WWWROOT . 'edit/adblock1.php');
	echo "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
 	include(WWWROOT . 'edit/adblock1.php');
	echo "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
 	include(WWWROOT . 'edit/adblock1.php');
	echo "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
 	include(WWWROOT . 'edit/adblock1.php');

	echo '</td>
	</tr>
	</table>

    <br />
    <br />

	<small>
    Copyright &copy; <a>'.$site_name.'</a>. All rights reserved.<br />
	Powered by <a href="http://www.ddlcms.com" target="_blank" title="Powered by DDL CMS">DDL CMS Script</a> | '.Capitalize($skin).' Theme
	
	</center>
	</body>
	</html>';




}



function ConnectDB()
{
    global $DB;

    if( $DB != NULL )
    {
        return;
    }

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



function CloseDB()
{
    global $DB;

    if( $DB != NULL )
    {
        mysql_close($DB);
    }
}



function CheckBannedIP($ip)
{
    global $DB;

    ConnectDB();

    $ip = mysql_real_escape_string($ip, $DB);
    $result = mysql_query("SELECT * FROM topsites_BannedIPs WHERE IP_Address='$ip'", $DB);

    if( mysql_num_rows($result) != 0 )
    {
        HandleCheat('Hit_Banned_IP');
    }
}



function CheckExistingIP($ip, $username)
{
    global $DB;

    ConnectDB();

    $ip = mysql_real_escape_string($ip, $DB);
    $username = mysql_real_escape_string($username, $DB);
    $result = mysql_query("SELECT * FROM topsites_HitIPs WHERE Username='$username' AND IP_Address='$ip'", $DB);

    if( mysql_num_rows($result) != 0 )
    {
        HandleCheat('Hit_IP_Address');
    }
    else
    {
        mysql_query("INSERT INTO topsites_HitIPs VALUES ('$username', '$ip')");
    }
}



function HandleCheat($type)
{
    global $DB;

    $forward = $GLOBALS['FORWARD_URL'];

    if( isset($GLOBALS['O_TALLY']) )
    {
        ConnectDB();
        $username = mysql_real_escape_string($_REQUEST['id'], $DB);
        mysql_query("UPDATE topsites_Cheats SET $type=$type+1 WHERE Username='$username'");
    }
    

    if( isset($GLOBALS['O_CHEAT_LOG']) )
    {
        $date = date($date_format, time());

        $fd = fopen('./data/cheatlog', "a");
        fwrite($fd, "[ $date ]  [ $type ]  [ {$_REQUEST['id']} ] [ {$_SERVER['REMOTE_ADDR']} ({$_SERVER['HTTP_X_FORWARDED_FOR']}) ]\n");
        fclose($fd);
    }


    closeDB();

    header("Location: $forward");
    exit;
}

?>
Return current item: DDL CMS