亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? ch07_04.htm

?? 用perl編寫CGI的好書。本書從解釋CGI和底層HTTP協議如何工作開始
?? HTM
?? 第 1 頁 / 共 2 頁
字號:
these two companies create the majority of browsers on the web, thereare other high-quality browsers that also support JavaScript andbookmarklets, such as Opera, and these browsers are growing inpopularity. If you start supporting specific browsers, you may findyourself needing to choose which browsers to support and which usersyou are willing to loose. Hopefully, ECMAScript and DOM will quicklyprovide standards across all browsers.</p></div></div><a name="ch07-53404" /><div class="sect2"><h3 class="sect2">7.4.2. Bookmarklets and CGI</h3><p>So what do bookmarklets provide us as <a name="INDEX-1647" /> <a name="INDEX-1,648" /> <a name="INDEX-1,649" />CGI developers?Bookmarklets can do anything that JavaScript can do includingdisplaying dialog boxes, creating new browser windows, and generatingnew HTTP requests. Furthermore, because they execute in the contextof the browser's frontmost window, they can interact withobjects or information in this window without the securityrestrictions that an HTML window from your site would encounter.Thus, bookmarklets provide a very different or even transparentinterface to our CGI scripts.</p><p>Let's look at an example. Say that you want to be able tocreate and store comments for web pages as you surf that you canretrieve when you visit the web pages later. We can do this with asimple bookmarklet and CGI script. First, let's create the CGIscript.</p><p>Our CGI script needs to do two things. It needs to accept a URL and a<a name="INDEX-1650" />commentand record them. It also needs to be able to retrieve a comment whengiven a particular URL. <a href="ch07_04.htm#ch07-76654">Example 7-6</a> provides thecode.</p><a name="ch07-76654" /><div class="example"><h4 class="objtitle">Example 7-6. comments.cgi </h4><a name="INDEX-1651" /><blockquote><pre class="code">#!/usr/bin/perl -wTuse strict;use CGI;use DB_File;use Fcntl qw( :DEFAULT :flock );my $DBM_FILE = "/usr/local/apache/data/bookmarklets/comments.dbm";my $q       = new CGI;my $url     = $q-&gt;param( "url" );my $comment;if ( defined $q-&gt;param( "save" ) ) {    $comment = $q-&gt;param( "comment" ) || "";    save_comment( $url, $comment );}else {    $comment = get_comment( $url );}print $q-&gt;header( "text/html" ),      $q-&gt;start_html( -title =&gt; $url, -bgcolor =&gt; "white" ),      $q-&gt;start_form( { action =&gt; "/cgi/bookmarklets/comments.cgi" } ),      $q-&gt;hidden( "url" ),      $q-&gt;textarea( -name =&gt; "comment", -cols =&gt; 20, -rows =&gt; 8, -value =&gt; $comment ),      $q-&gt;div( { -align =&gt; "right" },          $q-&gt;submit( -name =&gt; "save", -value =&gt; "Save Comment" )      ),      $q-&gt;end_form,      $q-&gt;end_html;sub get_comment {    my( $url ) = @_;    my %dbm;    local *DB;        my $db = tie %dbm, "DB_File", $DBM_FILE, O_RDONLY | O_CREAT or        die "Unable to read from $DBM_FILE: $!";    my $fd = $db-&gt;fd;    open DB, "+&lt;&amp;=$fd" or die "Cannot dup DB_File file descriptor: $!\n";    flock DB, LOCK_SH;    my $comment = $dbm{$url};    undef $db;    untie %dbm;    close DB;    return $comment;}sub save_comment {    my( $url, $comment ) = @_;    my %dbm;    local *DB;        my $db = tie %dbm, "DB_File", $DBM_FILE, O_RDWR | O_CREAT or        die "Unable to write to $DBM_FILE: $!";    my $fd = $db-&gt;fd;    open DB, "+&lt;&amp;=$fd" or die "Cannot dup DB_File file descriptor: $!\n";    flock DB, LOCK_EX;    $dbm{$url} = $comment;    undef $db;    untie %dbm;    close DB;}</pre></blockquote></div><p>We use a disk-based hash called a DBM file in order to store commentsand URLs. The <em class="emphasis">tie</em><a name="INDEX-1652" /> function associates a Perl hash withthe file; then anytime we read from or write to the hash, Perlautomatically performs the corresponding action on the associatedfile. We will <a name="INDEX-1653" />cover how to use DBM files in moredetail in <a href="ch10_01.htm">Chapter 10, "Data Persistence"</a>.</p><p>The<a name="INDEX-1654" />JavaScript that we will use tocall this CGI script is as follows:</p><blockquote><pre class="code">url = document.location.href;open( "http://localhost/cgi/bookmarklets/comments.cgi?url=" + escape( url ),      url, "width=300,height=300,toolbar=no,menubar=no" );void( 0 );</pre></blockquote><p>As a <a name="INDEX-1655" />bookmarklet, it looks like this:</p><blockquote><pre class="code">javascript:dOc_uRl=document.location.href;open('http://localhost/cgi/bookmarkletscomments.cgi?url='+escape(dOc_uRl),dOc_uRl,'width=300,height=300,toolbar=no,menubar=no');void( 0 )</pre></blockquote><p>If you save this bookmarklet, visit a web site, and select thebookmarklet from your bookmarks, your browser should display anotherwindow. Enter a comment and save it. Then browse other pages and dothe same if you wish. If you return to the first page and select thebookmarklet again, you should see your original comment for thatpage, as in <a href="ch07_04.htm#ch07-79956">Figure 7-5</a>. Note that the commentswindow will not update itself each time you travel to another page.You will need to select the bookmarklet each time you want to read orsave comment for a page you are on.</p><a name="ch07-79956" /><div class="figure"><img width="253" src="figs/cgi2.0705.gif" height="132" alt="Figure 7-5" /></div><h4 class="objtitle">Figure 7-5. Updating a comment to comment.cgi via a bookmarklet</h4><p>If you were to distribute this bookmarklet to friends, the commentswould be shared and you could see what each other has to say aboutvarious web sites. The CGI script could also be placed in a securedirectory and be extended to maintain separate databases for eachuser; you may want users to only be able to read other users'comments.</p><p>We would not have been able to build an application like this with astandard HTML page due to JavaScript's<a name="INDEX-1656" />securityrestrictions. One HTML page cannot access objects in another HTMLpage if the two pages are from different domains (i.e., different webservers), so our comment form cannot determine the URL of any otherbrowser windows. However, bookmarklets circumvent this restriction.Browsers allow this because the user must actively choose to run abookmarklet in order for it to execute.</p><p>There are numerous other ways that you can put bookmarklets to use.You can see many examples of <a name="INDEX-1657" /><a name="INDEX-1658" />bookmarklets that use existingInternet resources at <a href="http://www.bookmarklets.com">http://www.bookmarklets.com</a>. Many of theseare novelties, but bookmarklets can do more. Bookmarklets are mostpowerful when you have goods or services that can take advantage ofaccessing information on other sites as people surf. For example,companies such as the Better Business Bureau could offer bookmarkletsthat users can select when they are on another site to see how thatsite has been rated. Companies that sell add-on products or serviceslike warranties can provide users with a bookmarklet that users canselect when they are going to make <a name="INDEX-1659" />a purchase online. <a name="INDEX-1,660" /> <a name="INDEX-1,661" /> <a name="INDEX-1,662" />Other possibilitiesare <a name="INDEX-1663" /><a name="INDEX-1664" />up to youto <a name="INDEX-1665" />create.</p></div><hr align="left" width="515" /><div class="navbar"><table border="0" width="515"><tr><td width="172" valign="top" align="left"><a href="ch07_03.htm"><img src="../gifs/txtpreva.gif" alt="Previous" border="0" /></a></td><td width="171" valign="top" align="center"><a href="index.htm"><img src="../gifs/txthome.gif" alt="Home" border="0" /></a></td><td width="172" valign="top" align="right"><a href="ch08_01.htm"><img src="../gifs/txtnexta.gif" alt="Next" border="0" /></a></td></tr><tr><td width="172" valign="top" align="left">7.3. Data Exchange</td><td width="171" valign="top" align="center"><a href="index/index.htm"><img src="../gifs/index.gif" alt="Book Index" border="0" /></a></td><td width="172" valign="top" align="right">8. Security</td></tr></table></div><hr align="left" width="515" /><img src="../gifs/navbar.gif" alt="Library Navigation Links" usemap="#library-map" border="0" /><p><font size="-1"><a href="copyrght.htm">Copyright &copy; 2001</a> O'Reilly &amp; Associates. All rights reserved.</font></p><map name="library-map"><area href="../index.htm" coords="1,1,83,102" shape="rect" /><area href="../lnut/index.htm" coords="81,0,152,95" shape="rect" /><area href="../run/index.htm" coords="172,2,252,105" shape="rect" /><area href="../apache/index.htm" coords="238,2,334,95" shape="rect" /><area href="../sql/index.htm" coords="336,0,412,104" shape="rect" /><area href="../dbi/index.htm" coords="415,0,507,101" shape="rect" /><area href="../cgi/index.htm" coords="511,0,601,99" shape="rect" /></map></body></html>

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
一区二区三区欧美日| 久久99精品国产麻豆婷婷洗澡| 亚洲午夜激情av| 国产做a爰片久久毛片| 色网综合在线观看| 久久久综合九色合综国产精品| 亚洲精品成人天堂一二三| 国产精品69久久久久水密桃| 欧美巨大另类极品videosbest | 久久久噜噜噜久久人人看 | 91成人国产精品| 国产三级久久久| 日韩成人一级大片| 在线观看国产91| 中文字幕一区二区视频| 国产精品亚洲午夜一区二区三区| 欧美日韩第一区日日骚| 亚洲欧美日韩在线| 波波电影院一区二区三区| 精品国产1区2区3区| 日韩av电影一区| 欧美日韩一区精品| 依依成人综合视频| 99热99精品| 国产日韩精品视频一区| 精品一区二区免费在线观看| 欧美一级日韩一级| 青青国产91久久久久久| 欧美肥大bbwbbw高潮| 午夜免费久久看| 777a∨成人精品桃花网| 亚洲福利一区二区| 欧美日韩午夜精品| 日韩高清在线观看| 日韩精品一区二| 国产成人免费视| 国产精品免费aⅴ片在线观看| 国产成人精品免费视频网站| 欧美极品aⅴ影院| 国产夫妻精品视频| 中文字幕在线观看一区二区| 99久久久精品| 亚洲一区免费观看| 91精品国产91久久久久久最新毛片 | 97成人超碰视| 亚洲午夜精品网| 日韩一区二区在线免费观看| 国模套图日韩精品一区二区 | 粉嫩aⅴ一区二区三区四区 | 欧美日韩卡一卡二| 日韩美一区二区三区| 国产精品69毛片高清亚洲| 中文久久乱码一区二区| 欧美性大战久久| 日本欧美在线观看| 国产精品天天摸av网| 91免费看片在线观看| 亚洲不卡av一区二区三区| 欧美电影精品一区二区| 成人av在线一区二区| 日韩 欧美一区二区三区| 欧美精品一区二区三区在线| 99精品桃花视频在线观看| 婷婷综合五月天| 国产亚洲一区二区在线观看| 91在线观看免费视频| 日本不卡一区二区三区| 国产精品拍天天在线| 欧美久久久久久久久| 亚洲欧美偷拍三级| 久久综合九色综合久久久精品综合| 国产二区国产一区在线观看| 亚洲电影第三页| 欧美激情资源网| 欧美另类z0zxhd电影| 国产99一区视频免费 | 国产清纯在线一区二区www| 91久久精品国产91性色tv| 激情成人午夜视频| 亚洲国产一区视频| 亚洲欧美自拍偷拍| 精品国产自在久精品国产| 在线观看日韩电影| 国产91富婆露脸刺激对白| 亚洲第一综合色| 亚洲手机成人高清视频| 精品国产乱码久久久久久浪潮| 99久久免费国产| 国产精品原创巨作av| 首页欧美精品中文字幕| 最新日韩av在线| 久久精品亚洲麻豆av一区二区| 在线电影院国产精品| thepron国产精品| 国产精品亚洲а∨天堂免在线| 日本一区中文字幕| 亚洲va欧美va人人爽午夜 | 国产精品天美传媒| 久久综合九色欧美综合狠狠| 777奇米成人网| 5月丁香婷婷综合| 欧美视频一区二区三区在线观看| 成人黄动漫网站免费app| 国产成人夜色高潮福利影视| 久久精品国产精品亚洲综合| 亚洲成人av电影| 日韩精品电影在线| 五月天丁香久久| 亚洲成av人片一区二区| 亚洲二区在线观看| 一区二区三区欧美| 亚洲激情一二三区| 亚洲精品久久久蜜桃| 亚洲精品ww久久久久久p站| 亚洲欧美色图小说| 亚洲一区日韩精品中文字幕| 亚洲成人av中文| 日本不卡的三区四区五区| 亚洲色欲色欲www在线观看| 国产精品久久久久久久蜜臀| 中文字幕在线不卡视频| 成人免费视频在线观看| 亚洲欧美激情视频在线观看一区二区三区 | 欧美日韩国产精品自在自线| 欧美美女激情18p| 欧美日韩午夜在线视频| 欧美一卡二卡在线观看| 精品国产123| 国产精品妹子av| 亚洲一区国产视频| 视频一区在线播放| 六月丁香婷婷久久| 国产精品69久久久久水密桃 | 国产呦萝稀缺另类资源| 国产一区欧美日韩| 成人av网站在线| 欧美三级日韩三级| 日韩丝袜情趣美女图片| 欧美国产日韩a欧美在线观看| 国产精品国产三级国产aⅴ原创| 国产精品乱码人人做人人爱| 日本麻豆一区二区三区视频| 国产中文字幕一区| 99国产精品久久久| 91精品一区二区三区久久久久久| 久久网这里都是精品| 亚洲曰韩产成在线| 国产在线精品国自产拍免费| zzijzzij亚洲日本少妇熟睡| 欧美亚洲禁片免费| 久久久精品欧美丰满| 亚洲精品免费在线观看| 久久成人免费电影| 色欧美片视频在线观看| 一区二区三区不卡在线观看| 麻豆久久久久久久| 99精品热视频| 欧美va在线播放| 亚洲国产日韩综合久久精品| 国产精品综合av一区二区国产馆| 不卡视频一二三| 欧美电视剧免费全集观看| 日韩毛片视频在线看| 精品一区二区三区香蕉蜜桃 | 日韩在线观看一区二区| 成人免费va视频| 欧美大片日本大片免费观看| 亚洲三级小视频| 成人免费视频视频| 欧美成人a∨高清免费观看| 亚洲国产精品久久久久婷婷884 | 国产一区二区久久| 欧美日韩日本视频| 国产精品美女久久久久久久网站| 日韩av电影天堂| 欧美色偷偷大香| 亚洲私人影院在线观看| 国产成a人亚洲精| 欧美精品一区二区三区高清aⅴ| 亚洲国产精品久久久男人的天堂 | 日韩欧美中文字幕一区| 亚洲亚洲精品在线观看| 色婷婷综合在线| 亚洲婷婷综合色高清在线| 成人性生交大片免费看中文网站| 日韩亚洲电影在线| 青草国产精品久久久久久| 欧美精品在线一区二区| 亚洲国产aⅴ天堂久久| 91久久精品一区二区| 一区二区三区蜜桃| 色综合久久88色综合天天免费| 欧美国产综合一区二区| 国产一区二区福利视频| 国产无一区二区| 国产成人av一区二区三区在线 | 精品日韩在线一区| 国内精品久久久久影院一蜜桃| 欧美videos大乳护士334| 精彩视频一区二区|