00001 <?php
00005 
00006 
00007 if ( isset( $_SERVER["REQUEST_URI"]) && $_SERVER["REQUEST_URI"]) {
00008     $sParams = $_SERVER["REQUEST_URI"];
00009 } else {
00010     
00011     $sParams = $_SERVER["SCRIPT_URI"];
00012 }
00013 
00014 function getRequestUrl( $sParams = '', $blReturnUrl = false )
00015 {
00016     static $sProcUrl = null;
00017 
00018     if ( $blReturnUrl ) {
00019         return 'index.php?' . trim( $sProcUrl, '&' );
00020     } else {
00021         $sProcUrl = '';
00022     }
00023 
00024     $sScriptFile = basename(__FILE__);
00025     $iPos = strpos( $sParams, $sScriptFile);
00026     $sParams = substr( $sParams, $iPos + strlen($sScriptFile));
00027     $sParams = str_replace("_&2f", "%2f", $sParams);  
00028 
00029     
00030     $aReplaceArray = array( "/?" => "/",
00031                         "?" => "/",
00032                         "/&" => "/",
00033                         "&" => "/",
00034                         "=/" => "/-/",
00035                         "=" => "/");
00036     $sParams = strtr($sParams, $aReplaceArray);
00037 
00038 
00039     $aArg = explode( "/", $sParams);
00040 
00041 
00042     $sSizeofArg = count($aArg);
00043     for ($iCtr = 0; $iCtr < $sSizeofArg; $iCtr++) {
00044         $sParam = $aArg[$iCtr];
00045         if ( !$sParam || strstr( $sParam, $sScriptFile)) {
00046             continue;
00047         }
00048 
00049         
00050         
00051         $sEmptyVar = "-";
00052         if ( !isset($aArg[$iCtr+1]) || $aArg[$iCtr+1] == $sEmptyVar) {
00053             $aArg[$iCtr+1] = "";
00054         }
00055 
00056         if ( strpos(rawurldecode($aArg[$iCtr]), "[") !== false && preg_match( "/.*\[.*\]/", rawurldecode($aArg[$iCtr]))) {
00057             $sVar = rawurldecode($aArg[$iCtr]);
00058             $sName = preg_replace( "/\[.*\]/", "", $sVar);
00059             $sKey  = preg_replace( array( "/.*\[/", "/\]/"), "", $sVar);
00060             $aArray[$sKey] = $aArg[$iCtr+1];
00061             @$_GET[$sName] = $aArray;
00062             @$_REQUEST[$sName] = $aArray;
00063 
00064             $sProcUrl .= "{$sName}[{$sKey}]=".$aArg[$iCtr+1]."&";
00065         } else {
00066             @$_GET[$aArg[$iCtr]] = rawurldecode($aArg[$iCtr+1]);
00067             @$_REQUEST[$aArg[$iCtr]] = rawurldecode($aArg[$iCtr+1]);
00068 
00069             if ( $aArg[$iCtr] != 'sid' && $aArg[$iCtr+1] ) { 
00070                 $sProcUrl .= $aArg[$iCtr]."=".$aArg[$iCtr+1]."&";
00071             }
00072         }
00073         $iCtr++;
00074     }
00075 }
00076 
00077 if ( isset( $sParams ) && $sParams && $_SERVER["REQUEST_METHOD"] != "POST" ) {
00078     getRequestUrl( $sParams );
00079 }
00080 
00084 require "index.php";