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

📄 ch13.htm

📁 Web_Programming_with_Perl5,一个不错的Perl语言教程。
💻 HTM
📖 第 1 页 / 共 4 页
字号:


VALUE=UPSG [checked mv_shipmode UPSG]> UPS Ground



<INPUT TYPE=RADIO NAME=mv_shipmode



VALUE=UPSB [checked mv_shipmode UPSB]> UPS Blue



<INPUT TYPE=RADIO NAME=mv_shipmode



VALUE=UPSR [checked mv_shipmode UPSR]> UPS Red



<P>



<CENTER>



<input type="hidden" name="mv_doit" value="refresh">



<input type="hidden" name="mv_order_report" value="report">



<input type="submit" name="mv_todo" value="Submit Order">



<input type="submit" name="mv_todo" value="Refresh">



<input type="submit" name="mv_todo" value="Cancel">



</CENTER>



<H2>Shipping and Billing Information</H2>



<PRE>



* Name            <input type="text" name="name" 



                   value="[value name]" size=40>



  Company Name    <input type="text" name="company" 



                   value="[value company]" size=40>



  Email Address   <input type="text" name="email" 



                   value="[value email]" size=40>



* Billing address <input type="text" name="address" 



                   value="[value address]" size=40>



* City            <input type="text" name="city" 



                   value="[value city]" size=20>



* State/Province  <input type="text" name="state" 



                   value="[value state]" size=10>



* Zip/Postal Code <input type="text" name="zip" 



                   value="[value zip]" size=10>



* Country         <input type="text" name="country" 



                   value="[value country]" size=20>



  Daytime Phone   <input type="text" name="phone_day" 



                   value="[value phone_day]" size=16>



  Evening Phone   <input type="text" name="phone_night" 



                   value="[value phone_night]" size=16>



</PRE>



<P>



<B>*</B> <I>



These fields are required for us to be able to place your order



</I>



<P>



<HR>



<CENTER>



<H2> Shipping Address</H2>



<I>(if different than the billing address)</I>



</CENTER>



<PRE>



  Address          <input type="text" name="s_address" 



                    value="[value s_address]" size=40>



  City             <input type="text" name="s_city" 



                    value="[value s_city]" size=20>



  State/Province   <input type="text" name="s_state" 



                    value="[value s_state]" size=10>



  Zip/Postal Code  <input type="text" name="s_zip" 



                    value="[value s_zip]" size=10>



  Country          <input type="text" name="s_country" 



                    value="[value s_country]" size=20><p>



</PRE>



<P>



<CENTER>



<input type="submit" name="mv_todo" value="Submit Order" checked>



<input type="submit" name="mv_todo" value="Refresh Page">



<input type="submit" name="mv_todo" value="Cancel">



</CENTER>



</FORM>



<P>



</BODY></HTML>



</FONT></PRE>



<P>As you can see, this page contains the most information of all the MiniVend pages.



The page starts with a list of items that are being ordered. This list is specified



using the <TT>[item-list]</TT>, which is similar to the <TT>[search-list]</TT> tag



you saw earlier. The difference is that this list contains those items the customer



has placed in his or her shopping cart rather than a list obtained from searching



the database. The semantics of how this tag works are the same. Within the <TT>[item-list]</TT>,



you again see the <TT>[item-code],</TT> <TT>[item-description]</TT>, and <TT>[item-price]</TT>



tags. One new tag contained within this list is <TT>[item-quantity]</TT>, which is



a user-specified value. To cancel the order of an item, the user must enter a zero



in this field as the informational text describes.</P>



<P>You might be curious about the <TT>[row]</TT> and<TT> [col]</TT> tags. They are



general formatting tags provided by MiniVend for displaying a table look within a



preformatted text <TT>&lt;PRE&gt;</TT> section of your HTML. The value specified



in the <TT>[row]</TT> tag tells the number of total columns in the row. Each column



can then be given a certain size and alignment. For more detailed information, refer



to the MiniVend documentation.</P>



<P>Of more importance are the <TT>[subtotal]</TT>, <TT>[salestax]</TT>, <TT>[shipping]</TT>,



and <TT>[total-cost]</TT> tags. These tags demonstrate the power and simplicity of



MiniVend. A large part of the MiniVend package deals with the dynamic creation of



HTML based on your product database; the other, perhaps even more useful, part deals



with maintaining the running subtotals, tax, and shipping costs. The subtotal is



a fairly easy one to figure out by simply adding up the item prices while taking



quantity into account. The tax is figured using a special database file called salestax.asc.



Tax percentage is looked up using the state or optionally the zip code. A default



percentage, which is normally 0, also is supplied. You can even designate certain



items to be tax exempt by specifying a <TT>NonTaxableField</TT> in your minivend.cfg



file and setting that field value to <TT>true</TT> for the tax-exempt item.</P>



<P>Shipping can be determined based on a field designated with the <TT>CustomShipping</TT>



variable in the minivend.cfg file. In this example, you use the <TT>weight</TT> field.



This field value is then used in conjunction with the shipping cost database, which



is another ASCII database file with the following fields:







<UL>



	<LI>code: A unique identifier for the shipping method.



	<P>



	<LI>description: Description of the shipping method, accessed using the [shipping_description]



	tag



	<P>



	<LI>criteria: The criteria for shipping charge (for example, weight, quantity, or



	country). This field is for information only; it is not used by MiniVend for any



	calculations.



	<P>



	<LI>minimum: The low bound of quantity or weight to which this entry applies.



	<P>



	<LI>maximum: The high bound of quantity or weight to which this entry applies.



	<P>



	<LI>cost: The total shipping cost (specified as a formula if it begins with &quot;f&quot;



	or as a multiplier if it begins with &quot;x&quot;).



</UL>







<P>The customer chooses the shipping method by using the radio buttons listed in



this example under Shipping Via. You can specify a default shipping by using the



<TT>DefaultShipping</TT> variable in the minivend.cfg file. The <TT>[total-cost]</TT>



is then calculated by adding up all these values. Figure 13.6 shows the section of



the form containing a list of items that have been ordered. <BR>



<BR>



<A HREF="14wpp06.jpg" tppabs="http://210.32.137.15/ebook/Web%20Programming%20with%20Perl%205/14wpp06.jpg"><TT><B>Figure 13.6.</B></TT></A> The ordered items



part of the order form. <BR>



<BR>



The remaining HTML in this example is simply the order form for gathering information



from the customer. The only MiniVend tag used within this text is the <TT>[value]</TT>



tag, which was described previously. This form is contained within a preformatted



text <TT>&lt;PRE&gt;</TT> section for better alignment. Figure 13.7 shows this form



as it appears in your Web browser. Again, you can include as many fields as you find



necessary. MiniVend imposes no restrictions on the kind of data you can request from



your customers. <TT><BR>



<BR>



</TT><A HREF="14wpp07.jpg" tppabs="http://210.32.137.15/ebook/Web%20Programming%20with%20Perl%205/14wpp07.jpg"><TT><B>Figure 13.7.</B></TT></A> The customer



information part of the order form.



<H4 ALIGN="CENTER"><A NAME="Heading22"></A><FONT COLOR="#000077">Other Pages to Complete



Your Site</FONT></H4>



<P>To complete your MiniVend site, you should create a few other pages. To display



the order confirmation to the user, you can use confirmation.html. Nothing about



this page is complicated. You may want to use <TT>[page]</TT> link tags to allow



the customer to navigate back into your store to buy more. Another useful page is



notfound.html. This page is shown when <TT>vlink</TT> is unable to locate a certain



page. This page is useful as a catch-all so that customers aren't subjected to any



nasty default error pages. Another page you may want to create is flypage.html. This



page enables you to display a complete description of a particular item. A page is



constructed on the fly using information in your product database.</P>



<P>You also should create a few pages such as badsearch.html and nomatch.html to



catch certain conditions. badsearch.html handles cases in which invalid search data



is passed into the search engine. nomatch.html handles conditions in which no items



are found with the given search criteria. You might also want to create special pages.



For example, you might be having a close-out sale. You can then link to these pages



by using the <TT>[page]</TT> tag.



<H4 ALIGN="CENTER"><A NAME="Heading23"></A><FONT COLOR="#000077">Frames</FONT></H4>



<P>Using MiniVend, you also can use frames for your shopping site. Some special minivend.cfg



variables such as <TT>FrameOrderPage</TT> and <TT>FrameSearchPage</TT> enable you



to specify special pages for use with frames. Frames are given names for specifying



the <TT>TARGET</TT> value of an <TT>&lt;A HREF&gt;</TT> tag. There are also the special



frame names _<TT>top</TT>, _<TT>blank</TT>, <TT>_parent</TT>, and <TT>_self</TT>.



To tell MiniVend that frames are in use, you should use the <TT>[frames_on]</TT>



tag in the first page that the customer accesses to enter the store. The <TT>[framebase]</TT>



tag sets the base target for a page.</P>



<P>Some demo pages that enable the use of frames are contained within the MiniVend



package. If you're interested in this feature, I encourage you to take a look at



the sample shopping site.



<H4 ALIGN="CENTER"><A NAME="Heading24"></A><FONT COLOR="#000077">Additional Tools



for Administration of Your Site</FONT></H4>



<P>Also included with MiniVend are a few tools for the administration of your shopping



cart site, which you learned about earlier. In the following sections, I describe



two of the tools that might make your life easier as the caretaker of your online



store. <B><TT>vendpage</TT></B> One of the administrative tools available for you



to use is the <TT>vendpage</TT> program. This tool takes existing HTML files and



converts them to MiniVend pages, redefining links in the format used by MiniVend.



It follows a few simple rules:







<OL>



	<LI>Any link that starts at the root or with a protocol specification is left as



	is.



	<P>



	<LI>All relative links are changed relative to the PageDir directory specified in



	the configuration file.



	<P>



	<LI>Links to names in the same document remain unchanged.



	<P>



	<LI>Image specifications that are relative are changed such that they must be placed



	in the images directory relative to the HTTP servers DocumentRoot.



	<P>



	<LI>Comments that begin and end with <TT>[vend]</TT> and <TT>[/vend]</TT> are stripped



	and passed on as vend tags.



</OL>







<P>For more information on this tool, refer to the <TT>vendpage</TT> documentation,



which is contained in the MiniVend package. <B><TT>mat</TT></B> Another useful tool



is the <TT>mat</TT> program, as shown in Figure 13.8. It enables you to modify the



current configuration remotely through a standard Web interface. With this tool,



a user from any platform (that has a Web browser available) can start the MiniVend



server, view error logs, and even modify the configuration settings. You will obviously



want to put this tool into a protected CGI executable directory so that ordinary



users cannot modify your store. Refer to Chapter 3 for more information on how to



create a protected directory. <TT><BR>



<BR>



</TT><A HREF="14wpp08.jpg" tppabs="http://210.32.137.15/ebook/Web%20Programming%20with%20Perl%205/14wpp08.jpg"><TT><B>Figure 13.8.</B></TT></A> The <TT>mat</TT>



remote administration tool from within the browser.



<H3 ALIGN="CENTER"><A NAME="Heading25"></A><FONT COLOR="#000077">A Few Words About



Security</FONT></H3>



<P>Security is a great concern to your customers when they are asked to transmit



their credit card numbers across an insecure protocol to an unknown target. You can



deal with this concern in several ways. The first addresses the issue of the insecure



protocol. HTTP by definition is an insecure protocol; however, Netscape has introduced



the Secure Sockets Layer, which allows data to be encrypted before it is sent over



the wire. If you have a commerce server that supports this protocol, you can inform



MiniVend by using the <TT>SecureURL</TT> variable in the minivend.cfg file.</P>



<P>Another issue with credit card numbers is that form information is generally stored



to disk unbeknownst to the user. MiniVend adds additional security by checking forms



for field names that have the string <TT>credit_card</TT> in their names and, if



so, encrypts the value before storing the information to disk.</P>



<P>To find out more about the security features of MiniVend, again refer to the MiniVend



documentation. To learn more about security as it pertains to the World Wide Web



in general, you should review Chapter 3.



<H3 ALIGN="CENTER"><A NAME="Heading26"></A><FONT COLOR="#000077">Summary</FONT></H3>



<P>There is a lot more to the MiniVend package than I can write about in a single



chapter. If you are interested in setting up a Web-based shopping center, I highly



recommend using the MiniVend package. I would also suggest reading through the documentation



that comes with the latest version of the package. You may also want to read up on



how to address the security issues as they may concern your shoppers. Web shopping



is becoming quite popular, and thanks to the work of Andrew Wilcox and Mike Heins,



setting up a Web store can be much easier than it otherwise would be.<BR>







<H2 ALIGN="CENTER"><A HREF="ch12.htm" tppabs="http://210.32.137.15/ebook/Web%20Programming%20with%20Perl%205/ch12.htm"><IMG SRC="blanprev.gif" tppabs="http://210.32.137.15/ebook/Web%20Programming%20with%20Perl%205/blanprev.gif" WIDTH="37" HEIGHT="37"



ALIGN="BOTTOM" BORDER="2"></A><A HREF="index-1.htm" tppabs="http://210.32.137.15/ebook/Web%20Programming%20with%20Perl%205/index-1.htm"><IMG SRC="blantoc.gif" tppabs="http://210.32.137.15/ebook/Web%20Programming%20with%20Perl%205/blantoc.gif" WIDTH="42"



HEIGHT="37" ALIGN="BOTTOM" BORDER="2"></A><A HREF="ch14.htm" tppabs="http://210.32.137.15/ebook/Web%20Programming%20with%20Perl%205/ch14.htm"><IMG SRC="blannext.gif" tppabs="http://210.32.137.15/ebook/Web%20Programming%20with%20Perl%205/blannext.gif"



WIDTH="45" HEIGHT="37" ALIGN="BOTTOM" BORDER="2"></A>











</BODY>







</HTML>

⌨️ 快捷键说明

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