FoxNet -- Easy WWW Way of FoxPro

Instruction
Installation
HtmlLib
Programming
Download
Register

I. Instruction 
FoxNet is a CGI programming tool. It enables FoxPro and Visual FoxPro programmers to design web database program by powerful FoxPro language directly. Do't worry about the complexities of network and CGI programming. All these things are done by FoxNet. It supplies a group of network functions, such as get a input from user's browser and return user's query result. You can use these functions to design a internet running FoxPro program easily and quickly.  The diagram below show how it works. 
. 

Below is a screenshot of FoxNet: 
 
 
 Return to main

II.Installation 
a). System Requirement 
     Windows95 or 98 or NT 
     Visual FoxPro 5.0 above 
     WWW Server ( Such as Website) 
       Caution: FoxNet can't work with www server of IIS.  

b).Unzip FoxNet 
     Bulid a new path on  you harddisk, such as c:\foxnet, then unzip foxnet.zip into it.  
     You can see these files and directory in it. 
     FoxCgi.exe -- CGI program, communicate between WWW server and FoxNet, 
     FoxNet.scx -- FoxPro connector, communicate between FoxCgi and FoxPro, 
     Regist.fxp   -- FoxNet register program, 
     Htmllib.fxp -- Homepage design Functions Library,  
     Help.htm    -- Help File and user's book of FoxNet, 
.   .Datas      -- Folder  to put FoxPro database files, 
.   .Prgs        -- Folder  to put FoxPro program files, 
.   .Txt          -- Folder  to put text files 

C).Install 
Copy FoxCgi.exe to the standard CGI directory of WWW server, usually cgi-shl, or CGI-BIN, then installation is finished. 

d).Running FoxNet 
    1. Start your WWW Server, 
    2. Do FoxNet.scx from FoxPro   
After these two step, FoxNet is running on your computer, and you can do a FoxPro 
program from Internet. 

e).Check 
To check whether you have installed FoxNet successfully.   
Try: http://your IP/cgi-shl/foxcgi.exe/hello.prg  in your browser: 
If return: Hi, Glad to see you !, that all is ok.  
If return: 404 Not Found !, this means you did not put foxcgi.exe in CGI directory. 
If return: 500 Error, or other, this means you put foxcgi.exe in a wrong directory. 
If return: FoxNet is not Running in Server, Report to Webmaster ! , this means  
you did not do FoxNet.prg from FoxPro, or your www server do not permit CGI program communicate with other windows programs in DDE manner.   
If return: FoxNet is not Running in Server, Report to Webmaster ! , this means  
you did not do FoxNet.prg from FoxPro or your www server do not permit DDE operation of CGI program. 
If return: FoxNet is not Running in Server, Report to Webmaster ! , this means  
you did not do FoxNet.prg from FoxPro or your www server do not permit DDE operation of CGI program. 
If return: No Program is selected, Or program unaccessable !, this means you did not put hello.prg in Prgs path. If you install FoxNet in c:\foxnet, all prg files, includes yours, must be in c:\foxnet\prgs. 
    You can try other sample programs to see how FoxNet is working. 

 
Return to main

III. HtmlLib  
Html is a language that is used to design homepages.  When you design a dynamic homepage by a program, you have to use it.  Programming by html is  complicate and boring, but it is necessary.  If you are not familiar with html language, you can use HtmlLib functions to instead.  If you are good at html, you will find that HtmlLib can be vary helpful.  Source codes of HtmlLib is supplied with this package,  you can change and modify it  freely, and I welcome anyone add new functions into it.  
htmlclientip 
htmlquery 
htmlparlen 
htmlin 
HtmlBegin
Htmlbcolor 
HtmlBkImage 
HtmlTitle 
HtmlEnd  
HtmlLine
HtmlReturn  
HtmlFontType 
Htmlhtmlfcolor 
HtmlFontSize 
Htmlalign
HtmlWords 
HtmlSentence 
HtmlParagraph 
HtmlLinkWords 
Htmllinksentence
HtmlGraph 
Htmllinkgraph 
HtmlInsertFile 
Htmlarraytable 
HtmlDbfTable
1.User IP address Global varible: htmlclientip  
Varible htmlclientip is a string, which store the IP address of  user who login in. 
Example: 
userip=htmlclientip 
2.User query input varible: htmlquery  
Varible htmlquery is a string, which store the query input of  user. A query is the part  
after "?" in a browser's location input.  
For example: http://202.114.6.48/cgi-shl/foxcgic.exe/queryin.prg?Hollo! 
Example: 
userquery=htmlquery 
3.User form input varibles: htmlparlen,htmlin(htmlparlen,2)  
Varible htmlquery is a string, which store the number of variables in a form. Varible  htmlinis a two dimension string array, which store varibles name and value of a form  input. A browser input form is like this: 
UserName 
. 
Email 
Problems 

Here: 
htmlparlen="3" 
htmin(1,1)="name"  (Not the value of lable, but the name of edit box),  
htmin(1,2)="Lingsong He" 
htmin(2,1)="email" 
htmin(2,2)="heliso@public.wuhan.cngb.com" 
htmin(3,1)="problem" 
htmin(2,2)="How to buy FoxNet" 
Example:  
len=VAL(htmlparlen) 
for i=1 to len 
   a(i,1)=htmin(i,1) 
   a(i,2)=htmin(i,2) 
endfor 
3.FUNCTION HtmlBegin( )  
Output a html file head to FoxNet. It must be called before any other Html functions.   
Example: 
=HtmlBegin() 
4.FUNCTION Htmlbcolor(color)  
Set background color of produced homepage. The color set are: White, Grey, Black, LightRed, Red, LightGreen, Green, LightBlue, Blue, LightYellow, Yellow, LightCayn, and Cayn. It should be called follow HtmlBegin().  
Example: 
=Htmlbcolor("Grey") 
5.FUNCTION HtmlBkImage(url)  
Set background image. It should be called follow HtmlBegin(). If this function is used, function htmlbcolor() is ignored. 
Example: 
=HtmlBkImage("http://202.114.6.48/pic/cloud.jpg") 
6.FUNCTION HtmlTitle(title)  
Set title of  the homepage. It must be called follow Htmlbcolor() or HtmlBkImage(). 
Example: 
=HtmlTitle("This page is generated by FoxNet") 
7.FUNCTION HtmlEnd()  
Output a html file end to FoxNet. It must be called at end of a program. 
Example: 
=HtmlEnd() 
8.FUNCTION HtmlLine()  
Insert a line in homepage. Like below: 

Example: 
=HtmlLine() 
9.FUNCTION HtmlReturn()  
Insert a carriage return in homepage. 
Example: 
=HtmlReturn() 
10.FUNCTION HtmlFontType(type)  
Set font type. Call before any htmlwrite functions. The font types are Normal, Bold, Italic, and Underline. 
Example: 
=HtmlFontType("Bold") 
11.FUNCTION Htmlhtmlfcolor(color)  
Set font type. Call before any htmlwrite functions. Color set is defined above 
12.FUNCTION HtmlFontSize(size)  
Set font size. Call before any htmlwrite functions. The font sizes are 8, 10, 12, 14, 18, 24, and 36. 
Example: 
=HtmlFontSize("24") 
13.FUNCTION Htmlalign(align)  
Set object align. Call before insert a object into homepage, such as a sentence or a image. They aligns are: 
Left 
Center
Right
Example: 
=Htmlalign("Center") 
14.FUNCTION HtmlWords(words)  
Write some words into a homepage. 
Example: 
=Htmlwords("Hollo") 
15.FUNCTION HtmlSentence(sentence)  
Write a line of sentence into a homepage. It is egual to HtmlWords()+HtmlReturn() 
Example: 
=HtmlSentence("How are you ?") 
16.FUNCTION HtmlParagraph(paragraph) 
Write a paragraph into a homepage. 
Example: 
paragraph=artilce.content      &&--(content is a memo field) 
=HtmlSentence(paragraph) 
17.FUNCTION HtmlLinkWords(words,url)  
Write a linked words into a homepage. Like this. 
Example: 
=HtmlLinkWords("Infoseek","http://www.infoseek.com") 
18.FUNCTION HtmlLinkSentence(sentence,url)  
Write a linked sentence into a homepage.  
Example: 
=HtmlLinkSentence("Press here to visit Infoseek","http://www.infoseek.com") 
19.FUNCTION HtmlGraph(Imageurl)  
Insert a image into a home page. Like this:  
Example: 
=HtmlGraph("http://202.114.6.48/pic/search.gif") 
20.FUNCTION HtmlLinkGraph(Imageurl,Linkurl)  
Insert a linked image into a home page.  
Example: 
=HtmlGraph("http://202.114.6.48/pic/search.gif","http://www.yahoo.com") 
21.FUNCTION HtmlInsertFile(filename)  
Insert text file into a homepage. For example, you can output a report of a database to a ascii file, then insert into a homepage. 
Example: 
=HtmlInsertFile("C:\MyDocument\readme.txt") 
22.FUNCTION HtmlArrayTable(array,row,colum)  
Insert a string arry into a homepage table. A homepage table is like this: 
Number Product  Price Amount
1
chair
10
100
2
desk
100
20
Example: 
Dimension s(3,4) 
s(1,1)="Number" 
s(1,2)="Product" 
s(1,3)="Price" 
s(1,4)="Amount" 
s(2,1)="1" 
s(2,2)="chair" 
s(2,3)="10" 
s(2,4)="100" 
s(3,1)="2" 
s(3,2)="desk" 
s(3,3)="100" 
s(3,4)="20" 
=HtmlArrayTable(s,3,4) 
23.FUNCTION HtmlDbfTable()  
Insert all records of current work area database  into a homepage table.  
Example: 
use  "c:\Mydbf\article.dbf" 
=HtmlDbfTable() 
use 
 
  Return to main


 
 IV.Programming with FoxNet  
