The online racing simulator
Showing online lfs nicks...
Hello guys,

we have one script for our community. It shows players who are online in LFS. It worked well, but we have a problem now...

There's a field lfsnick[]... We add to this field links heading on user's lfs status images... we added new player:
$lfsnick[] = 'http://www.lfsworld.net/isonline.vrtas123.gif';

It is the only lfs nick that doesn't work in it.

We compare these lfs status images if they have 1391, 1408 or 1392 bytes.

It works fine with every other lfs nick but only this... I checked it many times. The lfs nick is written correctly, lfs world stats said too that he is online... Please help :/.
Quote from Drift King CZ :It works fine with every other lfs nick but only this... I checked it many times. The lfs nick is written correctly, lfs world stats said too that he is online... Please help :/.

What's the affected user's name? Have you URL encoded the licence name?
its vrtas123 ...
Quote from Nadeo4441 :its vrtas123 ...

Just because thats what the example given says doesn't mean that's the actual username they're looking for.. Sometimes it's a very simple mistake which is the cause (such as a typoed username - there could be someone with a very similiar one, etc.).
Quote from Drift King CZ :There's a field lfsnick[]... We add to this field links heading on user's lfs status images... we added new player:
$lfsnick[] = 'http://www.lfsworld.net/isonline.vrtas123.gif';

It is the only lfs nick that doesn't work in it.

Read Karl, read
Quote from morpha :Read Karl, read

May I suggest you read my above post.

Edit: Let me clarify - I subscribe to the "people are idiots until you prove otherwise" school of thought, so until the little things are checked I fail to believe people when they say that "things don't work".
Quote from the_angry_angel :Just because thats what the example given says doesn't mean that's the actual username they're looking for.. Sometimes it's a very simple mistake which is the cause (such as a typoed username - there could be someone with the same one).

They? We (me and drift king cz wroted that code)
No it isnt any typo here, we have everything checked about 15 times ... no typo here, i can send you the code by PM if you want ...
Quote from Nadeo4441 :No it isnt any typo here

Have you got any caching in your code, or anything like that, which may affect things? Have you tried verifying the gif manually when he's online?

If yes then we'd need to get him online so that others (be it someone else, or Victor) to verify what's happening is replicated at somewhere non-local to your code.
Yes, if i put the link manually to the browser, it shows online/spec/pit. As mike said, all other usernames are working ... Just that one not ...

And caching ? we are just preventing browser from caching


<?php 
header
("Cache-Control: no-cache, must-revalidate");
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
?>

Quote from Nadeo4441 :Yes, if i put the link manually to the browser, it shows online/spec/pit.

So let me get this straight, because you've got a contradiction here. The actual gif looks fine in the browser and is reporting the correct details, but your code detects otherwise? And you're doing this completely with file sizes?

Have you actually checked the file size of the gif when it indicates when he's online, etc.? Incidentally I wouldn't recommend using this method tbh.. For any significant number of players using pubstats is a much more sane idea.
We checked it all... really. And details of vrtas123's gif say the same as other gifs.

And we are not using pubstats, because it would take more time - only 1 request per 5 seconds...

I just sent you our code.
I can see a couple of WTFs in the script and so on, but I can tell you that it seems to be working. At present vrtas123 is online at ANTIK LFS Action Drifting, and the script picks him up as such when its run on my test box.

Could be a number of things - connection time outs, etc. from your connection when it tries to talk to the LFSW servers, etc (perhaps Victor has an anti-bashing firewall script setup to prevent lots of multiple requests (I know I do on certain servers I manage at work), which mine is able to circumvent given that it's geographically and network-wise very close to the LFS servers - only Victor could answer that (I've pointed him at this thread)). Assuming that the text file is actually being updated then it won't be an execution timeout being hit, but this is another thing only you guys can check.

Quote from Drift King CZ :And we are not using pubstats, because it would take more time - only 1 request per 5 seconds...

However, I'm ignoring the entire problem for a second because what I'm looking at is utterly bonkers in concept (I'm having what can only be described as an exceptionally frustrating day, so please understand I'm not pissed off, but I maybe venting a little bit here, so take how I say things with a pinch of salt).

You're making 48 requests to the LFSW servers to see if 48 individual players are online. With pubstats you make 1. Just one. Uno. Ein. A single request. You don't need to hit each player's pst, you just need to get a host list which includes the list of each player online. This in itself will save processing time, bandwidth, etc. You don't even need to parse what server they're on (but you would get that as an added bonus. You just add the online players to some array then do an in_array() call going through your nick array. If true then they are online, if not they aren't.

In PHP the get_headers implementation uses a HTTP GET, which means more data gets thrown around, which in the long run means you're pulling down more data than you'd get from a hosts pubstats request.

You're circumventing the entire pubstats tarpit.

Look I'm not trying to be purposefully annoying or picky, but the pubstats mechanism exists for a reason.
Quote from the_angry_angel :I can see a couple of WTFs in the script...

We are only amaters...

