function STEFAN_selfURL() { $s = empty($_SERVER["HTTPS"]) ? '' : ($_SERVER["HTTPS"] == "on") ? "s" : ""; $protocol = STEFAN_strleft(strtolower($_SERVER["SERVER_PROTOCOL"]), "/").$s; $port = ($_SERVER["SERVER_PORT"] == "80") ? "" : (":".$_SERVER["SERVER_PORT"]); return $protocol."://".$_SERVER['SERVER_NAME'].$port.$_SERVER['REQUEST_URI']; } function STEFAN_selfURLALL() { $s = empty($_SERVER["HTTPS"]) ? '' : ($_SERVER["HTTPS"] == "on") ? "s" : ""; $protocol = STEFAN_strleft(strtolower($_SERVER["SERVER_PROTOCOL"]), "/").$s; $port = ($_SERVER["SERVER_PORT"] == "80") ? "" : (":".$_SERVER["SERVER_PORT"]); return $protocol."://".$_SERVER['SERVER_NAME'].$port."/ALL"; } function STEFAN_strleft($s1, $s2) { return substr($s1, 0, strpos($s1, $s2)); } $STEFAN_Url = STEFAN_selfURL(); //Kolla om den finns $link = mysql_connect('localhost', 'know_lalli', 'lalli'); if (!$link) { die('Not connected : ' . mysql_error()); } // make foo the current db $db_selected = mysql_select_db('know_autodigg', $link); if (!$db_selected) { die ('Can\'t use foo : ' . mysql_error()); } $result = mysql_query("SELECT * FROM redirect301 where redirfrom='".$STEFAN_Url."'", $link); if ( mysql_num_rows($result) > 0 ) { $row = mysql_fetch_array($result, MYSQL_ASSOC); $newid=$row['redirto']; Header( "HTTP/1.1 301 Moved Permanently" ); Header( "Location: ".$newid ); exit; } $STEFAN_UrlALL = STEFAN_selfURLALL(); //Är host/ALL suspended? $result = mysql_query("SELECT * FROM redirect301 where redirfrom='".$STEFAN_UrlALL."'", $link); if ( mysql_num_rows($result) > 0 ) { $row = mysql_fetch_array($result, MYSQL_ASSOC); $newid=$row['redirto']; Header( "HTTP/1.1 301 Moved Permanently" ); Header( "Location: ".$newid ); exit; } //Är hela skiten suspended? $result = mysql_query("SELECT * FROM suspendedblogs where hostname='" . $_SERVER['HTTP_HOST'] . "'", $link); if ( mysql_num_rows($result) > 0 ) { $newid= 'http://' . $_SERVER['HTTP_HOST'] . '/suspended.php'; Header( "HTTP/1.1 301 Moved Permanently" ); Header( "Location: ".$newid ); exit; } mysql_close($link); if (! isset($wp_did_header)): if ( !file_exists( dirname(__FILE__) . '/wp-config.php') ) { if ( strstr( $_SERVER['PHP_SELF'], 'wp-admin') ) $path = ''; else $path = 'wp-admin/'; require_once( dirname(__FILE__) . '/wp-includes/functions.php'); wp_die("There doesn't seem to be a wp-config.php file. I need this before we can get started. Need more help? We got it. You can create a wp-config.php file through a web interface, but this doesn't work for all server setups. The safest way is to manually create the file.", "WordPress › Error"); } $wp_did_header = true; require_once( dirname(__FILE__) . '/wp-config.php'); wp(); gzip_compression(); require_once(ABSPATH . WPINC . '/template-loader.php'); endif; ?>