[eluser]qpixo[/eluser]
I have this URL:
http://www.example.com/name/pageID
I want to store pageID into session assuming it's $this->uri->segment(2);
CI doesn't recognize _GET
How would I write this function so CI can recognize the syntax?
Code:
function checkPageID() {
// check count to see if there are fresh variables being passed to the script
// if there are, we overwrite any existing page variables in the session
if ( count ( $_GET ) ) {
$_SESSION['__get'][$_SERVER['PHP_SELF']] = $_GET;
header( 'Location: http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'] );
exit();
} elseif (
array_key_exists( '__get', $_SESSION ) &&
array_key_exists( $_SERVER['PHP_SELF'], $_SESSION['__get'] ) &&
count( $_SESSION['__get'][$_SERVER['PHP_SELF']] )) {
$_GET = $_SESSION['__get'][$_SERVER['PHP_SELF']];
}
}