Quote from the_angry_angel :You're making 48 requests to the LFSW servers to see if 48 individual players are online. With pubstats you make 1. Just one. Uno. Ein. A single request. You don't need to hit each player's pst, you just need to get a host list which includes the list of each player online. This in itself will save processing time, bandwidth, etc. You don't even need to parse what server they're on (but you would get that as an added bonus. You just add the online players to some array then do an in_array() call going through your nick array. If true then they are online, if not they aren't.

In PHP the get_headers implementation uses a HTTP GET, which means more data gets thrown around, which in the long run means you're pulling down more data than you'd get from a hosts pubstats request.

You're circumventing the entire pubstats tarpit.

Look I'm not trying to be purposefully annoying or picky, but the pubstats mechanism exists for a reason

Thanks for help. I am already working on the way by using 1 request... Will try. But I still don't understand why our old script didn't work with ,,vrtas123". Hope Victor will answer...
PHP4/5 - LFSWorldSDK, class for stats retrieval.

Look into the get_hosts() method. And this should work with what ever version of PHP your using. Any issues with it, please do post in the thread above. Forgive Angle he seems to be having a really bad day, and is from what I've seen, a really good guy.
Quote from Drift King CZ :We are only amaters...

Sorry, I didn't mean it harshly, it was just a couple of observations I apologise if I've caused any offence :o

On topic, I can heartily recommend Dygear's PHP library for querying LFSW, it takes care of everything for you and works very well, and was used in the stats thingy with great success

Once again, I do apologise
Hmm, I don't know, it's just too difficult for me... I'm really amater. I want to do it from zero and simply like angel said... But I have a next problem .

$hosts = file_get_contents("http://www.lfsworld.net/pubstat/get_stat2.php?version=1.4&idk=(my id key)&action=hosts");
if (eregi("Drift King CZ", $hosts)) {
echo "1";
}

Don't you know why this doesn't work? When I run the URL (http://www.lfsworld.net/pubsta ... p?version=1.4&idk=(my id key)&action=hosts) in browser and I download the file, then I can find myself in there. But the script doesn't work :/.

EDIT: This is reply on Dygear's post, not Angel's and I didn't think you meant it harshly or something.. . Anyway I just want to do it work simply and fast.
You know what, I can't think of a reason why that would not work, unless binary data throws off the eregi function. I applaud the very K.I.S.S (Keep It Simple, Stupid) approach your attempting. Try using stripos function or if your using php4 then use the strpos function, I know both are binary safe.


<?php 
$hosts 
file_get_contents("http://www.lfsworld.net/pubstat/get_stat2.php?version=1.4&idk=(my id key)&action=hosts");
if (
stripos($hosts'Drift King CZ') !== FALSE) {
    echo 
'1';
}
?>

Edit: Re reading this thread, I forgot the mention one thing. You where checking 48 different images and comparing seizes. While that's brilliant in it's own right and I have to say if it where the only way it would probably be the best, there is a better way and Angle was trying to point you toward it. With that said there is a better way and I have to say that, Angle has a extremely valid point that while brilliant your idea in it's own right it's also slightly on the retarded side in this signal instance. But you have both shown fundamental conceptual ideas that are pivotal to becoming a good programmer. If you keep at it, I bet you could rival some of the best on these forums.
Both are not working .
This worked for me, in a signal file by it's self.


<?php 
php

$hosts 
file_get_contents('http://www.lfsworld.net/pubstat/get_stat2.php?version=1.4&action=hosts&idk=(YOURIDK)');
if (
stripos($hosts'Drift King CZ') !== FALSE) {
    echo 
1;
}

?>

This printed one for me, so, the only thing I can think of is that you where offline while you tested the code. Keep in mind that the hosts pubstats information is correct at time of query. So you have to be in a server for this code to print a 1. Please also check the code stand alone in it's own file to insure that it's not conflicting with other code.
Oh my god, I'm just so stupid. Forgot to replace ,,(YOURIDK)" for my real idk :doh:. Works great. Thanks.
Quote from Drift King CZ :Oh my god, I'm just so stupid. Forgot to replace ,,(YOURIDK)" for my real idk :doh:. Works great. Thanks.

Not a problem mate and don't worry about it, I make stupid mistakes, happen, all of the time.
We finished it... Actually we finished it about hour ago, but we had the same problem with username ,,vrtas123" but finally I found up how to go round of it. There is always problem with last sorted string in the field. I don't know why it does, there's something strange with it, but it works . Anyway thanks again guys.

EDIT: If you want, can send you PM with the script.. try print_r($lfsnick); and you will maybe see where is the problem and how stupid resolution I used, but it works .
I always love to see hacks. Send da code over!
Quote from Dygear :


<?php 
php

$hosts 
file_get_contents('http://www.lfsworld.net/pubstat/get_stat2.php?version=1.4&action=hosts&idk=(YOURIDK)');
if (
stripos($hosts'Drift King CZ') !== FALSE) {
    echo 
1;
}

?>


Can you check with this query that where is the user online (server) ?
Quote from Nadeo4441 :Can you check with this query that where is the user online (server) ?

No, the idea for this was to simply check if they where on line, if you want to know what server they are on also, I would recommend at that point using the LFSWorldSDK and having it parse the results for you via the get_hosts() function then looping thought the array it makes to find the user your looking for and returning the host name they are on.
1

FGED GREDG RDFGDR GSFDG