Code archives/Miscellaneous/PHP-based BlitzMax module server

This code has been declared by its author to be Public Domain code.

Download source code

PHP-based BlitzMax module server by Fabian.2007
If you want to have your own ModServer, you first of all need an own Webserver, which must be able to execute PHP-scripts.

The BlitzMax module synchronization works over the http protocol, and it's best to use PHP scripts on the serverside. I suggest creating a new folder on a webserver where to store all the scripts and module data. If you'll use the code I post, the folder needs a subfolder called "data". This is where the actual modules are stored. Sometimes users enter the address of the modserver manually in a webbrowser, therefore you'll need an "index.php" file; you can use this one on your server:

Then you need a file called "status.php", this will be called from the client side to check where and whether the server is present:

Next you need a "listmods.php" file, which will be called by the client to determinate which modules are on the server:

The next one is surely the most important one: the client calls the "getmod.php" file on the server to download a module:

And the last file, called "putmod.php" is needed for you, to upload your modules:

Summarising: These files I posted you above should be with the specified names in a separate folder on your webserver. There needs to be a subfolder "data". If you replace yourscope, -username, -password with the actual scope, username, password, you can upload your modules typing this on command line
syncmods -u yourusername -p yourpassword yourscope
and others can download your modules by typing:
syncmods yourscope
On the downloading client, the username and password are ignored. A correct user name and password is only important to upload your modules.

I think, that's it. Then you should be able to host your own module server. But if you're having problems, just ask....
.

Comments

xlsior2007
Very interesting!

One thing though -- do you know if syncmods has a command line parameter to specify the modserver location, or can you only point it at your own by modifying the /cfg/modservers.cfg file?


Fabian.2007
As far as I know there's no command line option, I also wish there would be one.

I wrote a command line program called xsyncmods which needs to be placed in the BlitzMax "bin" directory. This actually just calls the normal syncmods while permanently changing the cfg/modservers.cfg file to connect to different servers.

Here's how you call xsyncmods from command line:

So there need to be five command line parameters per server, all parameters need to be prepended by a colon. Parameters containing spaces need to be quoted. If you want to leave of a parameter (password, username or proxy) you just write a single colon as parameter.

But I think the source code tells more than every desciption, you can get it here. It really does nothing more than simply change the contents of cfg/modserver.cfg and then call the normal syncmods.

For more information see my post here, you can also find an IDE there calling this command line tool. This thread was actually the reason why I created this code archive entry.


Code Archives Forum