A internet running program is usually composed of two parts. One is a form based homepage, which is running on user's browser and is used to get user's input. This homepage can be easily designed by FrontPage or by any other homepage design software. Below is a example, and its html source code. 
UserName 
. 
Email 
Problems 

Soure code: 
<HTML><HEAD> 
   <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1"> 
   <META NAME="Author" CONTENT="Lingsong He"> 
   <META NAME="GENERATOR" CONTENT=" [Netscape]"> 
<TITLE>aaa</TITLE> 
</HEAD><BODY>Form Based User Input Homepage<BR> 
<FORM METHOD=POST 
 ACTION="http://202.114.6.48/cgi-shl/foxcgi.exe/formin.prg"><B> 
UserName<INPUT NAME="name" VALUE="Lingsong He" TYPE =text SIZE=20></B> 
<BR> 
<B>Email<INPUT NAME="email" VALUE="heliso@public.wuhan.cngb.com" TYPE =text SIZE=30></B> 
<BR> 
<B>Problems<INPUT NAME="problen" VALUE="How to buy FoxNet" TYPE =text SIZE=20></B> 
<P><INPUT TYPE="submit" VALUE="Submit"><INPUT TYPE="reset" VALUE="Reset"> 
</FORM></BODY></HTML> 

Another is a CGI program, which is running on the host computer that user visit. FoxNet is a connector between CGI program and FoxPro. By the help of it, you can design CGI program by FoxPro. Below is a sample CGI program of FoxPro: 
&&-----Get remote user's input---------------------------------------------------------------------------- 
SET PROCEDURE TO htmlpath+"htmllib.fxp"   &&-- Load htmllib library 
userip=htmlclientip                                                 &&-- Get User's IP address  
number=htmlparlen                                                 &&-- Get Input parameters number 
parname1=htmlin(1,1)                                              &&-- Get Name of first input parameters  
parvalue1=htmlin(1,2)                                              &&-- Get value of first input parameters  
parname2=htmlin(2,1)                                              &&-- Get Name of first input parameters  
parvalue2=htmlin(2,2)                                             &&-- Get value of first input parameters  
...............                                                                     &&.......... 
&&-----Do database operation by user's input-------------------------------------------------------- 
............... 
............... 
&&-- Return a Operation result  to user------------------------------------------------------------- 
=HtmlBegin()                                                           &&-- Html File Header 
=Htmlhtmlbcolor("GREY")                                    &&-- Backgroundcolor of homepage  
=HtmlTitle("This is a Demo Page")                      &&-- Title of homepage 
=Htmlhtmlfcolor("LightRed")                                &&-- Set Font color  
=Htmlalign("Center")                                              &&-- Set object align 
=HtmlFontSize("24")                                               &&-- Set Font Size 
=HtmlSentence("Search Result of FoxNet")       &&-- Write a senterce in homepage 
=HtmlLine()                                                               &&-- Insert a separate line 
=Htmlalign("Left")                                                   &&-- Set object align 
=HtmlFontSize("12")                                               &&-- Set Font Size 
=Htmlhtmlfcolor("Black")                                       &&-- Set Font color  
=HtmlSentence("Your IP is: "+userip)                 &&-- Return user's input 
=HtmlSentence("Your Form  input is below:")  
FOR I=1 TO NUMBER 
=HtmlSentence(htmlin(i,1)+"="+htmlin(i,2))  
ENDFOR 
=HtmlLine()                                                      &&----Write some your program's execute result to user 
.................. 
.................. 
=HtmlLine() 
=Htmlalign("Center") 
=HtmlSentence(DTOC(DATE( ))) 
=HtmlEnd()                                                                  &&--- Finish 
return 
. 
From sample program above, we can see that a FoxPro CGI program is consisted of three  parts.  
1.Use global varibles htmlparlen and htmlin to get remote user's input,  
2.Do normal FoxPro operation by user's input,  
3.Return execute result to user by HtmlLib Function.  
Some FoxPro CGI samples are supplied with this package By read and run these sample program, you can learn FoxPro CGI programming easily and quickly. 
1.Hello.prg  
This is a basic FoxPro CGI program. 
2.Queryin.prg  
This program show how to get a user's query input. 
3.Formin.prg  
This program show how to get a user's form input. 
4.Libdemo.prg  
This program show how to use HtmlLib functions. 
5.Search Engine  
This program show how to design a search engine program by FoxNet. 

 
 Return to main

V.Download 
You can download FoxNet and try it freely. FoxNet is very small, but you will find it is very helpful. 
FoxNet111.zip ------------------- 85Kb,    1999.4.28
 
 Return to main


 
VI.Shareware Registration  
 If you want to remove the unregister message in the returned homepage, you can 
 register the software by paying to me US$20. This will encourage me to keep on developing new programs and enhancing the old ones. 
My email is: heliso@public.wuhan.cngb.com (Contact me)
 
 Return to main

 1998.11.28
 
 ==>> My home (Remote Diagnosi House)