Web interface

Web interface

Postby Jeff Barnes » 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)
User avatar
Jeff Barnes
 
Posts: 929
Joined: Sun Oct 09, 2005 1:05 pm
Location: Ontario, Canada

Re: Web interface

Postby dutch » Wed Aug 12, 2009 3: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: Select all  Expand view
 
   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 19.01 / 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)
User avatar
dutch
 
Posts: 1535
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

Re: Web interface

Postby Gale FORd » Wed Aug 12, 2009 4: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.
Gale FORd
 
Posts: 663
Joined: Mon Dec 05, 2005 11:22 pm
Location: Houston

Re: Web interface

Postby Jeff Barnes » Thu Aug 13, 2009 1: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)
User avatar
Jeff Barnes
 
Posts: 929
Joined: Sun Oct 09, 2005 1:05 pm
Location: Ontario, Canada

Re: Web interface

Postby RAMESHBABU » Thu Aug 13, 2009 1:59 am

Hi Gale,

Even I am interested. Please post a working sample.

Regards,

- Ramesh Babu P
User avatar
RAMESHBABU
 
Posts: 615
Joined: Fri Oct 21, 2005 5:54 am
Location: Secunderabad (T.S), India

Re: Web interface

Postby Gale FORd » Thu Aug 13, 2009 1: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: Select all  Expand view

<%@ 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
%>
Gale FORd
 
Posts: 663
Joined: Mon Dec 05, 2005 11:22 pm
Location: Houston

Re: Web interface

Postby Gale FORd » Thu Aug 13, 2009 5: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
Gale FORd
 
Posts: 663
Joined: Mon Dec 05, 2005 11:22 pm
Location: Houston

Re: Web interface

Postby Otto » Thu Aug 13, 2009 5: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.
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6068
Joined: Fri Oct 07, 2005 7:07 pm

Re: Web interface

Postby Gale FORd » Thu Aug 13, 2009 8: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
Gale FORd
 
Posts: 663
Joined: Mon Dec 05, 2005 11:22 pm
Location: Houston


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 46 guests