php help
im trying to put in my website a who all online thingy.
i can list all the players online with a telnet connection but it outputs more info then i need so i want to strip our everything i don't need and only keep what i do and i have always had problems with striping so i figured i would ask for help. i am using this. PHP Code:
Code:
[59 Master] Yuari (Iksar) zone: sebilis AccID: 298 AccName: Flora LSID: 110561 Status: 0 level name race class zone and then strips everything and places relevant info under the right catagory.. can someone help me with this? |
In general, you're probably going to want to use Regular Expressions, although it's gonna be a little complicated.
When I log into my GM character, this is everything that's returned with the "who" command in the telnet window: Code:
* GM-Impossible * [ANON 70 Stone Fist] Xamlagar (Iksar) zone: poknowledge AccID: 13 AccName: AndMetal LSID: 87737 Status: 250 Code:
[59 Master] Yuari (Iksar) zone: sebilis AccID: 298 AccName: Flora LSID: 110561 Status: 0 First, we'll start by pulling just the character info: PHP Code:
To separate any GM flag, you should be able to use this: PHP Code:
Code:
GM-Impossible PHP Code:
I'm sure there's more efficient ways of doing this, especially if you can pull just what you're looking for the with Regular Expression instead of everything around it, but this will at least get the job done. Hope this helps. |
ok i tried doing a print_r($players); and got an error.
Warning: Invalid argument supplied for foreach() in E:\wamp\www\who.php on line 46 for each player online btw this is after adding to my code so line 46 is the first line there. foreach ($ret as $key => $value) { what should i do and am i calling the print_r($players); correctly or should i do something else. im trying to print it so i can see all the values of the array so i can place them in the right tables |
For some reason, my Telnet code made sense the other day, but after looking at it now, I'm not sure where me head was :confused:
Here is the entire script I put together for testing: PHP Code:
PHP Code:
|
ok this is working but i cant figeur out how to call the arrays to put them wher ei want them in a table
i tried echo $players["Class"]; and echo $players[1]; and echo $players["Class"][1]; nothing is working. |
nvm i got it working $players[1]['Class']; where q is the player and 'class' is what im looking for..
i do see a problem though it messes up if there zoneing. i would just check if there zoneing and put zoneing in all the fields but the name messes up also so i cant say there name.. is there a way to put in a zoneing check of the name at lest? |
this is what i see when someone is zoneing
Code:
$ret = Array |
All times are GMT -4. The time now is 07:48 AM. |
Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.