VB电子教程教你制作一个网上征求意见的WindowsCGI应用程序

大家用VB5.0也很长时间了吧,对于VB5.0给我们带来的好处也深有体会,在这里VB电子教程教你制作一个关于网上征求意见的WindowsCGI应用程序的一个小案例。

成都创新互联公司是专业的江阳网站建设公司,江阳接单;提供成都做网站、网站设计、外贸营销网站建设,网页设计,网站设计,建网站,PHP网站建设等专业做网站服务;采用PHP框架,可快速的进行江阳网站开发网页制作和功能扩展;专业做搜索引擎喜爱的网站,专业的做网站团队,希望更多企业前来合作!

VB电子教程教你制作一个网上征求意见的WindowsCGI应用程序

下面举一个较复杂实用的WindowsCGI程序,它由4个子过程组成:CGI_Main(),EnterGuest(),ReturnForm()和Inter_Main();它的功能是:服务器向申请连接的Web客户发出一张表单,Web客户在表单里填入有关数据后送回服务器,服务器收到Web客户的数据并将它们写入一个文件中存储起来,同时向Web客户发送一个收条。这个WindowsCGI应用程序的工作流程如下:一当Web客户要求CGI连接,服务器运行该CGI程序,首先执行CGI_Main()过程,CGI_Main()过程调用ReturnForm()向Web客户送出一个表单,如果Web客户填了意见表,并按键寄回服务器(此时过程CGI_Main()中CGI_RequestMethod="POST"成立)则由CGI_Main()过程调用EnterGuest()获取客户发来的数据并将其放入文件guestbk.csv中,同时向Web客户返回一个信息回条表示客户表单已收到。
由于编译使用这个CGI程序的做法与上面完全相同,故下面仅给源程序代码:

 
 
 
  1. OptionExplicit  
  2. ConstBOOK_FILE="guestbk.csv"'存放客户  
  3. 数据的文件,自动生成,可用Excel97调阅  
  4. DeclareSubSleepLib"kernel32"  
  5. (ByValdwMillisecondsAsLong)  
  6. SubCGI_Main()  
  7. IfCGI_RequestMethod="POST"Then 
  8. EnterGuest  
  9. Beep  
  10. Else  
  11. ReturnForm  
  12. EndIf  
  13. EndSub' 

一当Web客户要求CGI连接,服务器执行ReturnForm(),送出征求建议的表单:

 
 
 
  1. SubReturnForm()  
  2. Send"Content-type:text/html"  
  3. Send""  
  4. Send("</strong>贵州大学  </li> <li><strong> TITLE> HEAD></strong>")  </li> <li>Send("<strong><BODY><H2></strong>欢迎您访问贵州  </li> <li>大学计算机软件与理论研究所WWW站点<strong> H1></strong>")  </li> <li>Send("我们的e-mail是<strong><</strong>AHREF<strong>AHREF</strong>=""mailto:"  </li> <li>&CGI_ServerAdmin&_  </li> <li>"""<strong>></strong>lixiang@gzu.edu.cn:<strong> A></strong>")  </li> <li>Send("<strong><HR></strong>")  </li> <li>Send("请填下表,留下您的宝贵建议:")  </li> <li>Send("<strong><</strong>FORMACTION<strong>FORMACTION</strong>="""  </li> <li>&CGI_ExecutablePath&"""METHOD=""POST""<strong>></strong>")  </li> <li>Send("<strong><PRE></strong>您的姓名:  </li> <li><strong><</strong>INPUTSIZE<strong>INPUTSIZE</strong>=25NAME=""name""<strong>></strong>")  </li> <li>Send("E-mail地址:  </li> <li><strong><</strong>INPUTSIZE<strong>INPUTSIZE</strong>=25NAME=""email""<strong>></strong>")  </li> <li>Send("您给我们的建议:<strong><</strong>TEXTAREACOLS<strong>TEXTAREACOLS</strong>=40 </li> <li>ROWS=4WRAP=VIRTUALNAME=""comments""<strong>></strong>")  </li> <li>Send("<strong> TEXTAREA> PRE></strong>")  </li> <li>Send("请击此处将您的建议送我们:  </li> <li><strong><</strong>INPUTTYPE<strong>INPUTTYPE</strong>=""submit""")  </li> <li>Send("VALUE=""发送您的建议""<strong>></strong>")  </li> <li>Send("<strong><HR></strong>")  </li> <li>Send("<strong> FORM> BODY> HTML></strong>")  </li> <li>EndSub  </li> <li>'获取客户建议表单数据,将所填数据存入文件guestbk.csv并向客户返回一个信息  </li> <li>SubEnterGuest()  </li> <li>DimiLockTriesAsInteger  </li> <li>DimsDateAsString  </li> <li>DimsNameAsString  </li> <li>DimsEmailAsString  </li> <li>DimsCommentsAsString  </li> <li>'DimsBrowserAsString  </li> <li>DimsFirstNameAsString  </li> <li>DimfnAsInteger  </li> <li>'提取建议的有关数据:  </li> <li>sName=GetSmallField("name")  </li> <li>sEmail=GetSmallField("email")  </li> <li>sComments=GetSmallField("comments")  </li> <li>iLockTries=0 </li> <li>fn=FreeFile </li> <li>OnErrorGoTogLockFail  </li> <li>gRetryLock:  </li> <li>OpenApp.Path+"\"+BOOK_FILEFor  </li> <li>AppendLockReadWriteAs#fn  </li> <li>OnErrorGoTo0  </li> <li>sDate=Now </li> <li>Write#fn,sDate,sName,sEmail,  </li> <li>sComments,CGI_RemoteAddr  </li> <li>Close#fn  </li> <li>sFirstName=Trim$(Left$(sName,  </li> <li>InStr(sName,"")))  </li> <li>IfsFirstName<strong><></strong>""  </li> <li>ThensFirstName=sFirstName&","  </li> <li>Send("Content-type:text/html")  </li> <li>Send("")  </li> <li>Send("<strong><HTML><HEAD><TITLE></strong>谢谢您!  </li> <li><strong> TITLE> HEAD></strong>")  </li> <li>Send("您的签名与建议是:<strong><PRE></strong>")  </li> <li>Send("日期:"&sDate)  </li> <li>Send("姓名:"&sName)  </li> <li>Send("E-Mail:"&sEmail)  </li> <li>Send("Hostaddress:  </li> <li>["&CGI_RemoteAddr&"]")  </li> <li>Send("建议:<strong> PRE></strong>")  </li> <li>Send(sComments)  </li> <li>Send("<strong><H2></strong>谢谢您!<strong> H2></strong>")  </li> <li>Send("<strong> BODY> HTML></strong>")  </li> <li>ExitSub  </li> <li>gLockFail:  </li> <li>Sleep(1000)  </li> <li>iLockTriesiLockTries=iLockTries+1  </li> <li>ResumegRetryLock  </li> <li>EndSub  </li> <li>SubInter_Main()  </li> <li>MsgBox"这是CGI程序,  </li> <li>需要在Web服务器中运行。",16,"CGI.BAS"  </li> <li>EndSub </li> </ol></pre><p>VB电子教程教你的案例,学会了吗!</p> <p> 标题名称:<a href="http://www.csdahua.cn/qtweb/news22/142672.html">VB电子教程教你制作一个网上征求意见的WindowsCGI应用程序</a> <br> 转载源于:<a href="http://www.csdahua.cn/qtweb/news22/142672.html">http://www.csdahua.cn/qtweb/news22/142672.html</a> </p> <p> 网站建设、网络推广公司-快上网,是专注品牌与效果的网站制作,网络营销seo公司;服务项目有等 </p> <p class="adpic"> <a href="https://www.cdcxhl.com/service/ad.html" target="_blank" class="ad">广告</a> <a href="" target="_blank" class="adimg"><img src=""></a> </p> <p class="copy"> 声明:本网站发布的内容(图片、视频和文字)以用户投稿、用户转载内容为主,如果涉及侵权请尽快告知,我们将会在第一时间删除。文章观点不代表本网站立场,如需处理请联系客服。电话:028-86922220;邮箱:631063699@qq.com。内容未经允许不得转载,或转载时需注明来源: <a href="http://www.csdahua.cn/" target="_blank">快上网</a> </p> </div> <div class="newsmorelb"> <p>成都快上网为您推荐相关内容</p> <ul> <li> <a href="/qtweb/news21/142671.html">宋宝华在Linux上分享的技巧与经验视频 (宋宝华视频 linux)</a> </li><li> <a href="/qtweb/news20/142670.html">手游APP选择韩国服务器有什么优势</a> </li><li> <a href="/qtweb/news19/142669.html">修复高网络使用错误的方法是修复svchost.exe(netsvcs)</a> </li><li> <a href="/qtweb/news18/142668.html">怎样防止租用服务器数据丢失问题</a> </li><li> <a href="/qtweb/news17/142667.html">如何处理数据库中的distinct空值问题?(数据库distinct空值)</a> </li><li> <a href="/qtweb/news16/142666.html">代理是怎么赚钱的?(47代理免费账号教程)</a> </li><li> <a href="/qtweb/news15/142665.html">怎么打开ai文件</a> </li><li> <a href="/qtweb/news14/142664.html">Linux系统救援:恢复损坏文件(linux系统文件损坏)</a> </li><li> <a href="/qtweb/news13/142663.html">jquery怎么获取焦点</a> </li> </ul> </div> </div> <div class="col-lg-3 noneb"> <div class="bkright" style="margin-top: 0"> <p><a href="https://www.cdcxhl.com/news/ued/">用户体验知识</a></p> <ul> <li> <a class="text_overflow" href="/qtweb/news42/90092.html">三大角度PK,Go语言和Node.js谁胜谁负?</a> </li><li> <a class="text_overflow" href="/qtweb/news40/245440.html">集群效应意义?(集群服务器搭建有哪些好处)</a> </li><li> <a class="text_overflow" href="/qtweb/news25/256725.html">Linux下Vi编辑器快速清空文件(linuxvi清空)</a> </li><li> <a class="text_overflow" href="/qtweb/news15/435915.html">抖音自媒体怎么做,新手做自媒体怎么开始运营</a> </li><li> <a class="text_overflow" href="/qtweb/news2/193302.html">夸克怎么下载到本地-夸克下载到本地的方法</a> </li><li> <a class="text_overflow" href="/qtweb/news11/104211.html">国外服务器租用价格一般多少钱?(国内租用境外服务器要多少钱)</a> </li><li> <a class="text_overflow" href="/qtweb/news11/353061.html">d3doverrider报错</a> </li><li> <a class="text_overflow" href="/qtweb/news17/176567.html">双网卡:数据库的支持与应用(数据库是否支撑双网卡)</a> </li><li> <a class="text_overflow" href="/qtweb/news31/224381.html">美国空间主机租用有哪些优点和缺点</a> </li><li> <a class="text_overflow" href="/qtweb/news3/251053.html">结合Oracle快速关联查询之路</a> </li><li> <a class="text_overflow" href="/qtweb/news9/25609.html">服务器购买指南:从选购到使用的全流程解析</a> </li><li> <a class="text_overflow" href="/qtweb/news49/224549.html">如何看是否html5</a> </li><li> <a class="text_overflow" href="/qtweb/news37/208787.html">创新互联apache教程:ApacheHTTPServer2.0新特性概述</a> </li><li> <a class="text_overflow" href="/qtweb/news26/542426.html">简析认证加授权如何使API更安全</a> </li><li> <a class="text_overflow" href="/qtweb/news19/140619.html">解决Linux黑屏安装难题(安装linux黑屏)</a> </li> </ul> </div> <div class="bkright tag"> <p><a href="https://www.cdcxhl.com/hangye/" target="_blank">分类信息网</a></p> <ul> <li class="col-lg-6 col-md-6 col-sm-6 col-xs-6"> <a href="https://www.cdcxhl.com/hangye/bolixiufu/" target="_blank">汽车玻璃修复</a> </li><li class="col-lg-6 col-md-6 col-sm-6 col-xs-6"> <a href="https://www.cdcxhl.com/hangye/jiudiansj/" target="_blank">酒店设计</a> </li><li class="col-lg-6 col-md-6 col-sm-6 col-xs-6"> <a href="https://www.cdcxhl.com/hangye/chayisj/" target="_blank">茶艺设计</a> </li><li class="col-lg-6 col-md-6 col-sm-6 col-xs-6"> <a href="https://www.cdcxhl.com/hangye/ggtg/" target="_blank">广告推广</a> </li><li class="col-lg-6 col-md-6 col-sm-6 col-xs-6"> <a href="https://www.cdcxhl.com/hangye/loutihulan/" target="_blank">楼梯护栏</a> </li><li class="col-lg-6 col-md-6 col-sm-6 col-xs-6"> <a href="https://www.cdcxhl.com/hangye/jianzhudonghua/" target="_blank">建筑动画</a> </li><li class="col-lg-6 col-md-6 col-sm-6 col-xs-6"> <a href="https://www.cdcxhl.com/hangye/qzgqb/" target="_blank">轻质隔墙板</a> </li><li class="col-lg-6 col-md-6 col-sm-6 col-xs-6"> <a href="https://www.cdcxhl.com/hangye/hntjbj/" target="_blank">混凝土搅拌机</a> </li><li class="col-lg-6 col-md-6 col-sm-6 col-xs-6"> <a href="https://www.cdcxhl.com/hangye/vr/" target="_blank">VR全景</a> </li><li class="col-lg-6 col-md-6 col-sm-6 col-xs-6"> <a href="https://www.cdcxhl.com/hangye/zkj/" target="_blank">公路钻孔机</a> </li><li class="col-lg-6 col-md-6 col-sm-6 col-xs-6"> <a href="https://www.cdcxhl.com/hangye/fwjd/" target="_blank">房屋鉴定</a> </li><li class="col-lg-6 col-md-6 col-sm-6 col-xs-6"> <a href="https://www.cdcxhl.com/hangye/ddcl/" target="_blank">电动窗帘</a> </li><li class="col-lg-6 col-md-6 col-sm-6 col-xs-6"> <a href="https://www.cdcxhl.com/hangye/zhixiang/" target="_blank">纸箱</a> </li><li class="col-lg-6 col-md-6 col-sm-6 col-xs-6"> <a href="https://www.cdcxhl.com/hangye/tongdiaosu/" target="_blank">铜雕雕塑</a> </li><li class="col-lg-6 col-md-6 col-sm-6 col-xs-6"> <a href="https://www.cdcxhl.com/hangye/kafeitingsj/" target="_blank">咖啡厅设计</a> </li><li class="col-lg-6 col-md-6 col-sm-6 col-xs-6"> <a href="https://www.cdcxhl.com/hangye/dibang/" target="_blank">地磅秤</a> </li> </ul> </div> </div> </div> <div class="carousel-inner linkbg" style="background: #fff"> <div class="container"> <a href="http://www.dmvi.cn/" target="_blank">成都广告公司</a>    <a href="http://www.cxhlcq.com/mobile/" target="_blank">重庆移动网站建设</a>    <a href="http://chengdu.cdcxhl.cn/wechat/" target="_blank">成都微信开发</a>    <a href="http://www.zejunkj.cn/" target="_blank">泽君科技</a>    <a href="http://www.gdruijie.cn/" target="_blank">南充网站制作</a>    <a href="http://www.xhgfhy.com/ " target="_blank">郫县门窗定制</a>    <a href="http://www.kratc.com/" target="_blank">工程造价</a>    <a href="http://www.hbxxgc.cn/" target="_blank">乐山中领科信</a>    <a href="http://www.szsmxy.cn/" target="_blank">成都圣月服饰</a>    <a href="https://www.cdcxhl.com/sosuo.html" target="_blank">网站搜索引擎优化</a>    <a href="http://seo.cdkjz.cn/tuiguang/" target="_blank">成都网站推广</a>    <a href="http://www.ytwzsj.com/" target="_blank">帝美豪门窗</a>    <a href="http://www.gtmaxf.cn/" target="_blank">消防工程</a>    <a href="http://www.cdkjz.cn/wangzhan/" target="_blank">网络推广公司</a>    <a href="http://www.cdymzj.com/" target="_blank">域名注册</a>    <a href="https://www.cdcxhl.com/ssl/chengdu.html" target="_blank">成都ssl证书申请</a>    <a href="https://www.cdcxhl.com/mianfei/jianzhan/chengdu.html" target="_blank">成都免费自助建站</a>    <a href="http://www.lsbanjia.cn/" target="_blank">崇州搬家公司</a>    <a href="http://www.pcwzsj.com/" target="_blank">平昌做网站</a>    <a href="https://www.cdxwcx.com/city/guanghan/" target="_blank">广汉做网站</a>     </div> </div> <footer> <div class="carousel-inner footjz"> <div class="container"> <i class="icon iconfont zbw"></i> 高品质定制 <i class="icon iconfont"></i> 跨终端自动兼容 <i class="icon iconfont"></i> 节约开发成本 <i class="icon iconfont"></i> 开发周期短 <i class="icon iconfont"></i> 一体化服务 <button type="button" class="btn btn-default btn-lg" onClick="window.location.href='tencent://message/?uin=631063699&Site=&Menu=yes'"> 立即开始2800定制网站建设</button> <button type="button" class="btn btn-default btn-xs" onClick="window.location.href='tencent://message/?uin=631063699&Site=&Menu=yes'"> 2800定制网站建设</button> </div> </div> <div class="carousel-inner bqsy"> <div class="container"> <div class="lxfs"> <h4 class="yutelnone">028-86922220 13518219792</h4> <h4 class="yutelblock"><a href="tel:02886922220">028-86922220</a> <a href="tel:13518219792">13518219792</a></h4> <a class="btn btn-default" href="tencent://message/?uin=532337155&Site=&Menu=yes" role="button">网站建设<span>QQ</span>:532337155</a> <a class="btn btn-default" href="tencent://message/?uin=631063699&Site=&Menu=yes" role="button">营销推广<span>QQ</span>:631063699</a> <a class="btn btn1 btn-default" href="mqqwpa://im/chat?chat_type=wpa&uin=532337155&version=1&src_type=web&web_src=oicqzone.com" role="button">网站制作<span>QQ</span>:532337155</a> <a class="btn btn1 btn-default" href="mqqwpa://im/chat?chat_type=wpa&uin=631063699&version=1&src_type=web&web_src=oicqzone.com" role="button">营销推广<span>QQ</span>:631063699</a> <a class="btn btn-default nonea" href="tencent://message/?uin=1683211881&Site=&Menu=yes" role="button">售后QQ:1683211881</a> <div class="dz">成都快上网专注: <a href="http://www.csdahua.cn/" target="_blank">网站优化</a> <a href="http://www.csdahua.cn/" target="_blank">网络推广</a> <a href="http://www.csdahua.cn/" target="_blank">网站建设</a> <address>地址:成都太升南路288号锦天国际A幢10楼</address> </div> </div> <div class="bzdh dz"><img src="https://www.cdcxhl.com/imges/bottom_logo.png" alt="创新互联"> <p><a href="https://www.cdcxhl.com/menu.html" target="_blank">成都创新互联科技有限公司</a><br> Tel:028-86922220(7x24h)</p></div> </div> </div> </footer> </body> </html> <script> $.getJSON ("../../qtwebpic.txt", function (data) { var jsonContent = { "featured":data } var random = jsonContent.featured[Math.floor(Math.random() * jsonContent.featured.length)]; $(".adpic .adimg").attr("href",random.link) $(".adpic img").attr("src",random.pic); }) </script>