I am working on a template a friend given me ages ago. However, this is the code of the main page:
<div class="span4">
<div class="widget">
<div class="navbar"><div class="navbar-inner"><h6>fame</h6></div></div>
<div class="well body">
<center>
<div class="fame">
<?php include("cache/fame.php"); ?>
</div>
</center>
</div>
</div>
</div>
In this fame.php, there's a line of code:
if(!isset($_GET['enable']) && !isset($argv[1]) == "enable")
{
echo 'Invalid request';
return;
}
And it always return Invalid request from the main page.. So, what is this last code paragraph for?
if(!isset($_GET['enable']) && !isset($argv[1]) == "enable")
{
echo 'Invalid request';
return;
}
The above code is used in 2 scenarios: One is the script mode for which the argument $argv is used. Second mode is as server code where Global params are being passed i.e $_GET.
Just change the code to handle both the scenarios.
if(php_sapi_name() == 'cli' && (!isset($argv[1]) || ( isset($_GET['enable']) && $argv[1] !== "enable"))
{
echo 'Invalid request';
return;
}
else
{
if(!isset($_GET['enable'])
{
echo 'Invalid request';
return;
}
}