Re: How to get Usernames

From: Date: Sat, 03 Nov 2001 00:43:21 +0000
Subject: Re: How to get Usernames
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-73314@lists.php.net to get a copy of this message
Okz, Hows this... $myarray = explode('/', $REQUEST_URI); for ($i=0; $i<count($myarray); $i++) { $mystr = $myarray[$i]; if ($mystr[0] = '~') { $username = substr($mystr, 1); $i = count($myarray); }; }; and presto, username in $username [there are more efficient ways to walk the array, but I've had a long day...] Hope that helps, Shane On Friday 02 November 2001 6:46 pm, lists@mhess.qn.net wrote: > Ok, > > How do I do that? > > > Hi Michael > > > > How about explode()ing it using '/' as the seperator, then finding the > > element in the resulting array that begins with '~', strip that first > > character using substr() and bod's your uncle... > > > > I'd write the code but I've had a long day... > > > > Shane > > > > On Friday 02 November 2001 6:11 pm, lists@mhess.qn.net wrote: > > > I have a setup where users can access their own pages using a > > > /~username here account > > > > > > I need to put a PHP script in their directoies that will be able to > > > tell me what their username is. > > > > > > I was thinking about $REQUEST_URI however if I go to > > > /~username/dir/page it will return it all. > > > > > > all I want is the username... > > > > > > Thanks for your help, > > > Michael

« previous php.general (#73314) next »