//
function MXCHANGE_OPEN($script) {
+ // Compile the script name
+ $script = COMPILE_CODE($script);
+
+ // Use default SERVER_URL by default... ;) So?
+ $url = SERVER_URL;
+ if (substr($script, 0, 7) == "http://") {
+ // Use the hostname from script URL as new hostname
+ $url = substr($script, 7);
+ $extract = explode("/", $url);
+ $url = $extract[0];
+ // Done extracting the URL :)
+ }
+
// Extract host name
- $host = str_replace("http://", "", SERVER_URL);
+ $host = str_replace("http://", "", $url);
if (ereg("/", $host)) $host = substr($host, 0, strpos($host, "/"));
// Generate relative URL
- $script = substr(SERVER_URL, (strpos(SERVER_URL, $host) + strlen($host)))."/".basename($script);
+ $script = substr($script, (strlen($url) + 7));
if (substr($script, 0, 1) == "/") $script = substr($script, 1);
// Open connection