Page 1 of 1
[SOLVED] rtim function
Posted: Fri Jan 28, 2005 2:10 pm
by drgnjucr
Would anyone know how I can grab just a portion of my url string?
Here is the url I am working with:
Code: Select all
http://localhost/uilogin.php?authID=1&uid=drgnjucr&url=secured.php
I want to rtrim (or any other way) so all I return is the pagename. In my example, I'm looking to return just "secured.php"
I was trying something like this:
Code: Select all
$pageName = rtrim($_SERVERї'QUERY_STRING'],'url=');
It didn't work, and I'm not sure how to do this. Any help would be appreciated.
Thanks!
Mike
Posted: Fri Jan 28, 2005 3:22 pm
by feyd
Posted: Fri Jan 28, 2005 3:38 pm
by cob05
This should work for you:
Code: Select all
$pageName = $_REQUESTї'url'];
echo "The pagename is: $pageName";
Posted: Fri Jan 28, 2005 3:41 pm
by drgnjucr
Thanks for the reply.
I was about to post a comment saying I fix my issue... cause I did, but I found a different fix other than what you have suggested.
Code: Select all
$qs = $_SERVERї'QUERY_STRING'];
if (strpos($qs, 'url=') !== false) {
$_SESSIONї'pageName'] = $qs;
}
If there any prefered method? Or basically what ever works!

So, my issue is fixed, but if there is a better practice as to how I should acomplish my goal; I'd rather do it that way.
Mike
Posted: Fri Jan 28, 2005 3:50 pm
by feyd
$_GET is the oft used method, as it's simple and already parsed for you.
Posted: Fri Jan 28, 2005 4:16 pm
by drgnjucr
I'm not sure that I can use $_GET here, because I'm posting data back to the page. It's my login page and I'm doing a bunch of stuff on it.
At any rate, I'm gunna say my issue is fixed.
Thanks for all the input from all!
Mike