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.kswsj.com/qtweb/news22/142672.html">VB电子教程教你制作一个网上征求意见的WindowsCGI应用程序</a> <br> 网页网址:<a href="http://www.kswsj.com/qtweb/news22/142672.html">http://www.kswsj.com/qtweb/news22/142672.html</a> </p> <p> 网站建设、网络推广公司-成都快上网,一家网站设计、网站制作公司;服务项目有等 </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.kswsj.com/" 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/host/">虚拟主机知识</a></p> <ul> <li> <a class="text_overflow" href="/qtweb/news24/79974.html">mfc撤销功能怎么实现</a> </li><li> <a class="text_overflow" href="/qtweb/news49/218799.html">便宜的centos服务器?(便宜的国内服务器)</a> </li><li> <a class="text_overflow" href="/qtweb/news37/99037.html">网络安全无小事:那些意想不到的黑客攻击方式</a> </li><li> <a class="text_overflow" href="/qtweb/news39/461039.html">procreatewindows?()</a> </li><li> <a class="text_overflow" href="/qtweb/news1/215751.html">Linuxgrep基础入门</a> </li><li> <a class="text_overflow" href="/qtweb/news47/433747.html">绑定帐号是什么意思?</a> </li><li> <a class="text_overflow" href="/qtweb/news19/13719.html">织梦图集注释,织梦如何添加图集</a> </li><li> <a class="text_overflow" href="/qtweb/news24/485374.html">玩出C&C服务器地址隐身的新花样,看看这个恶意软件怎么做的</a> </li><li> <a class="text_overflow" href="/qtweb/news9/350109.html">「 不懂就问 」Esbuild 为什么这么快?</a> </li><li> <a class="text_overflow" href="/qtweb/news6/439606.html">乌克兰服务器租用快吗?乌克兰服务器租用有哪家IDC商提供?</a> </li><li> <a class="text_overflow" href="/qtweb/news37/113637.html">西班牙服务器快吗,西班牙速度不错吗?</a> </li><li> <a class="text_overflow" href="/qtweb/news5/429055.html">安全性高的vps怎么租用</a> </li><li> <a class="text_overflow" href="/qtweb/news18/126418.html">护卫神和英洛华哪个好?(护卫神怎么样)</a> </li><li> <a class="text_overflow" href="/qtweb/news6/138956.html">oracle性能优化之sql语句优化</a> </li><li> <a class="text_overflow" href="/qtweb/news17/104667.html">Windows下SVN备份中两大功能详解</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/hntjbg/" 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/hntjbc/" 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/snjbc/" 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/gsdb/" 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/swzbw/" 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/zdfhw/" 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/putaojia/" 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/chalousj/" 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/hldzj/" 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/hwxxy/" 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/shilongwang/" 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/weilanhulan/" 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/yhjdsj/" 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/zsljbc/" target="_blank">自上料搅拌车</a> </li> </ul> </div> </div> </div> <div class="carousel-inner linkbg" style="background: #fff"> <div class="container"> <a href="http://www.hzxinyuan.com/" target="_blank">营山产后修复</a>    <a href="http://www.zzjierui.cn/" target="_blank">广安网站建设</a>    <a href="https://www.cdxwcx.com/wangzhan/h5.html" target="_blank">h5页面制作</a>    <a href="http://www.scjiangyou.cn/" target="_blank">江油网站建设</a>    <a href="http://www.hdybtv.com/" target="_blank">造型师设计</a>    <a href="https://www.cdcxhl.com/wangzhandingzhi.html" target="_blank">成都企业网站定制</a>    <a href="https://www.cdxwcx.com/wangzhan/gaiban.html" target="_blank">成都网站改版</a>    <a href="http://chengdu.cdcxhl.cn/dingzhi/ " target="_blank">定制网站设计</a>    <a href="http://mc.scmwjz.com/" target="_blank">不锈钢防护栏</a>    <a href="http://www.cdxwcx.cn/tuoguan/yaan.html" target="_blank">四川雅安服务器托管</a>    <a href="http://www.cxhlcq.cn/" target="_blank">创新互联重庆</a>    <a href="http://seo.cdkjz.cn/" target="_blank">网络推广平台</a>    <a href="http://www.kswsj.cn/tuiguang/" target="_blank">网站推广营销</a>    <a href="https://www.cdxwcx.com/city/dazhou/" target="_blank">达州做网站</a>    <a href="http://www.qlmbz.com/" target="_blank">木包装箱</a>    <a href="http://www.cdkjz.cn/fangan/xuexiao/" target="_blank">校园网站建设方案</a>    <a href="http://chengdu.cdweb.net/weixinkaifa/" target="_blank">微信小程序公众号开发</a>    <a href="http://www.ghjhjc.com.cn/" target="_blank">广汉锦华</a>    <a href="http://www.ncjike.com/" target="_blank">营山产后护理服务</a>    <a href="https://www.cdcxhl.cn/" 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> 600元建站 <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'"> 立即开始600元网站建设</button> <button type="button" class="btn btn-default btn-xs" onClick="window.location.href='tencent://message/?uin=631063699&Site=&Menu=yes'"> 600元企业网站建设</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.kswsj.com/" target="_blank">成都网站制作</a> <a href="http://www.kswsj.com/" target="_blank">网站设计</a> <a href="http://www.kswsj.com/" 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>