This has to do with session data again.
I was looking to display a list of current users that are logged onto my site and decided that the best way to do it was to parse out the value field that my sessions create.
Well in doing that here is what i got:
This works to pull any of the values out for what ever $lookfor is set to. It does work for any of the values that I look for, but I was wandering if anyone had any other way of doing this that may be a bit more efficent and cleaner.Code:while($result = mysql_fetch_array($rs)) { //value to look for $lookfor = "UserName"; //intial starting postion $intial = strpos($result["value"], $lookfor); //length of the string that we are looking for $strlength = strlen($lookfor) + 3 + $intial; //number of digits in the length $numdigits = strpos($result["value"], ":", $strlength) - $strlength; //finally sets the length to the correct value $strlength = substr($result["value"], $strlength, $numdigits ); //gets the string $CurrentUser = substr($result["value"], $intial + strlen($lookfor) + 5 + $numdigits , $strlength); echo("<BR>".$CurrentUser); }
If not oh well and thanks for taking a look at it anyway.
-Nick




Reply With Quote