Forum Moderators: coopster

Message Too Old, No Replies

Updating portable web server with hosted site

         

pixeldiver

11:48 pm on Feb 7, 2010 (gmt 0)

10+ Year Member



Hi all,

I have been asked to develop a usb stick system where files would be updated from the web server to a transportable device such as a usb stick.

Basically, a user plugs in his usb stick and the stick launches an interface php page where he/she can click "update files" or an "update available" message appears.

If clicked update, the webserver transfers the necessary files to the usb device.

The user then has the opportunity to browse through the website on the usb device in offline mode.

How would you attack this project? Any thoughts?

I think the usb device needs to have a portable web server installed to handle the php pages.
And it could be database driven and just updates the database and files on the usb device.

edacsac

12:11 am on Feb 8, 2010 (gmt 0)

10+ Year Member



There are a few places to find a portable webserver build. A quick search turned up a couple of interesting links. Recognizing the USB drive and firing off it's related executable is beyond server side programming.

I'm sure you could do something in .net - a quick executable that logs in via ftp, then does a directory compare between the USB drive and the server contents or a datbase dump comparision.

To have it automatically recognize would require autorun to be enabled in the least, or better make the executable run as a service on the PC that scans the USB drive for a trigger file to kick off the rest of the process. Easier to just click an icon to the run the executable though.

Sounds like an interesting project; hope the pay is good!

pixeldiver

12:37 am on Feb 8, 2010 (gmt 0)

10+ Year Member



Hi edacsac,
thanks for the reply, I have installed a portable server which starts up and runs a browser automatically.

It is now up to installing a few scripts for the login and update procedures.

It is an interesting project and pays well.
Let's see where the hard corners are?

mack

12:41 am on Feb 8, 2010 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



Its also worth noting that a usb stick, cant autorun. Well, there are workaround, but general speaking the user will need to initiate the launcher is someway.

Like edacsac said a lot of what you want goes beyond the scope of php, or any other server side scripting language. One approach may be to create a small .net application that's installed on the usb stick. That becomes the first program your user should activate. This will start the server, php and mysql (and anything else you need running)

Once the services have started the interface (web page) will then be displayed. Regarding the content update. This will be tricky. I would try and make use of the Last-Modified server header, and compare it to the date of the file already used. If there is a newer version online download it.

If your site is entirely database driven then I would write a script to import the db it into the local database. Mysql replication might also be worth looking into.

Mack.

pixeldiver

1:14 am on Feb 8, 2010 (gmt 0)

10+ Year Member



Thanks for your thoughts Mack,
The server installed on my test stick has mysql and php support. When I plug it in, the windows launcher comes up and I have autorun.inf configured so that the application (server start up) is available.
This part works. Now I am up to look at the scripts to do the actual updating procedures.