Simple IP sharing script

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 ...


Go Back   Usenet Forums > PHP Programming Forums > alt.comp.lang.php

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 01-29-2004
Gernot Frisch
 
Posts: n/a
Default Simple IP sharing script

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


Reply With Quote
  #2 (permalink)  
Old 01-29-2004
Tim Van Wassenhove
 
Posts: n/a
Default Re: Simple IP sharing script

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
Reply With Quote
  #3 (permalink)  
Old 01-29-2004
Gernot Frisch
 
Posts: n/a
Default Re: Simple IP sharing script


"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?



Reply With Quote
  #4 (permalink)  
Old 01-29-2004
Tim Van Wassenhove
 
Posts: n/a
Default Re: Simple IP sharing script

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
Reply With Quote
  #5 (permalink)  
Old 01-29-2004
Gernot Frisch
 
Posts: n/a
Default Re: Simple IP sharing script

> 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.


Reply With Quote
  #6 (permalink)  
Old 01-29-2004
CountScubula
 
Posts: n/a
Default Re: Simple IP sharing script

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
>
>



Reply With Quote
  #7 (permalink)  
Old 01-30-2004
Gernot Frisch
 
Posts: n/a
Default Re: Simple IP sharing script


"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
> >
> >

>
>



Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 02:14 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0