Page 1 of 1

Obtaining IP addresses and other non-web related data

Posted: Sat Mar 19, 2005 2:07 pm
by TheOracle
Hi All,

I have recently set-up a games hosting comapny as an extension to my web-design/hosting one.

Although there are some 'ok' control panels out there for starting/stopping services, I would like to build my own custom one to fit in with the rest of my site.

However, I am at a loss as to how to obtain things like Microsoft Services, or player IP addresses through PHP. Can anyone point me in the right direction?

Also, how could I create or use those IP addresses in order to then stop those people connecting to the server, depending on certain criteria.

I am happy doing the coding but am just not sure what existing variables would come in handy.

Any help would be much appreciated.

Posted: Sat Mar 19, 2005 2:24 pm
by shiznatix
$HTTP_SERVER_VARS["REMOTE_ADDR"];

that gets the users ip address.
im not sure what you mean when stop the users from doing somthing depending on somthing else but you can save a log of the users ip when the login (if they are using a username and password) in a db so you have their most recently used ip on file then you can match the one you get when they connect to the most recently used one but i dont know what you are really trying to do so thats the most start i can offer.

Posted: Sat Mar 19, 2005 2:26 pm
by John Cartwright
I know most game servers keep logs of all their stats such as

1) player name
2) time online
3) kills/deaths/etc.
4) IP address

and many more.

Your existing control panels probably use SSH to issue commands to the server to tell it to restart or whatever, but your logs are most likely what you are after.

to get the logs, you are probably going to need ftp access to the server

http://www.php.net/ftp - connect to the server
http://www.php.net/file_get_contents - get files as a string
http://www.php.net/preg_match - grab data from string (probably need some help using this one though)

should be usefull


to get you started

Posted: Sat Mar 19, 2005 3:02 pm
by TheOracle
thx for your input guys.

On another note, how would I go about starting or stopping a windows service through a web panel. Would I need to get it to execute a batch file? If so, how can this be acheived?

Posted: Sat Mar 19, 2005 3:09 pm
by feyd
issue a networking command to them: 'net start <servicename>' or 'net stop <servicename>'

Those must be issued on the machine in question. ...Although most game servers are unix based in my experience..