PDA

View Full Version : $_SERVER['REQUEST_URI'] not working :(



watari
08-12-2011, 04:49 PM
has anyone tried out this ?

it s weird with Hotaru, you nvr be able to get this info out, i.e.

$result = $_SERVER['REQUEST_URI'];

$result is always blank because $_SERVER['REQUEST_URI'] is not set.

Jason
08-13-2011, 04:52 AM
This is odd ... are you running PHP in Windows or through IIS?

If so, you'll need to replace $_SERVER['REQUEST_URI'] with a function like:


function get_request_uri() {
if (!empty($_SERVER['REQUEST_URI'])) {
return $_SERVER['REQUEST_URI'];
} else {
$uri = $_SERVER['SCRIPT_NAME'];
if (!empty($_SERVER['QUERY_STRING'])) {
$uri .= '?'.$_SERVER['QUERY_STRING'];
}
$_SERVER['REQUEST_URI'] = $uri;
return $uri;
}
}

Hope this helps.

PuckRobin
08-15-2011, 11:10 AM
Direct access to superglobals is disabled in Hotaru. You should use "cage" :

$result = $h->cage->server->sanitizeTags('REQUEST_URI')

The same is true for $_GET, $_POST, $_COOKIE, etc. For example to read $_GET['user'] :

$h->cage->get->testUsername('user')