for Visual FoxPro
The following examples all generate output dynamically using Visual FoxPro and
Web Connection. If you're testing these examples on your own Web server make sure that
the CGITEST.PRG sample program is running in a Visual FoxPro session before selecting
any options on this form!
Simple CGI Request
The following link shows what kind of information is returned to your code from a
Web Server CGI request. Using the wwCGI object you can find out about server and browser
info as well as form variables defined on an HTML form.
Simple CGI Test
Data Query Example
The following example form allows you to query a time and billing database by selecting a client name and date range. To see a list of clients and pick one from the list click on the Client Name header button.
Multi-Select Data Query Example
Here's the same example using a multi-select list box. Note for demo purposes this list is
hardcoded with names (see above Client list example for creating dynamic list boxes)...
Data Input and Interactive HTML Forms
The Guest Book application demonstrates
use of interactive HTML forms containing embedded Visual FoxPro Expressions. This form
can take input from the user and save and update the values in a table. The main page
uses an HTML template page stored on disk. The page contains the table fields and
several expressions to display all data without having to generate the HTML in code.
Embedded HTML Example
The following example uses no Code on the Visual FoxPro end, but instead embeds
Visual FoxPro code directly into the HTML page.
E-Mail Sample
The following example shows off Web Connection's ability to send SMTP email using
the CGIServer's SendMail method. Enter your e-mail address below and Web Connection
will reply by sending you a form email message...
Rotating Banner
This link displays a different image link everytime a page is refreshed. The wwBanner
class that comes with Web Connection makes this job extremely easy. For fun,
add your own image reference and
a link and add it on the rotation list for this sample..."
Show rotating image page
HTTP Cookie Test
The following link assigns an HTTP Cookie with a lifetime of the Browser session. Cookies are
great for keeping track of users when transactions spans multiple pages or forms. This example
simply creates a Cookie and displays the value. If cookies are supported by your Browser the
value should stay the same on each refresh, unless you stop and restart your browser.
Cookie Test
Authentication
This link pops up an authorization dialog and forces you to log in. If the correct passwords
are used you're allowed to see the page. If you visit this page again, you will not be asked
for a password again, since the Authentication information is passed back by the Web server
for each request once validated.
Authentication Test
Maintainence Tasks
- Show CGI Hit Log
Displays Web Connection's Internal CGI Hit counter that shows individual requests and how long they take. Use this option
to determine server performance and to analyze server load and traffic. If performance drops drastically here for individual
requests it's a good idea to reboot the server. A typical Homepage hit should take between 0.05 - 0.25 seconds for the
shortest and longest hits. If it gets consistently slower than this the NT server is having problems.
- Clear CGI Hit Log
The CGI Log should be cleared on a daily basis - this file can get big with about 40-50,000 entries daily.
- Suspend Multiple Sessions
This option disables multiple sessions and leaves only one session running until the Resume Multiple sessions link is clicked.
- Resume Multiple Sessions
Re-enables any suspended sessions. Please run the CGILog after this operation to make sure that all suspended sessions
are running again.
Session Maintainence
The following functions allow you to start and stop Web Connection sessions, but require at
least one session to be already running. In order for this to work properly you have to set
#DEFINE VFPPATH "D:\VFP\VFP.EXE -t CGIMAIN.PRG" at the top of wwMaint.prg to match your VFP
path and main program file name to start up a new session.
- Show Active Sessions
Display all sessions that are currently running. Note if a session is improperly stopped this list may be inaccurate.
You can clear the list with Clear Session Log File and then use
the Recycle Web Connection option a few times to force servers
to log themselves again.
- Start New Session
Allows adding a new session. New session is started from within an existing session.
- Kill a Session
Kills a session. All but the last session can be killed, but there's no control over which of the sessions is killed
- Recycle Web Connection
Clears the Web Connection server by unloading and immediately restarting itself from within the Visual FoxPro environment.
This routine should be used if the CGI requests start slowing down significantly.
- Clear Session Log File
This option clears the session log display in case an error corrupted the counter in the log. After doing this link the session
log is empty. In order to repopulate it with accurate server counts run the Recycle option several times.
- Show Server Status