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

Размер файла: 2.63Kb
<?php
// myLounge Redirection - mySQL
// (C) Copyright Alexander Andel, myLounge.com 1999-2002
// Designed to power a CJB.net style Free Subdomain Service

include("myred/include/functions.php");
include("myred/include/vars.php");

// Get the hostname typed in
$subhost = strtolower($HTTP_HOST);
// Get away the "www." in front (in case there is one)
$subhost = str_replace("www.", "", $subhost);
// Delete everything after (and including) the first "/"
$subhost2 =strstr($subhost, "/");
if ($subhost2) {
	$subhost = str_replace($subhost2, "", $subhost);
	}
if($subhost==$maindomain || $subhost==www.$maindomain) {
	header("Location: http://www.$maindomain/$startpage");
	exit;
	}
if($REQUEST_URI=="/") {
	$subhost2="";
	}
else {
	$subhost2=$REQUEST_URI;
	}
// Now check for results
$check=mysql_query("SELECT * FROM $redir_table WHERE host = '$subhost'");
if (mysql_num_rows($check) < 1) {		//No Result is found, redirection to your startpage
	header("Location: http://www.$maindomain/$startpage");
	exit;
}
// Result found, fetching results in an array and redirecting
$row=mysql_fetch_array($check);
$target_url="$row[url]$subhost2"; 
?>
<html>
<head>
<title><?php echo $row[title] ?></title>
<meta name="keywords" content="<?php echo $row[keyw] ?>">
<meta name="description" content="<?php echo $row[descr] ?>">
<meta name="revisit-after" content="<?php echo $row[revisit] ?>">
<meta name="robots" content="<?php echo $row[robots] ?>">
</head>
<?php
if ($ads=="ad-free") {
?>
<frameset rows="100%,*" frameborder="NO" border="0" framespacing="0">
<frame name="main" src="<?php echo $target_url ?>">
<?php
}
if ($ads=="upperframe") {
?>
<frameset rows="40,*" frameborder="NO" border="0" framespacing="0">
<frame name="ad" src="http://www.<?php echo $maindomain ?>/myred/ad.php" noresize scrolling="no">
<frame name="main" src="<?php echo $target_url ?>">
<?php
}
if ($ads=="lowerframe") {
?>
<frameset rows="*,40" frameborder="NO" border="0" framespacing="0">
<frame name="main" src="<?php echo $target_url ?>">
<frame name="ad" src="http://www.<?php echo $maindomain ?>/myred/ad.php" noresize scrolling="no">
<?php
}
?>
</frameset>
<noframes>
<body bgcolor="#FFFFFF" text="#000000">
<a href="<?php echo $target_url ?>">Click here to continue to <?php echo $row[title] ?></a>
</body>
</noframes>
</html>
<?php
// Update the user's counter and lasttime visited
$lasttime=time();
mysql_query("UPDATE $redir_table SET counter=counter+1, lasttime='$lasttime' WHERE host='$subhost'") or die (mysql_error());
exit;
// Just for the case something went wrong
header("Location: http://www.$maindomain/$startpage");
exit;
?>