Created
March 14, 2018 08:11
-
-
Save mymizan/e59e3bb5c23cbf41aaeac8733f2bf3e6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* In addition to fixing the syntax error, I have also formatted the code to follow PSR coding standards | |
**/ | |
define("ID_SITE", preg_replace("[^0-9a-z]*", "", strtolower(explode("/", $SERVER['REQUEST_URI'])[1]))); | |
function redirect($uri, $getvar=null) | |
{ | |
if (substr($uri, 0, 1) == '/') { | |
$uri=substr($uri, 1); | |
} | |
if (substr(strtolower($uri), 0, strlen(ID_SITE)) !=ID_SITE) { | |
$uri=ID_SITE . "/" . $uri; | |
} | |
if (is_array($getvar) && count($getvar)) { | |
if (substr_count($uri, "?")) { | |
foreach ($getvar as $key => $value) { | |
$uri .= "&" . $key . "=" . $value; | |
} | |
} else { | |
$uri="?"; | |
foreach ($getvar as $key => $value) { | |
$uri.=$key."=".$value."&"; | |
} | |
$uri=substr($uri, 0, -1); | |
} | |
} | |
header("Location: https://www.empowerdb.com/".$url); | |
die(); | |
} | |
if (!$_GET['start'] || !$_GET['end']) { | |
redirect($SERVER["REQUEST_URI"] . "&e=6", array('start' => $_GET['start'], 'end' => $_GET['end'])); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment