The online racing simulator
Prob getting server status with PHP script
Today I downloaded the PHP script from
http://www.lfsforum.net/showthread.php?t=195

I've filled in the required information
in the CONNECTION INFO field of the file _data_config.php and uploaded the files of the script to my website lets call it http://www.mywebsite.com/LFSPHPSCRIPT
here's how that part looks like

Quote :$serverprot[0] = "http"; // Server protocol for access on host.txt ("ftp" or "http")
$serverip[0] = "xxxxxxxxxx.homedns.org:8888"; // IP or Hostname (e.g. "196.235.12.2"). If the server is running on a non-default port, enter the port number behind the adress (e.g. "bla:21")
$hostpath[0] = ""; // Path to the host file (without filename and with leading / but without closing / (e.g. "/games/lfs"). Leave empty if the path is root.
$ftpuser[0] = ""; // FTP Login Name (if not required, e.g. for HTTP, keep this field empty)
$ftppw[0] = ""; // Password for FTP login (if not required, e.g. for HTTP, leave this field empty)
$lfsport[0] = "63392"; // Port on which LfS is running (included in the filename of the hostXXXXX.txt file). Default should be 63392

- I didnt want to use port 80 coz it might be restricted by my isp and i decided to use 8888 instead..
- I've configured my router to forward port 8888 to 192.168.1.10.
I'm using a static ip of 192.168.1.10.
and I've changed the lines in the Apache2.2 httpd.conf file so it is configured to grant access to LifeForSpeed folder in my computer.
- Created a Hostname xxxxxxxxxx.homedns.org with DynDNS.
- When I put xxxxxxxxxx.homedns.org:8888 into the address bar it connects to the folder in this computer where lfs is hosted and there I can see the all the files and also host63392.txt file which means the link is working. Btw i set up an internet server it's called PRO starters' Drift, which creates the "host63392.txt" file.

Up to this point is all fine? correct any problems please

continuing

So with the router stuff configured right, and with the CORRECT CONNECTION INFO entered, that means when I run the http://www.mywebsite.com/LFSPHPSCRIPT/server.php file on my website(this comes with the addon, to displays the server status like the number of players and so forth) the script should connect directly thru port 8888 to my computer, read the host63392.txt file, and output it into the server.php, so I should see the server status as online right?
But having done all these, I dont see anything.

Only an error:
File access error!Hostname:
Status: Could not connect to the server!

Version:
User connected: /
Track:
Cars:
Qualifying:
Race length:

Racers online:
No racer online
Quote from wonderous :- When I put xxxxxxxxxx.homedns.org:8888 into the address bar it connects to the folder in this computer where lfs is hosted and there I can see the all the files and also host63392.txt file which means the link is working. Btw i set up an internet server it's called PRO starters' Drift, which creates the "host63392.txt" file.

Didn't dig too deep into problem, but my guess is that this test works because both computers (or is it same computer even?) are behind that router. From outside world you probably can't connect, so something wrong with port forwarding.
#3 - Davo
I can't access that link. You sure your free host has php?
My host is bluehost http://www.bluehost.com/
it supports all kinds of scripts, so I'm sure it's running,
also I have my personal forum running just to play around with the software they provided, that means php is supported.

So what do you think is the prob , can someone help
Is it because my webhost cannot access my computer in this manner?
#5 - Davo
Start with checking logs to see if there's any access going on. Then make sure you're using the right username and password. Sometimes it's the simple things. Maybe your host doesn't allow ftp or http access through php?
Thanks for the reply.
Ok, I actually asked my friend to access the link, it works perfectly and he's from another isp. That means i'm connected directly to the internet.
He gave me a screeny of the files he saw and those were the exact files i have in my pc. That means the link is definitely working. I even tried it on other computers on the lan, even tapped my neighbours connection for a while to connect and I managed.
The access log says:
192.168.1.1 - - [13/Mar/2007:15:12:49 +0800] "GET / HTTP/1.1" 200 667
everytime someone visits the thing. And there's no prob

So, the problem now lies with the script
Quote :$serverprot[0] = "http"; // Server protocol for access on host.txt ("ftp" or "http")
$serverip[0] = "xxxxxxxxxx.homedns.org:8888"; // IP or Hostname (e.g. "196.235.12.2"). If the server is running on a non-default port, enter the port number behind the adress (e.g. "bla:21")
$hostpath[0] = ""; // Path to the host file (without filename and with leading / but without closing / (e.g. "/games/lfs"). Leave empty if the path is root.
$ftpuser[0] = ""; // FTP Login Name (if not required, e.g. for HTTP, keep this field empty)
$ftppw[0] = ""; // Password for FTP login (if not required, e.g. for HTTP, leave this field empty)
$lfsport[0] = "63392"; // Port on which LfS is running (included in the filename of the hostXXXXX.txt file). Default should be 63392

Hmm, everything works fine. It's just that the server.php does not get the file from this pc, keeps returning:
File access error!Hostname: [url="lfs://||0|S2|/"][/url]
Status: Could not connect to the server!

Version:
User connected: /
Track:
Cars:
Qualifying:
Race length:

Racers online:
No racer online
oh yes, and it also means the router's port forwarding is working. Port 8888

Forgot to reply one of your questions..I'm not sure if my host allows me to access ftp or http thru php, but I guess this is possible, wait let me check with the webhost, it provides live chat. So i'll ask them right away.
the support says it blockes off 8888, and he said that default port 80 is the only port open for shared ips (like mine).
Now i'm gonna modify the script, get back soon, 10 mins
i asked the support, and they mentioned that there are no restrictions on their port 80. While i was chatting with him i asked him to view the link xxxxxxxx.homedns.org/ and he said he can't connect he even tried to connect with three networks but he couldnt connect to my server and didnt see the files in my server.
My friend who's using another isp tried the link and he could get thru, he's from Singapore also. But the support guy is in US and he says he can't access my server and that port 80 is open entirely on their side and said it is probably my side which has configured wrongly. Any suggestions on how check if my isp blocked port 80?
Chatted with another support guy, this guy says that the script might not be running on port 80.
I dont know what port this script runs on, but I assume it runs on 80 because it's a http connection -
someone please help
Help
Sorry for my late delay. Didn't looked at the forums for a while.

I guess your ISP denies URL access for PHP's file (fopen, fread etc) functions.

Please open your server.php file and go to the line 166:


$datei[$c] = @fopen($filepath[$c], r);

change it to


$datei[$c] = fopen($filepath[$c], r);

Save the file and try again. You should now receive an error. Please post back with the exact error message.
Well this is what i've got:

Quote :Warning: fopen(http://[email protected]/host63392.txt) [function.fopen]: failed to open stream: Connection timed out in /home/theohbro/public_html/myservers/lfs/server.php on line 166
File access error!Hostname:
Status: Could not connect to the server!

Version:
User connected: /
Track:
Cars:
Qualifying:
Race length:

Racers online:
No racer online



by the way I changed the link to http://theohbrothers-lfs.no-ip.org/ that's about it
Well I cannot even access the URL you posted ( http://theohbrothers-lfs.no-ip.org/ ), so I don't wonder that the script won't work.

My browser is loading and loading (Firefox - Network timeout) and a ping won't pass through, too (see below). So the script itself has the same problem and gets a timout.

PING theohbrothers-lfs.no-ip.org (xx.xx.xx.xx): 56 data bytes
--- theohbrothers-lfs.no-ip.org ping statistics ---
114 packets transmitted, 0 packets received, 100% packet loss

So the problem seems to be somewhere in your setup (Router, DNS...)
I have configured the router to port forward 80 to my static ip address 192.169.1.10, i dont think the prob lies with my configuration but the isp, because my friends are able to access my computer with that link,
you couldnt reach me probably maybe because my isp is blocking port 80 incoming i've done some research it seems to be. So what should i do next

#actually some of my friends i asked to follow that link use the same isp as me, and the others use another isp. I dont know why but all of them seem to be able to view my website, seems like this works within the country or maybe te two isp open the ports(like 80) between them and not the rest of the internet that's what im thinking
GEEZ I THOUGHT OF A BRILLIANT IDEA!!!!
Maybe this can work

Well i just downloaded LFSLapper, I ran it on my server it seems to work fine no bugs, up running very well. Well i realised in the LFSLapper.cfg file there's a function to upload via FTP. I keyed in the necessary connection info and now the script is uploading that file up to my webhost! if this can happen, why not we include uploading the host69932.txt with it, that way the script doesnt need to access the file via http or ftp from my computer anymore, because the host file will only be a few folders away, and i dont have to deal with all these probs!

If this can work, can someone tell me how I can get LFSLapper to upload the host69932.txt file together with the PB.txt file into my webhost,
aand also the server script just needs to be modified a lil and it'll all be working!
#17 - Davo
AFAIK lapper only uploads ther pb.txt file unless you modify the code. This script is now obsolete since it uses an old method of lookign up server details. With S2 licence it is much easier to get server info and a new script has been made that uses lfsworld.

I think the problem is that some datacentres have a lot of asia blocked off since they get a lot of hackers and crackers from there.

Another solution would be to use an automated ftp client to upload the file to your webhost and read it from there.
do you have any idea where i can get those automated ftp clients
i dont want those smartftp kind that absorb so much of my memory, i just need some background app that constantly uploads the file every minute or so
#19 - Davo
google
that's what i'm doing, seems like all of them aer large apps, help get some for me please/
Maybe try to set up a FileZilla ftp server. It will be set up on port 21 by default. Tell it to use the path of your LFS server as the default path. Afterwards you have to configure your router according to that.

Then edit the config file of my script according to that changes (FTP, Username, Password, Path)
YOS I DID WHAT DAVO SAID, i used Fling FTP http://www.nchsoftware.com/ftp/index.html
the software detects changes within a folder and uploads when a change is detected, in this case it's host63392.txt, and now with it running in the background i wont need to worry anymore i dont need to host the file on my computer anymore cuz my isp is giving me headaches,
well i just modified the lfs S2 server script to access the path in my website and it works! now all is fine the problem is solved thanks all for sharing, greatly appreciate!

Two days of hard work
Wonderous
Glad you have it now and thanks for your tipps, too.

Hope you like the script

FGED GREDG RDFGDR GSFDG