⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 readme.txt

📁 加入一个用VB编写CGI的VB源程序。(你需要在Win98上首先安装20Personal WebServer
💻 TXT
字号:
VB 制作的 CGI 例子
包括:
  显示服务端情况
  记数器
  电子钟
  文件上传
  定单服务等。。。

---------------------------------------------------------
以下由 dqj(mailto:dqj@cx.gov.cn) 提供:
----------------------------------------------------------
8-9 测试情况 By dqj 

试用环境:

操作系统:Pwin97
WEB 服务器: Front Page 98带的个人WEB 服务器
浏览器:网景的3.01 Gold
VB编译器:中文企业版 5.0 和 英文专业版 4.0

试用情况:
工程Sample.vbp ---
不能返含有中文的内容。(这个问题我已解决,
通过BYTE型的数组代替了字符串变量,并修改了urlDecode子程序.

工程CGI4TIME ---
不能返回图形表示的时间.

工程CGI4CNTR ---
不能返回图形表示的计数器.

我的思路:
原程序在发送图形前, 把图形的16进制字符串变成BYTE的算法好象不对, 
我修改了一下, 使得转换后的Byte型表示的图形放到 BYTE 型数组或字符串变量中, 
我把转换后的变量写到文件中完全正确, 
得到的 GIF 文件可以用ACD SEE正常显示,
可一旦用它的 SENDB 例程发送到WEB 服务器时,图形不能显示。

7修改后的程序段如下(在cgi4vb.bas中):

Public Function UrlDecode(ByVal sEncoded As String) As String
'========================================================
' Accept url-encoded string
' Return decoded string
'========================================================

Dim pos        As Long      ' position of InStr target
Dim sDecoded() As Byte       '****存放解码后的字符串
Dim sLen As Long             '****解码后的字符串长度(ASC内码字节数)
If sEncoded = "" Then Exit Function

ReDim sDecoded(1 To Len(sEncoded))    '***** 为解码后最大可能的长度

' convert "+" to space
pos = 0
Do
   pos = InStr(pos + 1, sEncoded, "+")
   If pos = 0 Then Exit Do
   Mid$(sEncoded, pos, 1) = " "
Loop

' convert "%xx" to character
pos = 0

On Error GoTo errorUrlDecode
'*****************
sLen = 0
For pos = 1 To Len(sEncoded)
    sLen = sLen + 1
    If Mid$(sEncoded, pos, 1) = "%" Then
        sDecoded(sLen) = CInt("&H" & Mid$(sEncoded, pos + 1, 2))
        pos = pos + 2
    Else
        sDecoded(sLen) = Asc(Mid(sEncoded, pos, 1))
    End If
Next pos
'*****************

On Error GoTo 0     'reset error handling
UrlDecode = StrConv(sDecoded, vbUnicode)       '******

'UrlDecode = sEncoded
Exit Function

-------------------------------------------------------------------------------
  
-------------------
CGI4VB version 1.5
-------------------
 * CGI interface for VB4 (32-bit) or above.
 * Will work with any standard 32-bit web server
 * Does not require a winHttpd-compliant server. 
 * Uses STDIN and STDOUT to communicate between server and cgi program.
 * Does not use temp files.
  
To test CGI4VB:

1. Load the project file "sample/sample.vbp" into VB4 (32-bit) or VB5
2. Create CGI4VB.EXE, and put it in your server's CGI-BIN directory
3. Test by using CGI4VB.HTM

To create your own CGI programs, replace SAMPLE.BAS with your own routine.
-------------------------------------------------------------------------
			PROBLEMS?

If you have problems, please 
	read the enclosed "Problems.txt"
	make an effort to solve it yourself
        read the comments in the source code

If all else fails, feel free to contact me, but include:
        a description of the problem and any error messages
	version of CGI4VB that you're using
	http server and version
	browser and version
	steps you've already taken to try to resolve the problem
 
-------------------------------------------------------------------------

directories in the zip file include:
------------------------------------

CGI4VB   - the engine, debugger, other modules
SAMPLE   - sample program  - try this first
CGI4env  - env variables   - displays the server's environment variables
CGI4cntr - page counter    - execute from an <IMG> tag  
CGI4time - digital clock   - execute from an <IMG> tag    
Imagemap - redirection     - server-side imagemap using the Location: header
CGI4upld - file upload     - multipart headers (for newer browsers)
OrderDB  - database access - query and update a database
HTML     - HTML pages for above programs
ICONS    - Gif files
MAPS     - map files for imagemap
---------------------
Notes on version 1.5
---------------------
Changed reading of Stdin to allow for servers with a limited input buffer.
Added a Database sample
Made code compatible with VB5.

---------------------
Notes on version 1.4
---------------------
Minor code changes to cgi4vb.bas
Added cgiDEBUG - degugging module: instructions are in cgi4vb/cgidebug.bas
Added VBP files for the demo programs
Added functions/capabilities to cgi4rtn.bas
Added Words.bas  - more Rexx-inspired text handling functions
Added ShellW.bas - function to shell out and wait for a program to finish
Added imagemap   - use this if your server doesn't supply an imagemap pgm.
Removed cgi4red  - the imagemap program show how to use redirection

---------------------
Notes on version 1.3
---------------------
Query strings can be used in addition to posted data, instead of either/or. 
Posted data is checked for content-type before attempting to decode it.
Added all standard environment variables per CGI/1.1 specs
Passing sEncoded to urlDecode ByVal to preserve encoded data
Created separate function for storing name/value pairs
tPairs() is handled a little differently to allow adding to it dynamically

What header to use depends on what server you're running
"Status: 200 OK"   - works with most
"HTTP/1.0 200 OK"  - works with some
none               - works with some

---------------------
Notes on version 1.2
---------------------
Added SendHeader() and SendFooter() subs to simplify coding.  
Form names are being decoded.
sFormData is now a public variable, and can be accessed from any module.
Decoding is done in a separate function: urlDecode().

Replaced the "HTTP/1.0 200 OK" header with "Status: 200 OK"
The former does not work with certain servers.
The latter should work with all servers.

--------------------
Kevin O'Brien  September 30, 1997
<obrienk@pobox.com>
<obrienk@ix.netcom.com>

http://www.pobox.com/~obrienk   <=== check here for latest version of CGI4VB
http://www.netcom.com/~obrienk  <=== or here 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -