网上调查程序(100分)

  • 主题发起人 苍蝇拍子
  • 开始时间

苍蝇拍子

Unregistered / Unconfirmed
GUEST, unregistred user!
哪位大侠知道新浪的网上调查的工作原理,居然是静态页面,能实时更新,神奇???
 
老兄,看清楚,到底是不是静态页面。
 
当然是啊,
按『查看』最后URL为
http://survey.sina.com.cn/internal/top/html/1667_r.html
按『提交』最后URL为
http://survey.sina.com.cn/internal/top/html/1667_r.html
但是其调用的是一个cgi-bin
action="http://survey.sina.com.cn/cgi-bin/internal/top/vote
所以闹不清楚,
谢谢
 
<tr><td>
<form method="POST" action="http://survey.sina.com.cn/cgi-bin/internal/top/vote" onSubmit="windowOpener('')" target="surveywin">
<a href=http://news.sina.com.cn/z/911anni/index.shtml target=_blank>“9-11”已过去一年</a>,但美国民众至今仍然生活在恐怖中,您认为美国近期是否还会遭到类似的恐怖袭击?[<a href="http://comment.sina.com.cn/cgi-bin/comment/comment.cgi?channel=gj&amp;newsid=662572&amp;face=face3&amp;style=1" target="_blank">发表评论</a>]<br>
<input type=radio name="answer" value="1">会</input><br><input type=radio name="answer" value="2">不会</input><br><input type=radio name="answer" value="3">说不清</input><br><input type=hidden name="id" value="1667">
<input type=hidden name="inv_type" value="1">
<input type=submit value="提交">
<input type="button" value="查看" onClick="windowOpener('http://survey.sina.com.cn/internal/top/html/1667_r.html')">
</form>
<form method="POST" action="http://survey.sina.com.cn/cgi-bin/internal/top/vote" onSubmit="windowOpener('')" target="surveywin">
这里就是提交到一个cgi程序,cgi程序自动生成了一个'http://survey.sina.com.cn/internal/top/html/1667_r.html'页面,明白了?
你也可以这样做的.
这里是自动生成了一个页面,如果你在unix下面,你的cgi程序甚至可以后缀名是.htm,或者你任何可以想到的名字,因为unix可以使用程序的权限来定义打开的方式的.
 
非常感谢,我以前分析是在cgi中生成一个html文件,但是做为并发访问,有可能
许多用户的访问都生成html,造成写冲突,所以我觉得很胡涂。若cgi的结尾是html,
我也想过,但是读写数据库能这么快吗?
 
老兄,什么叫写冲突啊?新名词............
每次点击提交按钮就生成一个新的html,把老的覆盖,几乎不可能同时点按钮吧?
如果两个人差不多点,那肯定有一个人先点,另外一个人只能等一下,等他的叶面生成了,
然后再生成第二个人所点击的叶面,。。。。。。。。。。。。。
 
两个线程同时写,会出现错误,apache是多用户的,系统写文件的时候,有进行互斥操作吗
 
老兄啊,谁告诉你是多用户的?谁告诉你是多线程的?有没有看见过聊天室生成页面的时候产生冲突?
这么看来我觉得你好像对cgi根本不了解,建议你还是看看cgi的书
 
cgi管理用户的接入肯定是多线程的或者多进程的,他的原理和在linux/unix中用守护
进程fork实现多进程的原理应该是一样,谢谢启明星
 
顶部