FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Web interface
Posts: 933
Joined: Sun Oct 09, 2005 01:05 PM
Web interface
Posted: Tue Aug 11, 2009 10:23 PM

Hi,

I am working on a project that started out to be a program that would be on a clients network and run in a regular network environment. Now they would like the program to be web enabled.

Here is what I would like to do ... can someone please tell me if it is possible (maybe some sample code).

I would like to have my database on the webserver and be able to create a webpage where the end user can enter some data to search for. Let's say first and last name. Then, my FWH application can perform the search and display additional information if found. If not found, then give the option to add a new record etc...

The above is very basic, I am just trying to get data to flow between a webpage and my program.
I have no idea how this would even work as there could be many users at the same time. Would the webpage be able to run a program? Can I swap data between my app and a webpage? etc...

Any info would be appreciated :-)

Thanks,

Jeff Barnes



(FWH 16.11, xHarbour 1.2.3, Bcc730)
Posts: 1598
Joined: Fri Oct 07, 2005 05:56 PM
Re: Web interface
Posted: Wed Aug 12, 2009 03:29 AM
Dear Jeff,

I think TMySql Classes is the option I've choosed.
I used FWH to access local network and FWH to access database (MySql) on WebServer to Read/Write/Modify/Delete as usual in FWH.

This is my sample
Code (fw): Select all Collapse
  
   oServer:= TMySQLServer():New( cSetHost, cSetUser, cSetPass, cPort )

   if oServer:NetErr()
      MsgAlert (oServer:Error(),"MySQL Error")
      quit
   endif

   IF oServer:lError
      MsgAlert( "No connect" )
      RETURN nil
   ENDIF

   oserver:Selectdb(cDatabase)

   IF oServer:lError
      MsgAlert( "No used database" )
      RETURN nil
   ENDIF

   oServer:DeleteTable( 'rmty_avl' )
    oDlg:cMsg := "Delete Table  : rmty_avl Completed"
   oDlg:Refresh()
   SysRefresh()

    oServer:CreateTable( 'rmty_avl', aStruct)                       
    oDlg:cMsg := "Create Table  : rmty_avl Completed"
   oDlg:Refresh()
   SysRefresh()


    RTA->(DbGoTop())
   do while !RTA->(eof())

        if (n%20)=0
        oDlg:cMsg := "Record Update : "+ltrim(str(n))+"/"+cTlRec+" Completed"
        oDlg:Refresh()
        SysRefresh()
      end
    
       odb1:=oServer:Query("insert into rmty_avl (rta_date, rta_rmty, rta_ooo, rta_occ, rta_tlrm, rta_wait, rta_allt, rta_uncfm)"+;
                           "values ('"+dtoq(RTA->RTA_DATE)+"', '"+RTA->RTA_RMTY+"', '"+Strim(RTA->RTA_OOO,10,0)+"', '"+Strim(RTA->RTA_OCC,10,0)+ ;
                           "', '"+Strim(RTA->RTA_TLRM,10,0)+"', '"+Strim(RTA->RTA_WAIT,10,0)+"', '"+Strim(RTA->RTA_ALLT,10,0)+"', '"+Strim(RTA->RTA_UNCFM,10,0)+"' )" ) 
      RTA->(DbSkip())
      n++
      if empty(RTA->RTA_RMTY) .and. empty(RTA->RTA_DATE)
        exit
      end
    end

    CLOSEFILE('RTA')

//  cLastUpdate := ' '+dtoc(date())+' - '+time()
    oSay[1]:Refresh()   

//////////////////////
// Replace / Delete / Append samples

        do while odb1:rsv_status = ' ' .and. !odb1:eof()
    
        if !empty(odb1:rsv_last)  .and. !empty(odb1:rsv_rsvno) .and. ;
            !empty(odb1:rsv_arr)   .and. !empty(odb1:rsv_dep)    .and. ;
            !empty(odb1:rsv_rmty)  .and. !empty(odb1:rsv_numrm) .and. ;
            !empty(odb1:rsv_adult) .and. !empty(odb1:rsv_ratcod)
        
            if !empty(cStatus := ImportRsvn())
                odb1:delete()
                // odb1:rsv_status := cStatus
                // odb1:save()
                nRecCount++
                end
        end
   
        // odb1:skip()


