This is a discussion on Simple IP sharing script within the alt.comp.lang.php forums, part of the PHP Programming Forums category; Hi, I don't know about PHP, but C++, so I think my problem is really easy to write for ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
Hi,
I don't know about PHP, but C++, so I think my problem is really easy to write for one who knows php. I want 3 scripts for a web-server that can exchange ip addresses for game-servers. So, if I start my game server, it can send a message to my web-server and if a client asks my web-server it get's the IP address(es) of the available game server(s) for a secific game. One script, that receives an IP address and a game name. Now the script should store both on a local file (append the data) and give it a time stamp. post.php?name="Kung-Fu"&ip="195.12.12.12" Next, a script that gives me a list of IP addresses for a given game name. get.php?name="Kung-Fu" gives a list like: 195.12.12.12 193.42.34.12 .... This script should look for 'old' IP addresses that are older than 12 hours (or do not respont to a 'ping') for servers that didn't log-off properly. And a third one that deletes an given IP from the list (when a server logs off) logoff.php?ip="192.12.12.12" Can anyone help me writing it? I have a MySQL database, but only _one_ which is used by my web-forum. Can it be shared or is it possible by simply creating a .txt file on the web-server? I'd really appreciate your help, -- -Gernot Post here, don't email. If you feel you have to mail, revert my forename from: tonreG.Frisch.at.Dream-D-Sign.de@invalid.com ________________________________________ Looking for a good game? Do it yourself! GLBasic - you can do www.GLBasic.com |
|
|||
|
On 2004-01-29, Gernot Frisch <Me@Privacy.net> wrote:
> One script, that receives an IP address and a game name. Now the > script should store both on a local file (append the data) and give it > a time stamp. > Next, a script that gives me a list of IP addresses for a given game > name. > And a third one that deletes an given IP from the list (when a server > logs off) > logoff.php?ip="192.12.12.12" All you need is to do is add a table to your database games(name,timestamp,ip) and then perform the relevant queries. -- http://home.mysth.be/~timvw |
|
|||
|
"Tim Van Wassenhove" <euki@pi.be> schrieb im Newsbeitrag news:bvb3oj$q2ejk$5@ID-188825.news.uni-berlin.de... > On 2004-01-29, Gernot Frisch <Me@Privacy.net> wrote: > > One script, that receives an IP address and a game name. Now the > > script should store both on a local file (append the data) and give it > > a time stamp. > > Next, a script that gives me a list of IP addresses for a given game > > name. > > And a third one that deletes an given IP from the list (when a server > > logs off) > > logoff.php?ip="192.12.12.12" > > All you need is to do is add a table to your database > games(name,timestamp,ip) > and then perform the relevant queries. Well, if it's really that easy - can you give short code snippets that do this? I think it's only 10 lines for each, no? |
|
|||
|
On 2004-01-29, Gernot Frisch <Me@Privacy.net> wrote:
> > "Tim Van Wassenhove" <euki@pi.be> schrieb im Newsbeitrag > news:bvb3oj$q2ejk$5@ID-188825.news.uni-berlin.de... >> On 2004-01-29, Gernot Frisch <Me@Privacy.net> wrote: >> > One script, that receives an IP address and a game name. Now the >> > script should store both on a local file (append the data) and > give it >> > a time stamp. >> > Next, a script that gives me a list of IP addresses for a given > game >> > name. >> > And a third one that deletes an given IP from the list (when a > server >> > logs off) >> > logoff.php?ip="192.12.12.12" >> >> All you need is to do is add a table to your database >> games(name,timestamp,ip) >> and then perform the relevant queries. > > Well, if it's really that easy - can you give short code snippets that > do this? I think it's only 10 lines for each, no? Here are the queries, you write the wrapping around it: insert into games('homework',NOW(),'school.com'); select * from games where name='quake3'; delete * from games where timestamp < NOW()-60*60*24 delete * from games where ip='school.com'; -- http://home.mysth.be/~timvw |
|
|||
|
> Here are the queries, you write the wrapping around it:
> > insert into games('homework',NOW(),'school.com'); > select * from games where name='quake3'; > delete * from games where timestamp < NOW()-60*60*24 > delete * from games where ip='school.com'; Yeeeees.... that looks promising. I'll give it a try and tell you later. I've never written a line of php, but I'll try. My webspace provider is still busy arranging all the neccessities for php and MySQL... Can't wait 'till is get's started. Thanks a lot, Gernot. |
|
|||
|
use dynamic dns on the game servers, and a dns server
kungfu.yourdom.com IN A 195.12.12.12 kungfu.yourdom.com IN A 193.42.34.12 and use low expire times -- Mike Bradley http://www.gzentools.com -- free online php tools "Gernot Frisch" <Me@Privacy.net> wrote in message news:bvb13s$q7c42$1@ID-37212.news.uni-berlin.de... > Hi, > > I don't know about PHP, but C++, so I think my problem is really easy > to write for one who knows php. > > I want 3 scripts for a web-server that can exchange ip addresses for > game-servers. So, if I start my game server, it can send a message to > my web-server and if a client asks my web-server it get's the IP > address(es) of the available game server(s) for a secific game. > > One script, that receives an IP address and a game name. Now the > script should store both on a local file (append the data) and give it > a time stamp. > post.php?name="Kung-Fu"&ip="195.12.12.12" > > > Next, a script that gives me a list of IP addresses for a given game > name. > get.php?name="Kung-Fu" > gives a list like: > 195.12.12.12 > 193.42.34.12 > ... > This script should look for 'old' IP addresses that are older than 12 > hours (or do not respont to a 'ping') for servers that didn't log-off > properly. > > > And a third one that deletes an given IP from the list (when a server > logs off) > logoff.php?ip="192.12.12.12" > > > Can anyone help me writing it? I have a MySQL database, but only _one_ > which is used by my web-forum. Can it be shared or is it possible by > simply creating a .txt file on the web-server? > > I'd really appreciate your help, > > -- > -Gernot > > Post here, don't email. If you feel you have to mail, revert my > forename from: > tonreG.Frisch.at.Dream-D-Sign.de@invalid.com > ________________________________________ > Looking for a good game? Do it yourself! > GLBasic - you can do > www.GLBasic.com > > |
|
|||
|
"CountScubula" <me@scantek.hotmail.com> schrieb im Newsbeitrag news:BxdSb.19305$ys7.11348@newssvr25.news.prodigy. com... > use dynamic dns on the game servers, and a dns server > > kungfu.yourdom.com IN A 195.12.12.12 > kungfu.yourdom.com IN A 193.42.34.12 > > and use low expire times Sorry, I don't understand what you mean. How can I do this? I want to have the users create web-servers for _any_ game they wrote on my web-server with this method. BTW: Can I get the IP adderss of the computer that calls my page, so I don't have to find it out by myself. -Gernot > > > -- > Mike Bradley > http://www.gzentools.com -- free online php tools > "Gernot Frisch" <Me@Privacy.net> wrote in message > news:bvb13s$q7c42$1@ID-37212.news.uni-berlin.de... > > Hi, > > > > I don't know about PHP, but C++, so I think my problem is really easy > > to write for one who knows php. > > > > I want 3 scripts for a web-server that can exchange ip addresses for > > game-servers. So, if I start my game server, it can send a message to > > my web-server and if a client asks my web-server it get's the IP > > address(es) of the available game server(s) for a secific game. > > > > One script, that receives an IP address and a game name. Now the > > script should store both on a local file (append the data) and give it > > a time stamp. > > post.php?name="Kung-Fu"&ip="195.12.12.12" > > > > > > Next, a script that gives me a list of IP addresses for a given game > > name. > > get.php?name="Kung-Fu" > > gives a list like: > > 195.12.12.12 > > 193.42.34.12 > > ... > > This script should look for 'old' IP addresses that are older than 12 > > hours (or do not respont to a 'ping') for servers that didn't log-off > > properly. > > > > > > And a third one that deletes an given IP from the list (when a server > > logs off) > > logoff.php?ip="192.12.12.12" > > > > > > Can anyone help me writing it? I have a MySQL database, but only _one_ > > which is used by my web-forum. Can it be shared or is it possible by > > simply creating a .txt file on the web-server? > > > > I'd really appreciate your help, > > > > -- > > -Gernot > > > > Post here, don't email. If you feel you have to mail, revert my > > forename from: > > tonreG.Frisch.at.Dream-D-Sign.de@invalid.com > > ________________________________________ > > Looking for a good game? Do it yourself! > > GLBasic - you can do > > www.GLBasic.com > > > > > > |