This is a pretty simple problem, but im getting myselft confused...
i want to get the name of the page that i am on... so for example:
if i am on
i want to be able to extract:
Now i test my pages on IIS but my live server is Apache
now ive tried SCRIPT_FILENAME and SCRIPT_NAME
on IIS SCRIPT_FILENAME gives me undefines variable and SCRIPT_NAME gives me the whole path ie: /php/home/myfile.php
on Apache SCRIPT_FILENAME gives me the whole path and SCRIPT_NAME gives me +- what i want /myfile.php (i just have to get rid of the / ).
i need to do the following:
get SCRIPT_NAME (/page.php)
$page = remove the / (using ereg replace)
make the string: $page."?".QUERY_STRING
This should work on Apache right? or is there a better way of doing it? cause this seems like a lot of work for something which should be quite easy?
ok. well here is was i did for anyone interested. I was making it so that if someone goes to a page before they are logged in they will be redirected to that page again after login:
Works in apache :)
$page = $_SERVER['SCRIPT_NAME'];
$page = substr($page,1);
$page = $page."?".$_SERVER['QUERY_STRING'];
$_SESSION['redirect'] = $page;