I hope, it might help.

Regards,
Dutch
Regards,

Dutch



FWH 2304 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio

FWPPC 10.02 / Harbour for PPC (FTDN)

ADS V.9 / MySql / MariaDB

R&R 12 Infinity / Crystal Report XI R2

(Thailand)
Posts: 663
Joined: Mon Dec 05, 2005 11:22 PM
Re: Web interface
Posted: Wed Aug 12, 2009 04:45 AM

I have used xbscript for several web based applications. You need IIS as your web server but it is pretty easy to implement. You can use it on server side, client side, or both.

Posts: 933
Joined: Sun Oct 09, 2005 01:05 PM
Re: Web interface
Posted: Thu Aug 13, 2009 01:55 AM

Hi Gale,

Do you have a small sample of how I could use xbscript to open a database file and search / edit a record?
Does record locking still work with xbscript?

Thanks,

Jeff Barnes



(FWH 16.11, xHarbour 1.2.3, Bcc730)
Posts: 654
Joined: Fri Oct 21, 2005 05:54 AM
Re: Web interface
Posted: Thu Aug 13, 2009 01:59 AM

Hi Gale,

Even I am interested. Please post a working sample.

Regards,

  • Ramesh Babu P
Posts: 663
Joined: Mon Dec 05, 2005 11:22 PM
Re: Web interface
Posted: Thu Aug 13, 2009 01:43 PM
This is a very simple sample. I can give you more if you want, like a login routine.
This would be in a file called test.asp
Since this is being run on the server side the user interface would need to be browser compatible.
Code (fw): Select all Collapse
<%@ LANGUAGE = "XBScript" %>
<%
PROCEDURE Main()
  LOCAL cDataPath

  // Curent actual path on IIS server
  cDataPath := Request:ServerVariables["PATH_TRANSLATED"]:item()
  cDataPath := substr( cDataPath, 1, rat( "\", cDataPath ) )

  RddSetDefault('DBFCDX')
  Set(5, 1960 ) // Epoch
  use test index test share
  set order to 1
  seek 'TEST'
return
%>
Posts: 663
Joined: Mon Dec 05, 2005 11:22 PM
Re: Web interface
Posted: Thu Aug 13, 2009 05:41 PM
This is a self contained asp that you can put in any directory on web server. You have to make sure the web user has write access rights to directory.

This asp file will create dbf file in current directory, add 1 record, and put some test data in record.
Then prompt for information. There are a couple of techniques in this file you may be interested in. For one thing an .asp can call itself, so the first time through it will run the user interface. When the form posts it calls the same .asp but now the form data will be available so you can process the data without having a seperate program.
I use Microsoft Frontpage to edit the source and user interface.

http://www.wwrowland.com/downloadfiles/testuseredit.zip
Posts: 6983
Joined: Fri Oct 07, 2005 07:07 PM
Re: Web interface
Posted: Thu Aug 13, 2009 05:59 PM
Hello Gale,

thank you for the code.
Do you know a provider who is running XBScript on his servers.
Thanks in advance
Otto

Active Server Pages error 'ASP 0129'

Unknown scripting language

/manager/TestUserEdit.asp, line 1

The scripting language 'XBScript' is not found on the server.
Posts: 663
Joined: Mon Dec 05, 2005 11:22 PM
Re: Web interface
Posted: Thu Aug 13, 2009 08:21 PM
XBScript is free if you want to download it.
http://www.xharbour.com/xhc/index.asp?page=xhc_download_detail.asp&type=dl&id=62&show_i=7&show_sub=1
If you want to see an application in use, you can see one of my live applications. It is mostly a reporting tool but real users can enter "Bookings" and some other maintenance items. This application uses a combination of XBscript and some Java because of the menu interface and some tools I use.
The data resides on a server other than the web server and it is accessed using UNC address like \\servername\mydata. You can just as easily use ADO to access data.
If you run an inventory report notice that the results have hotspots to further drill down (Click on Inventory Report then click View button).

The Excel buttons will not work for the test user. This only works for our Customers and Employees.

http://www.wwrowland.com/cmate/Index.asp

Login Name: test
Password: gotest

Continue the discussion