Page 1 of 1

HMG And The Web (Part III)...

Posted: Sun May 27, 2012 3:58 am
by Roberto Lopez
And now... The Real Thing:

Lets imagine this scenario:

We have a HMG application using DBF files.

This application is being used across the office LAN by various users.

The problem is that you need that the data, and (at least) part of the application be available via Internet in non-Windows clients running standard web browsers.

You must be able to query and modify the dbf tables via Internet web clients, concurrently with office LAN users.

The good news is that the remote web clients, only need basic queries and data entry functionality.

Of course, our time is very limited :)

After various days of research and tests my first winner was the following:

In the harbour examples folder there is an interesting application called 'httpsrv'.

This is an http server capable of execute .hrb modules at client browser requests.

To make it work you must compile the server and the modules.

If you put attention on the 'testajax.prg' and 'testajax.html' files you'll notice how simple the things are.

Looking at the module you'll see that putting something in a web page is so easy as returning the required string in a module like this:

Code: Select all

#include "common.ch"

MEMVAR _REQUEST

FUNCTION HRBMAIN()
   LOCAL cW
   LOCAL cHtml := ""

   IF HB_HHasKey( _REQUEST, "w" )
      IF !Empty( cW := _REQUEST[ "w" ] )
         cHtml += "This is a reply from testajax : " + cW
      ENDIF
   ENDIF

RETURN cHtml

Where cW is the received parameter that is returned to the client unmodified on this example.

To make the development faster on this environment, you should create generic modules for record append, modify, delete and query.

PROS: You can share your current dbf files with web clients (you shouldn't touch your existing app).

CONS: You must take care of the security, creating a session in such way to not require to the user to send his user name and password for each module execution.

Re: HMG And The Web (Part III)...

Posted: Sun May 27, 2012 10:55 am
by esgici
Hello Roberto

Everything become clear when you explain :D

Fortunately, you are here :D

Hearty thanks and best regards :D

Saludos cordiales :D

--

Esgici