Question for any web gurus out there.

Previous topic - Next topic

Hatonastick

I have a webserver with PHP and SQL, so I suspect this is possible, but not sure where to start.  Actually I'm even having trouble describing what I want to do...

Basically (for fun) I'm writing a MUD server.  I would like to find a way that allows this server when running on a machine that is on a non-static IP (ie. they reboot their modem or reconnect their modem, their ISP gives them another IP number) to enable people to connect to it using a client.  So basically the server would contact the webserver and say 'Here is my IP' and 'MUD Server is up and running', and the webserver would have a page that updates and allows people to see a list of servers running and the IP and Port they need to connect to it.

Of course it would probably be better to also write my own client and have all this done 'invisibly' on the webserver.  That would allow me to do the other thing I'd like and that is for (if configured to do so) MUD servers to contact each other and allow players to move between them.

In the end I guess the easiest option is simply report the external IP address on the screen of the MUD server when it is run and leave it up to whoever is running it to record it somewhere publicly so people (or just friends) can connect, or give to friends also running servers to allow them to "talk" to each other.  Going the webserver route would be pretty much writing a complete game lobby system with user created accounts, password protection and the rest I suspect.
Mat. 5: 14 - 16

Android: Toshiba Thrive Tablet (3.2), Samsung Galaxy Tab 2 (4.1.2).
Netbook: Samsung N150+ Netbook (Win 7 32-bit + Ubuntu 11.10).
Desktop: Intel i5 Desktop with NVIDIA GeForce GTX 460 (Win 8.1 64-bit).

Slydog

You could always use a service that monitors your ip address, and when it changes it alerts the service, and the service updates the DNS for you.

One that I have used is 'No-IP', and they have a free option:
http://www.no-ip.com/services/managed_dns/free_dynamic_dns.html

You can get an URL such as 'hatonastick.no-ip.info' that will always redirect traffic to your computer.
I think you can have your own domain name too (if not, other services may allow this) such as 'hatonastick.com' or something.

There may be better free ones out there I think.  Never really investigated.
My current project (WIP) :: TwistedMaze <<  [Updated: 2015-11-25]

Moru

If you don't want to rely on free things like no-ip.org you can easily do this in PHP. Just do a NETWEBGET$('your servers address/ip.php?name=SlyDogs+Server')
Don't quote me on glbasic syntax at the moment, I'm a bit out of practice sadly. What you want to do is download a file located at "http://www.yourserver.com/ip.php?name=Nameofserver"


The PHP script looks something like this:

Code (glbasic) Select

$ip = $_SERVER['REMOTE_ADDR'];
$name = $_GET['name'];

//Now you can enter them into your Database.

$con = mysql_connect("localhost","user","password");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("DatabaseName", $con);

mysql_query("INSERT INTO servers SET IP = '$ip', NAME = '$name' ");


Or something like that. This is ofcourse without any safety-checks and so on, just a basic example.

Hatonastick

Thanks guys!  Glad someone made some sense of my original post. :)

Anyway, you've both given me a lot to think about.

I think maybe I will have to look into doing my own.  Guess it's time to brush up on my PHP (boy, haven't done that since it was first released) and learn about SQL.  I must admit it would be better if the whole thing was automatic rather than people having to do things manually.  What you've given me there Moru is a head start I think, thanks. :)
Mat. 5: 14 - 16

Android: Toshiba Thrive Tablet (3.2), Samsung Galaxy Tab 2 (4.1.2).
Netbook: Samsung N150+ Netbook (Win 7 32-bit + Ubuntu 11.10).
Desktop: Intel i5 Desktop with NVIDIA GeForce GTX 460 (Win 8.1 64-bit).

kanonet

Did you check Samples/Network/InternetSessions? Maybe i got you wrong, but isn't that exactly what you want?
Lenovo Thinkpad T430u: Intel i5-3317U, 8GB DDR3, NVidia GeForce 620M, Micron RealSSD C400 @Win7 x64

Hatonastick

Ahhh.  Yes I might be able to modify that to what I want even though I'm using raw sockets and not the NET commands.  Will look at it later, thanks very much for bringing it to my attention.  Every time I think I've looked at all the samples I discover I missed something.  :blink:
Mat. 5: 14 - 16

Android: Toshiba Thrive Tablet (3.2), Samsung Galaxy Tab 2 (4.1.2).
Netbook: Samsung N150+ Netbook (Win 7 32-bit + Ubuntu 11.10).
Desktop: Intel i5 Desktop with NVIDIA GeForce GTX 460 (Win 8.1 64-bit).