How to use $_GET with mod_rewrite and AltoRouter - php

I am having issues getting $_GET variables with mod_rewrite enabled. I have the following .htaccess:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php [L]
and I am using "AltoRouter" for routing.
So an example of a Route that I might have is /login?redirect=localhost%2Fnetwork%2Fdashboard which would be rewritten as /login.
What I am trying to do is get $_GET['redirect'] and I cannot seem to do this. Can anyone help? Apologies in advance for a bit of a code dump.

You don't continue to use $_GET with AltoRouter.
Look here and here
Your problem may be that you are not generating URLs through AltoRouter.
Alto Router calls this "reverse routing" - look at the source:
/**
* Reversed routing
*
* Generate the URL for a named route. Replace regexes with supplied parameters
*
* #param string $routeName The name of the route.
* #param array #params Associative array of parameters to replace placeholders with.
* #return string The URL of the route with named parameters in place.
*/
public function generate($routeName, array $params = array()) {
The way to get params in the URL:
$router = new AltoRouter();
$router->map( 'GET', '/', function() { .. }, 'home' );
// assuming current request url = '/'
$match = $router->match();
/*
array(3) {
["target"] => object(Closure)#2 (0) { }
["params"] => array(0) { }
["name"] => 'home'
}
*/
Another example
$router = new AltoRouter();
// map homepage
$router->map( 'GET', '/', function() {
require __DIR__ . '/views/home.php';
});
// map user details page
$router->map( 'GET', '/user/[i:id]/', function( $id ) {
require __DIR__ . '/views/user-details.php';
});
// match current request url
$match = $router->match();
// call closure or throw 404 status
if( $match && is_callable( $match['target'] ) ) {
call_user_func_array( $match['target'], $match['params'] );
} else {
// no route was matched
header( $_SERVER["SERVER_PROTOCOL"] . ' 404 Not Found');
}

This function helped me:
public static function _GET(){
$__GET = array();
$ru = $_SERVER['REQUEST_URI'];
$_get_str = explode('?', $ru);
if( !isset($_get_str[1]) ) return $__GET;
$params = explode('&', $_get_str[1]);
foreach ($params as $p) {
$parts = explode('=', $p);
$__GET[$parts[0]] = isset($parts[1])? $parts[1] : '';
}
return $__GET;
}
and:
$__GET = App::_GET();
$url = urldecode( $__GET['redirect'] )

Old question but you can get the GET variables the same way before with $_GET, but you have to still match the route. I.e., if the route isn't matched your script doesn't proceed.
The route in altorouter for:
/login?redirect=localhost%2Fnetwork%2Fdashboard
Would be (you can use just GET or POST if you like) :
$router->map('GET|POST','/login/*', 'controllerforthisroute', "login");
After you can do <?php echo $_GET['redirect'] ?> and get:
localhost/network/dashboard

Old question, but it seems it's not so easy to deal with Altorouter & query string parameters.
As explained here by the author, it's not suitable to output the query string parameters in Altorouter's $match['parameters'] to respect REST principles.
Query string parameters have to be threated as external data, not part of Altorouter data.
Here's a simple solution to retrieve the URL query string & register parameters in PHP global $_GET:
// Register URL query string parameters in $_GET since Altorouter ROUTE doesn't deal with these.
$parts = parse_url($_SERVER['REQUEST_URI']);
if (isset($parts['query'])) {
parse_str($parts['query'], $_GET);
}
// now we can use $_GET
// echo $_GET['something'];

Related

Laravel: Parse arbitrary URL to its corresponding Controller/Route?

Given I have an arbitrary URL mapped (amongst many others) like this
...
Route::get('/foobar/{parameter}', 'MyFoobarController#index');
...
How can I "reverse parse/resolve" the URL (like http://localhost/foobar/foo) into this configured controller (MyFoobarController) again? Please note: I am not talking about the current Request but a general approach to parse any URL that is mapped in Laravel to its corresponding Controller and Action (anywhere in the code independent of the current request). Thanks!
Update: It should also correctly match Routes, that have parameters in them.
You can compare the URL path, to the paths added to the router. So let's take your example:
Route::get('/foobar', 'MyFoobarController#index');
You can use the Route facade to get a list of all registered routes:
// This is your URL as a string
$url = 'http://localhost/foobar';
// Extract the path from that URL
$path = trim(parse_url($url, PHP_URL_PATH), '/');
// Iterate over the routes until you find a match
foreach (Route::getRoutes() as $route) {
if ($route->getPath() == $path) {
// Access the action with $route->getAction()
break;
}
}
The getAction method will return an array containing the relevant information about the action mapped for that route. You can check out the Illuminate\Routing\Route API for more info on what methods are available for you to use once you have matched a route.
private function getMatchRoutes($request)
{
$referer = $request->header('Referer');
$refererPath = parse_url($referer,PHP_URL_PATH);
$routes = Route::getRoutes()->getRoutes();
$matchedRoute = null;
foreach ($routes as $route) {
$route->compiled = (new RouteCompiler($route))->compile();
if (is_null($route->getCompiled())) continue;
if (preg_match($route->getCompiled()->getRegex(), rawurldecode($refererPath))) {
$matchedRoute = $route;
}
}
if (is_null($matchedRoute)) return $matchedRoute;
return explode('#',$matchedRoute->getActionName())[0];
}
the codes above i wrote is to get controller/action from request referer ,you can replace it by a valid url, try it , may be helpful ~~~

php routing how to handle query parameters?

I have a router class in my php project that works like this:
public function dispatch(){
foreach ($this->routes as $url => $action) {
if( $url == $_SERVER['REQUEST_URI'] ){
if(is_callable($action)) return $action();
$actionArr = explode('#', $action);
$controller = 'My\\system\\controllers\\'.$actionArr[0];
$method = $actionArr[1];
return (new $controller)->$method();
}
}
}
And I define the routes like this:
My\system\classes\Registry::get("Router")->add('/My/admin/','AdminController#index');
So when the URL SERVER/My/admin is called the index method of the AdminController class is called.
My problem: How do I handle query strings?
I'd like to have a page with a form. On submit, the form gets sent to SERVER/My/admin/check, i.e. to the check.php page in the admin folder.
I defined the route like this
My\system\classes\Registry::get("Router")->add('/My/admin/check','AdminController#check');
but the URL isn't found, of course, because the query string is attatched to the URL. How should I handle this best?
Before checking $_SERVER['REQUEST_URI'], remove everything past the first ?, if one is present. Use that value to check if it matches with $url. Something as simple as this will do the trick:
$request = $_SERVER['REQUEST_URI'];
if( ($pos = strpos($request, '?')) !== false) $request = substr($request, 0, $pos);
Any controllers that need to work with query parameters should be able to get them from $_GET, or at worst $_SERVER['QUERY_STRING'].
This example is from my project, how I handle this.
REQUEST_URI - The URI which was given in order to access this page; for instance, '/index.html'.
$full_router = $_SERVER['REQUEST_URI'];
strtok() splits a string (string) into smaller strings (tokens), with each token being delimited by any character from token.
$router = strtok($full_router, '?'); // This is how you can handle query parameters
Now you can match the URL with if statement
if($router === '/' ){
include('/pages/home.php');
}

Simple PHP Routing Project

I need to create a simple routing mechanism that takes a request like: /foo/bar and translates it to FooController->barAction(); I have to use a single script as an access point to load these controller classes and action methods. I also cannot use any external frameworks or libraries to accomplish this task. This needs to be able to be run on a PHP 5.3 Server with Apache.
Below is what I've written already, but I'm having trouble getting it to work:
class Router {
private static $routes = array();
private function __construct() {}
private function __clone() {}
public static function route($pattern, $callback) {
$pattern = '/' . str_replace('/', '\/', $pattern) . '/';
self::$routes[$pattern] = $callback;
}
public static function execute() {
$url = $_SERVER['REQUEST_URI'];
$base = str_replace('\\', '/', dirname($_SERVER['SCRIPT_NAME']));
if (strpos($url, $base) === 0) {
$url = substr($url, strlen($base));
}
foreach (self::$routes as $pattern => $callback) {
if (preg_match($pattern, $url, $params)) {
array_shift($params);
return call_user_func_array($callback, array_values($params));
}
}
}
}
I'm trying to at least execute my current script which is based off another simple Router, but I cannot actually get an output using
Router::route('blog/(\w+)/(\d+)', function($category, $id){
print $category . ':' . $id;
});
Router::execute();
Instead of trying to break out the PATH. Why not use .htaccess instead.
So you could have internal URL's that look like this:
index.php?module=MODULE&action=INDEX
Then use .htaccess to provide the paths in the URL and the route them accordingly.
www.mydomain.com/MODULE/INDEX
This post can help with the rewriting regex for creating pritty urls in htaccess
There might be a better one, was just a quick google search.
This way you can access like this:
$module = $_GET['module'];
$action = $_GET['action];
Then you can do checks to corresponding actions in your router to check if it exists and then re-route accordingly.

Friendly URL's with an IndexController

My current router / FrontController is setup to dissect URL's in the format:
http://localhost/controller/method/arg1/arg2/etc...
However, I'm not sure how to get certain requests to default to the IndexController so that I can type:
http://localhost/contact
or
http://localhost/about/portfolio
Instead of:
http://localhost/index/contact
or
http://localhost/index/about/portfolio
How is this accomplished?
<?php
namespace framework;
class FrontController {
const DEFAULT_CONTROLLER = 'framework\controllers\IndexController';
const DEFAULT_METHOD = 'index';
public $controller = self::DEFAULT_CONTROLLER;
public $method = self::DEFAULT_METHOD;
public $params = array();
public $model;
public $view;
function __construct() {
$this->model = new ModelFactory();
$this->view = new View();
}
// route request to the appropriate controller
public function route() {
// get request path
$basePath = trim(substr(PUBLIC_PATH, strlen($_SERVER['DOCUMENT_ROOT'])), '/') . '/';
$path = trim(parse_url($_SERVER["REQUEST_URI"], PHP_URL_PATH), '/');
if($basePath != '/' && strpos($path, $basePath) === 0) {
$path = substr($path, strlen($basePath));
}
// determine what action to take
#list($controller, $method, $params) = explode('/', $path, 3);
if(isset($controller, $method)) {
$obj = __NAMESPACE__ . '\\controllers\\' . ucfirst(strtolower($controller)) . 'Controller';
$interface = __NAMESPACE__ . '\\controllers\\' . 'InterfaceController';
// make sure a properly implemented controller and corresponding method exists
if(class_exists($obj) && method_exists($obj, $method) && in_array($interface, class_implements($obj))) {
$this->controller = $obj;
$this->method = $method;
if(isset($params)) {
$this->params = explode('/', $params);
}
}
}
// make sure we have the appropriate number of arguments
$args = new \ReflectionMethod($this->controller, $this->method);
$totalArgs = count($this->params);
if($totalArgs >= $args->getNumberOfRequiredParameters() && $totalArgs <= $args->getNumberOfParameters()) {
call_user_func_array(array(new $this->controller, $this->method), $this->params);
} else {
$this->view->load('404');
}
}
}
You can use your URLs by one of two methods:
Establish the controllers the way your routing defines them
example.com/contact => Have a "contact" controller with default or index action
example.com/about/portfolio => Have an "about" controller with a "portfolio" action
Because your currently available routing says your URL is treated like "/controller/method", there is no other way.
Establish dynamic routing to allow multiple URLs to be handled by a single controller
Obviously this needs a bit of configuration because one cannot know which URLs are valid and which one should be redirected to the generic controller, and which ones should not. This is somehow a replacement for any of the rewriting or redirecting solutions, but as it is handled on the PHP level, change might be easier to handle (some webserver configurations do not offer .htaccess because of performance reasons, and it generally is more effort to create these).
Your configuration input is:
The URL you want to be handled and
The controller you want the URL passed to, and it's action.
You'll end up having an array structure like this:
$specialRoutes = array(
"/contact" => "IndexController::indexAction",
"/about/portfolio" => "IndexController::indexAction"
);
What's missing is that this action should get the current URL passed as a parameter, or that the path parts become designated parameters within your URL schema.
All in all this approach is a lot harder to code. To get an idea, try to look at the routing of common MVC frameworks, like Symfony and Zend Framework. They offer highly configurable routing, and because of this, the routing takes place in multiple classes. The main router only reads the configuration and then passes the routing of any URL to the configured routers if a match is detected.
Based on your code snippet I'd do it like this (pseudo php code):
$handler = get_controller($controller);
if(!$handler && ($alias = lookup_alias($path))) {
list($handler, $method) = $alias;
}
if(!$handler) error_404();
function lookup_alias($path) {
foreach(ALL_CONTROLLERS as $controller) {
if(($alias = $controller->get_alias($path))) {
return $alias;
}
}
return null;
}
So basically in case there is no controller to handle a certain location you check if any controller is configured to handle the given path as an alias and if yes return that controller and the method it maps to.
You can create a rewrite in your webserver for these exceptions. For example:
RewriteRule ^contact$ /index/contact
RewriteRule ^about/portfolio$ /about/portfolio
This will allow you to have simplified URLs that map to your regular structure.
You could have a dynamic rule if you are able to precisely define what should be rewritten to /index. For example:
RewriteRule ^([a-z]+)$ /index/$1
Try this dynamic htaccess rewrite rule:
RewriteRule ^(.+)/?$ /index/$1 [QSA]
The QSA flag in the above rule allows you to also add a query string to the end if you want, like this:
http://localhost/contact?arg1=1&arg2=2
EDIT: This rule would also handle cases such as /about/portfolio:
RewriteRule ^(.+)/?(.+)?$ /index/$1 [QSA]

CodeIgniter PHP Framework - Need to get query string

I'm creating an e-commerce site using CodeIgniter.
How should I get the query string?
I am using a Saferpay payment gateway. The gateway response will be like this:
http://www.test.com/registration/success/?DATA=<IDP+MSGTYPE%3D"PayConfirm"+KEYID%3D"1-0"+ID%3D"KI2WSWAn5UG3vAQv80AdAbpplvnb"+TOKEN%3D"(unused)"+VTVERIFY%3D"(obsolete)"+IP%3D" 123.25.37.43"+IPCOUNTRY%3D"IN"+AMOUNT%3D"832200"+CURRENCY%3D"CHF"+PROVIDERID%3D"90"+PROVIDERNAME%3D"Saferpay+Test+Card"+ACCOUNTID%3D"99867-94913159"+ECI%3D"2"+CCCOUNTRY%3D"XX"%2F>&SIGNATURE=bc8e253e2a8c9ee0271fc45daca05eecc43139be6e7d486f0d6f68a356865457a3afad86102a4d49cf2f6a33a8fc6513812e9bff23371432feace0580f55046c
To handle the response I need to get the query string data.
Sorry, I haven't explained the problem clearly. I am getting a 'Page not found' error while getting the response from the payment site after payment.
I have tried enabling with uri_protocol = 'PATH_INFO' and enable_query_strings = 'TRUE' in config.php. While googling I found this won't work if I use htaccess rewrite.
I have already tried changing the config entries, but it doesn't work.
You can get it like this:
$this->input->get('some_variable', TRUE);
See this for more info.
I have been using CodeIgniter for over a year now. For the most part I really like it (I contribute to the forum and use it in every instance that I can) but I HATE the ARROGANCE of that statement in the manual:
Destroys the global GET array. Since
CodeIgniter does not utilize GET
strings, there is no reason to allow
it.
The presumption that you will never need GET in a CodeIgniter application is asinine! Already in just a few days, I've had to deal with post back pages from PayPal and ClickBank (I'm sure there are a million others.) Guess what, they use GET!!!
There are ways to stop this GET squashing, but they are things that tend to screw other things up. What you don't want to hear is that you have to recode all your views because you enabled querystrings and now your links are broken! Read the manual carefully on that option!
One that I like (but didn't work because setting REQUEST_URI in config.php broke my site) is extending the Input class:
class MY_Input extends CI_Input
{
function _sanitize_globals()
{
$this->allow_get_array = TRUE;
parent::_sanitize_globals();
}
}
But the best no-nonsense way is to test with print_r($_SERVER) at the URL where you need the GET variables. See which URI Protocol option shows your GET variables and use it.
In my case, I can see what I need in
REQUEST_URI
// defeat stupid CI GET squashing!
parse_str($_SERVER['REQUEST_URI'], $_GET);
This places your query string back into the $_GET super global for that page instance (You don't have to use $_GET, it can be any variable.)
EDIT
Since posting this I found that when using REQUEST_URI, you will lose your first query string array key unless you remove everything before the ?. For example, a URL like /controller/method?one=1&two=2 will populate the $_GET array in this example with array('method?one'=>1,'two'=>2). To get around this, I used the following code:
parse_str(substr(strrchr($_SERVER['REQUEST_URI'], "?"), 1), $_GET);
I suppose I should have provided an example, so here goes:
class Pgate extends Controller {
function postback() {
parse_str(substr(strrchr($_SERVER['REQUEST_URI'], "?"), 1), $_GET);
$receipt = $this->input->xss_clean($_GET['receipt']);
}
}
If you want the unparsed query string:
$this->input->server('QUERY_STRING');
// 98% functional
parse_str($_SERVER['REQUEST_URI'], $_GET);
This in fact is the best way to handle the lack of support for $_GET query strings in CodeIgniter. I actually came up with this one on my own myself, but soon realized the same thing Bretticus did in that you had to slightly modify the way you treated the first variable:
// 100% functional
parse_str(substr(strrchr($_SERVER['REQUEST_URI'], "?"), 1), $_GET);
It was only going to be a matter of time before I got to it myself, but using this method is a better one-line solution to everything else out there, including modifying the existing URI library, is isolated to only the controller where it is applicable, and eliminates having to make any changes to the default configuration (config.php)
$config['uri_protocol'] = "AUTO";
$config['enable_query_strings'] = FALSE;
With this, you now have the following at your disposal:
/controller/method?field=value
/controller/method/?field=value
Verify the results:
print_r($_GET); // Array ( [field] => value )
Open up application/config/config.php and set the following values:
$config['uri_protocol'] = "PATH_INFO";
$config['enable_query_strings'] = TRUE;
Now query strings should work fine.
If you're using mod_rewrite to remove the index.php file, you can use the following code to obtain the GET variables (via $this->input->get()). Assuming the default configuration, name the file MY_Input.php and place it in your application/libraries directory.
Usage: $this->input->get()
class MY_Input extends CI_Input {
function My_Input()
{
parent::CI_Input();
// allow GET variables if using mod_rewrite to remove index.php
$CFG =& load_class('Config');
if ($CFG->item('index_page') === "" && $this->allow_get_array === FALSE)
{
$_GET = $this->_get_array();
}
}
/**
* Fetch an item from the GET array
*
* #param string $index
* #param bool $xss_clean
*/
function get($index = FALSE, $xss_clean = FALSE)
{
// get value for supplied key
if ($index != FALSE)
{
if (array_key_exists(strval($index), $_GET))
{
// apply xss filtering to value
return ($xss_clean == TRUE) ? $this->xss_clean($_GET[$index]) : $_GET[$index];
}
}
return FALSE;
}
/**
* Helper function
* Returns GET array by parsing REQUEST_URI
*
* #return array
*/
function _get_array()
{
// retrieve request uri
$request_uri = $this->server('REQUEST_URI');
// find query string separator (?)
$separator = strpos($request_uri, '?');
if ($separator === FALSE)
{
return FALSE;
}
// extract query string from request uri
$query_string = substr($request_uri, $separator + 1);
// parse query string and store variables in array
$get = array();
parse_str($query_string, $get);
// apply xss filtering according to config setting
if ($this->use_xss_clean === TRUE)
{
$get = $this->xss_clean($get);
}
// return GET array, FALSE if empty
return (!empty($get)) ? $get : FALSE;
}
}
Thanks to all other posters. This is what hit the spot for me:
$qs = $_SERVER['QUERY_STRING'];
$ru = $_SERVER['REQUEST_URI'];
$pp = substr($ru, strlen($qs)+1);
parse_str($pp, $_GET);
echo "<pre>";
print_r($_GET);
echo "</pre>";
Meaning, I could now do:
$token = $_GET['token'];
In the .htaccess i had to change:
RewriteRule ^(.*)$ /index.php/$1 [L]
to:
RewriteRule ^(.*)$ /index.php?/$1 [L]
Here's a full working example of how to allow querystrings in Codeignitor, like on JROX platform. Simply add this to your config.php file located at:
/system/application/config/config.php
And then you can simply get the querystrings like normal using $_GET or the class below
$yo = $this->input->get('some_querystring', TRUE);
$yo = $_GET['some_querystring'];
Here's the code to make it all work:
/*
|--------------------------------------------------------------------------
| Enable Full Query Strings (allow querstrings) USE ALL CODES BELOW
|--------------------------------------------------------------------------*/
/*
|----------------------------------------------------------------------
| URI PROTOCOL
|----------------------------------------------------------------------
|
| This item determines which server global should
| be used to retrieve the URI string. The default
| setting of 'AUTO' works for most servers.
| If your links do not seem to work, try one of
| the other delicious flavors:
|
| 'AUTO' Default - auto detects
| 'PATH_INFO' Uses the PATH_INFO
| 'QUERY_STRING' Uses the QUERY_STRING
| 'REQUEST_URI' Uses the REQUEST_URI
| 'ORIG_PATH_INFO' Uses the ORIG_PATH_INFO
|
*/
if (empty($_SERVER['PATH_INFO'])) {
$pathInfo = $_SERVER['REQUEST_URI'];
$index = strpos($pathInfo, '?');
if ($index !== false) {
$pathInfo = substr($pathInfo, 0, $index);
}
$_SERVER['PATH_INFO'] = $pathInfo;
}
$config['uri_protocol'] = 'PATH_INFO'; // allow all characters
$config['permitted_uri_chars'] = ''; // allow all characters
$config['enable_query_strings'] = TRUE; // allow all characters
parse_str(substr(strrchr($_SERVER['REQUEST_URI'], "?"), 1), $_GET);
Enjoy :-)
Set your config file
$config['index_page'] = '';
$config['uri_protocol'] = 'AUTO';
$config['allow_get_array'] = TRUE;
$config['enable_query_strings'] = FALSE;
and .htaccess file (root folder)
<IfModule mod_rewrite.c>
Options +FollowSymLinks
Options -Indexes
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond $1 !^(index\.php)
RewriteRule ^(.*)$ index.php [L]
</IfModule>
Now you can use
http://example.com/controller/method/param1/param2/?par1=1&par2=2&par3=x
http://example.com/controller/test/hi/demo/?par1=1&par2=2&par3=X
server side:
public function test($param1,$param2)
{
var_dump($param1); // hi
var_dump($param2); // demo
var_dump($this->input->get('par1')); // 1
var_dump($this->input->get('par2')); // 2
var_dump($this->input->get('par3')); // X
}
You could make a rule in your .htaccess to prevent your MOD_REWRITE from firing on that specific page. That should allow you to use the _GET.
Here is how i did it recently. Hope it helps
<?php
//adapt this code for your own use
//added example.com to satisfy parse_url
$url="http://www.example.com".$_SERVER["REQUEST_URI"];
$url=parse_url($url);
//I'm expecting variables so if they aren't there send them to the homepage
if (!array_key_exists('query',$url))
{
redirect('/'); exit;
}
$query=$url['query'];
parse_str($query,$_GET); //add to $_GET global array
var_dump($_GET);
?>
to call : http://www.mydomain.com/mycontroller/myfunction/?somestuff=x&morestuff=y
You can create a pre_system hook. In the hook class you create, you can grab the desired query params and add them to the $_POST for normal CI processing. I did this for a jQuery Ajax helper.
For instance:
(Name this file autocomplete.php or whatever you put as the file name in the hook)
<?php
/*
By Brodie Hodges, Oct. 22, 2009.
*/
if (!defined('BASEPATH')) exit('No direct script access allowed');
/**
* Make sure this file is placed in your application/hooks/ folder.
*
* jQuery autocomplete plugin uses query string. Autocomplete class slightly modified from excellent blog post here:
* http://czetsuya-tech.blogspot.com/2009/08/allowing-url-query-string-in.html
* Ajax autocomplete requires a pre_system hook to function correctly. Add to your
* application/config/hooks.php if not already there:
$hook['pre_system'][] = array(
'class' => 'Autocomplete',
'function' => 'override_get',
'filename' => 'autocomplete.php',
'filepath' => 'hooks',
'params' => array()
);
*
*
*/
class Autocomplete {
function override_get() {
if (strlen($_SERVER['QUERY_STRING']) > 0) {
$temp = #array();
parse_str($_SERVER['QUERY_STRING'], $temp);
if (array_key_exists('q', $temp) && array_key_exists('limit', $temp) && array_key_exists('timestamp', $temp)) {
$_POST['q'] = $temp['q'];
$_POST['limit'] = $temp['limit'];
$_POST['timestamp'] = $temp['timestamp'];
$_SERVER['QUERY_STRING'] = "";
$_SERVER['REDIRECT_QUERY_STRING'] = "";
$_GET = #array();
$url = strpos($_SERVER['REQUEST_URI'], '?');
if ($url > -1) {
$_SERVER['REQUEST_URI'] = substr($_SERVER['REQUEST_URI'], 0, $url);
}
}
}
}
}
?>

Categories