3) {header("HTTP/1.1 301 Moved Permanently"); header("Location: //".$hostparts[$hc-3].".".$hostparts[$hc-2].".".$hostparts[$hc-1].$urlpath); exit;} else if ($hc < 3) {header("HTTP/1.1 301 Moved Permanently"); header("Location: //www.".$hostparts[$hc-2].".".$hostparts[$hc-1].$urlpath); exit;} $subdomain = $hostparts[0]; if ($hostparts[$hc-1] == 'lan') define('HOST', 'cs.lan'); else define('HOST', 'couponsmash.com'); define('HOST_VAR', '//'.$subdomain.'.'.HOST); ini_set('session.cookie_domain', '.'.HOST); session_start(); ob_start(); $uarr = explode('/', substr(str_replace("?".$_SERVER["QUERY_STRING"], "", $urlpath), 1)); $uarc = count($uarr); if ($_GET["debug"]) { echo "
";
	echo "GET:"; print_r($_GET); echo ("

"); echo "SERVER:"; print_r($_SERVER); echo ("

"); echo "SESSION:"; print_r($_SESSION); echo "

"; echo "UARR:"; print_r ($uarr); echo "UARC: ".$uarc; echo "
"; } $sql = " SELECT dest FROM redirect WHERE active = 1 AND source = '".$_SERVER['REQUEST_URI']."'"; $rs = mysqli_query($con, $sql); if ($rs && mysqli_num_rows($rs) > 0) { $row = mysqli_fetch_array($rs); extract($row); header ("HTTP/1.1 301 Moved Permanently"); header ("Location: //www.".HOST.$row['dest']); exit; } else { //if ($subdomain == "dir") {header ("HTTP/1.1 301 Moved Permanently"); header ("Location: //www.".HOST.$_SERVER["REQUEST_URI"]); exit;} else { if ($uarr[0] == "" && $uarr[1] == "") {include_once "pages/www_home.php";} elseif ($uarr[0] == "faqs" ) {include_once "pages/www_faqs.php";} elseif ($uarr[0] == "stores" && (strlen($uarr[1]) == 0)) {include_once "pages/www_store.php";} // elseif ($uarr[0] == "blog" && (strlen($uarr[1]) == 0 // || $uarr[1] == "pages")) {include_once "pages/www_bloglist.php";} // elseif ($uarr[0] == "blog" && strlen($uarr[1]) > 0) {include_once "pages/www_blog.php";} // elseif ($uarr[0] == "cart") {include_once "pages/cart.php";} // elseif ($uarr[0] == "checkout") {include_once "pages/checkout.php";} // elseif ($uarr[0] == "member" && $uarr[1] == "order") {include_once "pages/ordersummary.php";} // elseif ($uarr[0] == "confirmation") {include_once "forms/confirmation.php";} // elseif ($uarr[0] == "scripts" && strlen($uarr[1]) > 0) {include_once "includes/".$uarr[1];} //elseif ($uarr[0] == "megafriday" && strlen($uarr[1]) == 0) {include_once "pages/www_blackfriday.php";} //elseif ($uarr[0] == "jashneazadi" && strlen($uarr[1]) == 0) {include_once "pages/www_jashneazadi.php";} //elseif ($uarr[0] == "clearance-sale" && strlen($uarr[1]) == 0) {include_once "pages/www_clearancesale.php";} //elseif ($uarr[0] == "wintersale" && strlen($uarr[1]) == 0) {include_once "pages/www_wintersale.php";} // elseif ($uarr[0] == "post" && strlen($uarr[1]) > 0) {include_once "forms/".$uarr[1].".php";} // elseif ($uarr[0] == "info" && strlen($uarr[1]) > 0) {include_once "pages/static/dir_".$uarr[1].".php";} // elseif ($uarr[0] == "sp" && strlen(string: $uarr[1]) > 0) {include_once "pages/sp/sp_".$uarr[1].".php";} // elseif ($uarr[0] == "psbo") { // if ($uarr[1] == "seller" && strlen($uarr[2]) == 0) {header ("Location: /psbo/seller/login"); exit;} // elseif ($uarr[1] == "seller" && strlen($uarr[2]) > 0) {include_once "psbo/psseller/".$uarr[2].".php";} // } // elseif ($uarr[0] == "psadmin" && strlen($uarr[1]) == 0) {header ("Location: /psadmin/login"); exit;} // elseif ($uarr[0] == "psadmin" && strlen($uarr[1]) > 0) {include_once "admin/".explode("?", $uarr[1])[0].".php";} // elseif ( $uarr[0] == "logout" ) { include_once "forms/logout.php"; } else echo "URL not available!"; exit;//header("HTTP/1.1 404 Not Found"); //} } ?>