How to open a database on a web server from your local PC?

This forum is for eXpress++ general support.
Post Reply
Message
Author
User avatar
Eugene Lutsenko
Posts: 1649
Joined: Sat Feb 04, 2012 2:23 am
Location: Russia, Southern federal district, city of Krasnodar
Contact:

How to open a database on a web server from your local PC?

#1 Post by Eugene Lutsenko »

Hey, ALL!

How to open a database (DBF) on a web-server from a local computer to many users in the ISAM interface?

I'd like to give the users of the system Eidos (which I develop) the ability to place on a web server, your files and download them. It's raw data files to create applications in the system. Now these files are on the local computer on which the system is installed Eidos.

User avatar
Auge_Ohr
Posts: 1428
Joined: Wed Feb 24, 2010 3:44 pm

Re: How to open a database on a web server from your local P

#2 Post by Auge_Ohr »

hi,

you have to use a Server App running as Frontend on an Webserver to access DBF / SQL as Backend.
Server App must handle Query from Client e.g Browser and Answer must send back over Internet.

to write a Server App with Xbase++ you can try to use v2.x CXP ... or Xb2Net

also remember multiple User may access your Website so your Server App must be "Network-ready"
greetings by OHR
Jimmy

User avatar
Eugene Lutsenko
Posts: 1649
Joined: Sat Feb 04, 2012 2:23 am
Location: Russia, Southern federal district, city of Krasnodar
Contact:

Re: How to open a database on a web server from your local P

#3 Post by Eugene Lutsenko »

Is this it?

Code: Select all

//-----------------------------------------------------------------------------
// This function is the entry point into the TimeClock app
//
WEBPROC Login() PATH TC
   GETVAR UID AS cUID
   GETVAR PWD AS cPWD
   Local lUpdate  := .t.
   Local cMessage := ""
   Local oServer  := oClient:Parent  // this is the xbHTTPServer object
   Local nID

   oClient:CloseSession()

   debug( "TC_Login 1: SID", oClient:GetSessionHandle(), "# Sess", xbSession():ActiveSessions(), "CARGO", oClient:GetCargo())

   if Empty(cUID)
      // no user ID specified - redisplay login screen
      oClient:SendFile( oServer:RootDir + "\TC\Login.htm" )
      Return
   endif

   OpenDBF( "EMPLOYEE", "EMP", "EMPLOYEE")

   nID := Val(cUID)

   if !(DbSeek(nID, .f.) .and. Upper(Trim(emp->password)) == Upper(Trim(cPWD)))
      // invalid userid/password - go back to login screen
      dbCLoseAll()
      oClient:SendFile( oServer:RootDir + "\TC\Login.htm" )
      Return
   endif

   // we have a valid userid/password

   // make sure any previous session is properly closed
   oClient:CloseSession()

   // the GetCargo/SetCargo methods will automatically open a new session to keep track of this guy

   if oClient:GetCargo("UID") != NIL
      if oClient:GetCargo("UID") == nID
         // same guy, don't update login count in password table
         lUpdate := .f.
      else
         // this client was previously logged in under a different userid
         // close the old session
         oClient:CloseSession()
      endif
   endif

   oClient:SetCargo("UID"       , nID)
   oClient:SetCargo("NAME"      , AllTrim(emp->MName + " " + Trim(emp->FName) + " " + emp->LName))
   oClient:SetCargo("SECURITY"  , emp->security)  // save the security level
   oClient:SetCargo("EXCEPTIONS", emp->(GetExceptions()))

   if emp->DATE_IN == date()
      oClient:SetCargo("CLOCKIN" , emp->time_in)
   endif

   if emp->DATE_OUT == date() .and. emp->time_out >= emp->time_in
      oClient:SetCargo("CLOCKOUT", emp->time_out)
   endif

   // update the login count if user was not already logged in
   if lUpdate .and. dbRLock()
      emp->nLogins   := emp->nLogins + 1
      emp->LogInDate := date()
      emp->LogInTime := time()
   endif

   dbCLoseAll()

   debug( "TC_Login 2: SID", oClient:GetSessionHandle(), "# Sess", xbSession():ActiveSessions(), "CARGO", oClient:GetCargo())

   // attach the response string to the HTTP response object
   oClient:HTTPResponse:Content := DrawOuterFrame( oClient:GetSessionHandle() )

   Return
[/size]
// TIMECLOCK.PRG
//
// Sample TimeClock web application demonstrates the following:
// - use of session management without client-side cookies
// - how to handle web subdirectories
// - how to obfuscate function parameters from users
// - use of frames to create simple menu
// - generic function to generate DBF browse screens
// - how to post data from a browser
//
// Copyright (c) 2005-2009, Xb2.NET inc.
// All rights reserved.
//
// Author: Boris Borzic
// Email: support@xb2.net
// Web: http://www.xb2.net

User avatar
Eugene Lutsenko
Posts: 1649
Joined: Sat Feb 04, 2012 2:23 am
Location: Russia, Southern federal district, city of Krasnodar
Contact:

Re: How to open a database on a web server from your local P

#4 Post by Eugene Lutsenko »

Eugene Lutsenko <prof.lutsenko@gmail.com> 4 января 2017 г., 9:19
Кому: "Xb2.Net Support" <support@xb2.net>
Hey, Boris!

How to open a database (DBF) on a web-server from a local computer to many users in the ISAM interface?

I'd like to give the users of the system Eidos (which I develop) the ability to place on a web server, your files and download them. It's raw data files to create applications in the system. Now these files are on the local computer on which the system is installed Eidos.

PS With a map of the runs of Eidos in the world it worked for me:
http://j90540lw.beget.tech/map4.php

----------------------

Look at the time clock sample included with Xb2.NET

Regards,
Boris Borzic
http://www.xb2.net

----------------------

The database EMPLOYEE.dbf is on a web server?


if Empty(cUID)
// no user ID specified - redisplay login screen
oClient:SendFile( oServer:RootDir + "\TC\Login.htm" )
Return
endif

OpenDBF( "EMPLOYEE", "EMP", "EMPLOYEE")

----------------------

And somewhere you can see how the program works using these functions (TimeClock.prg)?

----------------------

run webserve.exe
open http://localhost

Regards,
Boris Borzic
http://www.xb2.net

----------------------

Thank you. Everything works. Now, to use these technologies, it remains to understand how this is done. Another question. What would happen if these databases simultaneously turn multiple users?

----------------------

Post Reply