#!D:\Perl\bin\perl.exe use CGI qw(:standard); use CGI::Cookie; |
# # frontpage.pl # # Sample script for the findagoodwine.com channel that # creates the normal front page. We look up the user's # last three searches in our database, and provide links # to them. When the M-Business Sync Server traverses the # channel, it will follow these links and that's where the # search actually gets conducted. |
# Prints out some standard HTTP headers. |
print header(-'Cache-Control'=>'private'); |
# Gets all the cookies and puts them into a hash. |
%cookies = fetch CGI::Cookie; |
if ($cookies{'findagoodwineID'} ) { |
# If a cookie exists, we get its value (which is the # user's ID number) and look up his preferences in a # database. |
$myID = $cookies{'findagoodwineID'} -> value; dbmopen(%history,"winehistory",0644) || die "Can't open wineprefs! $!"; @lastsearch = split(/~:~/, $history{$myID}); dbmclose(%history); |
} |
# Now, we print out the beginning of the Web page. |
print <<END_of_Start; |
<HTML> <HEAD> <TITLE>Find a good wine</title> <META NAME="HandheldFriendly" content="True"> </head> <body> <Center><h2>The find a good wine channel!</h2></center> |
<ul> <li><a href="/examples/findagoodwine/news.html">Wine News</a> <li><a href="/examples/findagoodwine/row.html">Review of the Week</a> <li><a href="/examples/findagoodwine/searchform.html">Find a wine</a> </ul> |
END_of_Start |
if (@lastsearch) { print "<p>Here are the results of your last three searches...</p>\n"; print "<ul>"; |
foreach $searchstring (@lastsearch) { ($searchurl, $searchdesc) = split(/~::~/, $searchstring); print "<li><a href=\"$searchurl\">$searchdesc</a>\n"; } |
print "</ul>\n"; |
} |
print "</body>\n</html>\n"; |
# # Copyright (c) 2000, iAnywhere Solutions, Inc., # all rights reserved. # # IANYWHERE MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT # THE SUITABILITY OF THE SOFTWARE, EITHER EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR # PURPOSE, OR NON-INFRINGEMENT. IANYWHERE SHALL NOT BE # LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT # OF USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR # ITS DERIVATIVES. |
Send feedback about this page using email. | Copyright © 2008, iAnywhere Solutions, Inc. |