Просмотр файла index.php

Размер файла: 1.97Kb
<?php
// by Mike O. (mides), coolcms.org

require_once 'includes/sys.php';
require_once 'includes/cache.php';
require_once 'includes/header.php';

/*			$today00 = date('d-m-Y');
			$timest = strtotime($today00);
			$time_yest = $timest - 86400;

echo date('d.m.y, H:i', $time_yest);
*/
/*if($_SERVER['HTTP_X_FORWARDED_FOR']){
$ip=$_SERVER['HTTP_X_FORWARDED_FOR'];
}
else if($_SERVER['HTTP_CLIENT_IP']){
$ip=$_SERVER['HTTP_CLIENT_IP'];
}
else if($_SERVER['REMOTE_ADDR']){
$ip=$_SERVER['REMOTE_ADDR'];
}


$refurl = parse_url($_SERVER['HTTP_REFERER'], PHP_URL_HOST);
if (isset($refurl) and $refurl !== $_SERVER['HTTP_HOST']) {
	$from_r = mysql_query("SELECT * FROM `from` WHERE `url` = '$refurl'");
	$from = mysql_fetch_assoc($from_r);
	if ($from['id']) {
		mysql_query("UPDATE `from` SET `time` = '".time()."', `ip` = '".clean($ip)."', `per` = (`per`+1) WHERE `id` = '$from[id]'");
	} else {
		mysql_query("INSERT INTO `from` SET `time` = '".time()."', `url` = '$refurl', `ip` = '".clean($ip)."', `per` = (`per`+1)");
	}
}
*/

$file = 'local/main/'.$act.'.tpl';
if (file_exists($file) and $act !== 'index') {
    echo file_get_contents($file).'<br />';
	echo '</div>';
    nav_main();
} else {
    if (isset($u['id'])) {
        tp($lang['welcome'].' '.$u['username']);
    } else {
        tp($lang['welcome'].' '.$lang['guest'].'');
    }

    include_once 'local/main/index.tpl';
	
	

    $ad_r = mysql_query("SELECT * FROM `ad` WHERE `type` = 2 ORDER BY `id`");
	if (mysql_num_rows($ad_r)) {
		echo '<div class="body">';
		while ($ad = mysql_fetch_assoc($ad_r)) {
				echo '<a href="'.$ad['link'].'">'.$ad['name'].'</a><br />';
		}
		mysql_query("DELETE FROM `ad` WHERE `time` < '".TIME."'");
		echo '</div>';
	}
    
    echo '<div class="tail"><a href="other/online.php">'.$lang['online'].': '.stats_online().'</a> <a href="http://coolcms.org" style="float: right; margin-top: -8px;">&copy; coolcms</a></div>';
}

require_once 'includes/tail.php';
?>