[19785] in Perl-Users-Digest
Perl-Users Digest, Issue: 1980 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Oct 22 09:10:32 2001
Date: Mon, 22 Oct 2001 06:10:12 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <1003756212-v10-i1980@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Mon, 22 Oct 2001 Volume: 10 Number: 1980
Today's topics:
Sorting a pipe delimited database <diehard@nospam.userve.co.uk>
Re: Sorting a pipe delimited database <diehard@nospam.userve.co.uk>
Re: String substitution problem <mlaw@talk21.comNOSPAM>
Re: Typhoon-Web-DataBase-Administrator-1.3.0 with Postg (EED)
Webpage Passwords <news@scottbell.org>
Re: Webpage Passwords <diehard@nospam.userve.co.uk>
Re: Webpage Passwords <tintin@snowy.calculus>
Re: Webpage Passwords (Martien Verbruggen)
Re: Webpage Passwords <diehard@nospam.userve.co.uk>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Mon, 22 Oct 2001 13:44:18 +0100
From: "Diehard Duck" <diehard@nospam.userve.co.uk>
Subject: Sorting a pipe delimited database
Message-Id: <1003754663.10449.0.nnrp-14.9e98e2c7@news.demon.co.uk>
Hi All,
I'm fairly new to this Perl business and there are somethings I don't
understand and some I do!
I am 'adapting' a free script, Database Doctor, to my own needs. Everything
works fine but there is one tweak I want to make.
Here is the situation:
I've got a pipe delimited flat-file database, which stores details on our
product range. The field headers are stored in the '@table_fields' array.
display.cgi is called, usually with searchterms. display.cgi searches the
database and displays the results in no particular order. What I want is the
results to be shown in order of 'procass-price', the 14th Col of the
database. However the order of the records in the flatfile database has no
effect on the display of the results, so I can't just sort that.
So:
I want the displayed results to be shown in order of 'procass-price'. I
have read about sort $a <=> $b etc, but I don't really know how to apply
that to my needs.
The code:
======================
#!/usr/bin/perl
##############################################################
#
# Display.cgi for Database_Doctor.cgi
# Mike Carville
# www.web-bazaar.com
# carville@web-bazaar.com
#
# This script is made available free of charge.
# Please leave my name in the header section.
# You may not sell this script for any reason.
# While not required, please leave the banner in the footer
# in the manager script to help fund further development.
#
# If you are really thrilled with this script, why not help
# us both out and buy a reference book from our scripts page.
# We get a commission, you get knowledge, and Amazon stockholders
# breathe easier for another day. <:-)
#
# I originally wrote the Database Doctor to manage inventory files for
webstores,
# specifically Selena Sols. But since everyone has an imagination and is
generally
# looking for the best fit of something existing to a custom project, people
# were constantly asking for a front end.
#
# Ok, so now you have it.
#
# Display.cgi will display your flat file database made in Database Doctor,
# or just about any I suppose. I believe I have given you a way to be really
# creative with the html as well. You be the judge, As always, to make
something
# better, it gets more complicated.
#
# After we discuss the file setup here, read below, as there more comments
placed
# to help you use this to it's fullest.
#
# The working example of what I am using this for is at www.fsfprs.com
# A database of Facial Plastic Surgeons.
#
# Main CGI Directory
# --------------
# display.cgi (permission 755)
#
# Data
# --------------
# Set this line to the location of the data file you wish to search and
display
# *This is a server path without a slash on the end.*
$datafile = "procass.dat";
# HTML Files
# --------------
# This script uses templates for the header of the page,
# the footer of the page, and a search form. Note the Usage of the
# example files provided. These are SECTIONS of a page...
# not the whole page...hint hint.
#
# HTML Files Required
# -------------------
# These files must exist, even if empty. They must be in the same directory
as the script unless you care to add paths.
#
# display_header.dat
# -html for the top of the web page created. Starts with <html> and has a
full head.
#
# display_footer.dat
# -html for the bottom of the page. Ends with </html> DOES NOT INCLUDE THE
<HTML> tag.
#
# search_form.dat
# -this is a custom little search form. Starts and ends with a form
tag...completely
# self contained. More on how to set this up below.
#
# Search Terms
# -------------------
#
# This is my little concept. Lets see if I can explain. The search works on
# a whittling down process. It starts with the whole file as a result, and
the performs
# a progreesive amount of searches against each result.
#
# The results from the first search term are used in the next search. Thats
# how it whittles down the results.
#
# Number one the keyword filed in your search MUST be named searchtext. That
is
# what the script is looking for.
#
# After that you may have as many different search terms as you like, and
you will
# set them in the array (an @ variable) below. On the Search form itself you
will make
# a field with the matching name listed here. Leave the first option with a
value
# of nothing if you want people to be able to ignore the field. (<option
value=""></option>)
#
# So what this allows is a search on any number of terms the user decides
on. In the case of an
# address book this may mean the search for a city, or a state, or both by
choosing
# something form each list. The best way to do this is to use drop down
lists.
# This will allow you to TELL THE USER WHAT TO LOOK FOR. This is the
important
# part of the concept. By telling them what they can look for, you help them
find results.
#
#
# Syntax is important here...you are setting a perl variable. A long list
would look like this...
# @searchterms = ("city","state","zip");
#
# remember that the search term must match the field name in the form for it
to be checked.
@searchterms =
("Product-Code","Manufacturer","Category","Model-No","Hot","New");
#
# Repeat the same table fields set in the database doctor script here
@table_fields =
("Product-Code","Manufacturer","Category","Model-No","Title","Description","
Bullet1","Bullet2","Bullet3","Bullet4","Bullet5","Version","RRP","Procass-Pr
ice","Educational-Price","Picture","Further-Details","Hot","New","RRPVAT","P
ROVAT","EDUVAT");
#
# The number of results you would like to have on a page. Next page links
are made automatically.
$limit_of_search_results = 20;
# Searching with Links (Get)
# --------------------------
#
# If you want to create links to search your data file, you can do that with
this release.
# Each link would contstructed like this:
#
# ...display.cgi?search=1&searchtext=fred
#
# You can also add the searchterms in here as well. Just remember to
separate each group
# with an & , and have a key and a value separated with an = sign.
#
# So, the same string above with a searchterm added...
#
# ...display.cgi?search=1&searchtext=fred&State=FL
#
# Spaces in direct links
# --------------------------
#
# Be aware that spaces in direct links may not work on some browsers.
# Revolving Color Option
# ----------------------
#
# If you want a Table of results to use rotating colors, set the hex color
values here.
#
# The next Four parts are the html for the search results. This is set to
use tables, but
# you could easily not use them. Have fun...this is VERY flexible with a
little imagination.
#
# A note about print qq! statements.
# ----------------------------------
#
# we use the print qq! statement to print large blocks of html here.
# This changes the rules a little..for the better.
#
# -you do not need to precede a quotation (") with a slash as you would in a
normal print satement.
# -you still need to precede the @ sign not used as a variable...like an
email address...like this \@
# -in a print qq! you need to precede the exclamation point with a slash,
# as it is looking for that as the end of the print statement.... use \!
#
# Table Header or Top of Display
# ------------------------------
#
# really basic here...just html
#
sub table_header
{
print qq!
!; # end of print statement
}
# Not So Basic...the individual search result
# -------------------------------------------
#
# You have a lot of options here, and a little perl knowledge will help.
However, I will try to
# tell you everything you need to know. At the bottom is a specific example
of a customization I used.
# Don't be afraid to try!
#
# The program is taking the result and splitting it up into an array. You
can then display
# whatever parts of this individual line here by using a variable.
#
# We have split the line into the array @field. Individual parts of the
array are accessed by
# telling it what number you want.
#
# VERY IMPORTANT...arrays start counting from zero!
#
# So the first field in the line is $field[0], the fifth $field[4] etc...
#
# The variable name field is case sensitive!
#
# Include any html you want, and place your fields in any order. If you want
to use rotating
# rows of color, set your table row to include <TR bgcolor=$bgcolor>, and
set the colors above.
# The use of other variables is explained below. Otherwise $email and others
have no value.
sub table_row
{
$productcode="$field[0]";$manufacturer="$field[1]";$category="$field[2]";$mo
delnumber="$field[3]";$title="$field[4]";$description="$field[5]";
$bullet1="";$bullet2="";$bullet3="";$bullet4="";$bullet5="";$version="";$rrp
="";$procassprice="";$educationalprice="";$rrpvat="";$provat="";$eduvat="";
$hot="<img src=\"/images/system/hot.gif\">";
$new="<img src=\"/images/system/new.gif\">";
$picture="<img src=\"/images/products/$field[0].jpg\" width=150 height=100
align=right>";
$furtherdetails="<b><a href=\"javascript:void(0);\"
onClick=\"item_window(\'/pages/moreinfo/$field[0].htm\')\">More
Information</a></b><p>";
if ($field[6] ne "")
{$bullet1="<li>$field[6]";}
if ($field[7] ne "")
{$bullet2="<li>$field[7]";}
if ($field[8] ne "")
{$bullet3="<li>$field[8]";}
if ($field[9] ne "")
{$bullet4="<li>$field[9]";}
if ($field[10] ne "")
{$bullet5="<li>$field[10]";}
if ($field[15] ne "Yes")
{$picture="";}
if ($field[16] ne "Yes")
{$furtherdetails="";}
if ($field[17] ne "Yes")
{$hot="";}
if ($field[18] ne "Yes")
{$new="";}
if ($field[12] ne "")
{$rrp="<tr><td bgcolor=\"black\" width=65%><font face=\"verdana\"
size=2>Recommended Retail Price</font></td><td bgcolor=\"black\" align=right
width=35%><font face=\"verdana\" size=2>£$field[12] $field[19]
VAT</font></td></tr>";}
if ($field[13] ne "")
{$procassprice="<tr><td bgcolor=\"black\" width=65%><font face=\"verdana\"
size=2 color=\"lime\"><b>Procass Price</b></font></td><td bgcolor=\"black\"
align=right width=35%><font face=\"verdana\" size=2
color=\"lime\"><b>£$field[13] $field[20] VAT</b></font></td></tr>";}
if ($field[14] ne "")
{$educationalprice="<tr><td bgcolor=\"black\" width=65%><font
face=\"verdana\" size=2>Educational Discount Price</font></td><td
bgcolor=\"black\" align=right width=35%><font face=\"verdana\"
size=2>£$field[14] $field[21] VAT</font></td></tr>";}
print qq!
<table border=0 bgcolor="gray" width=600 cellspacing=2 cellpadding=2>
<tr>
<td width=65%>
<font face="verdana" size=2 color="lime"><b>$title</b></font>
</td>
<td align=right width=35%>
$new $hot
</td>
</tr>
<tr>
<td colspan=2 bgcolor="black">
<font face="verdana" size=2>
<br>
$description
<ul>
$picture
$bullet1
$bullet2
$bullet3
$bullet4
$bullet5
</ul>
$furtherdetails
</font>
<font face="arial" size=1>Product Code: $productcode</font><br>
<font face="arial" size=1>Model Number: $modelnumber</font>
</td>
</tr>
$rrp
$procassprice
$educationalprice
</table>
<br> <br>
!;
}
# Table Footer or Bottom of Display
# ------------------------------
#
# really basic here...just html
# but I would caution you that Netscape will not show incomplete tables
# ...so make sure you close it out.
sub table_footer
{
print qq!
!;
}
# Customization Example
# ------------------------------
#
# In my original usage for the script I have email and website addresses.
# Some lines have them, and some don't. I only want to show them if they
exist.
# You can do this for as many of the fields as you like.
# So we make a little if statement...
#
# if ($field[5] ne "")
#
# This is using a double negative...and reads if the 4th
# field is not equal to nothing, then it is something and do this...
#
# {$address2="<BR>$field[5]";}
#
# What we do next is set the value of the field to a variable name. We then
put the variable name
# in the the table row html where we would want it if it existed. If it
exists, it will show up there.
# If it does have no value, nothing will appear.
#
# But Perl Programmers..this leaves us open to a lttle programming problem.
# ...if one line has a value, and the next does not, we need to clear
# out the value of our variable beforehand. We do this by setting the value
of the variable
# we are using before we ask the if question and possible set a value.
#
# Below is the all of this put together. Remember to take out the comments
(#) if you try it out.
# $address2="";$email="";$website="";$name="";
#
#
# if ($field[5] ne "")
# {$address2="<BR>$field[5]";}
#
# if ($field[3] ne "")
# {$name="$field[3]";}
#
# if ($field[12] ne "")
# {$email="<BR>Email: <a href=\"mailto:$field[12]\">$field[12]</a>";}
#
# if ($field[13] ne "")
# {$website="<BR>Website: <a href=\"$field[13]\">$field[13]</a>";}
##############################################################
##############################################################
# End Of configure
##############################################################
##############################################################
##############################################################
# Parse from the web form
##############################################################
(!$ENV{'REQUEST_METHOD'}) && (die __FILE__.' line '.__LINE__." No Request
method, $!\n");
## If method is GET or HEAD, fetch the query from the environment.
if ($ENV{'REQUEST_METHOD'} =~ /^(GET|HEAD)$/ ) {
$query_string = $ENV{'QUERY_STRING'};
if(!$query_string)
{ # could just be a link into the script
$form{1}=1;# so we have a defined value and the system will fire
}
}
## If the method is POST, fetch the query from standard input.
if ($ENV{'REQUEST_METHOD'} eq 'POST') {
$length = $ENV{'CONTENT_LENGTH'} if $ENV{'CONTENT_LENGTH'};
## no content length, and something is wrong, die to prevent further
problems
(!$length) && (die __FILE__.' line '.__LINE__." No content length with with
POST request, $!\n");
## if length is to long, then someone is probably attempting to crack the
system
($length > 163840) and (die __FILE__.' line '.__LINE__." Content Length
exceeded Post hard limit of 16384, $!\n");
## ok, this is probably ok
while($length){
$query_string .= getc(*STDIN);
$length--;
}
## we failed somehow
!$query_string && (die __FILE__.' line '.__LINE__." No standard input with
POST request, $!\n");
}
## We've gotten this far, our query string is available,
## break it down to key/value pairs
my(@pairs) = split('&',$query_string);
my($key,$value);
my(@pairs) = split('&',$query_string);
my($key,$value);
foreach (@pairs) {
($key,$value) = split('=');
$key = &unescape($key); # convert pairs to something usable
!$key and next;
!$value and next;
$value = &unescape($value);
$form{$key} = $value; # load our hash
}
##-------------------------------------Sub
unescape -----------------------##
sub unescape {
my($string) = @_;
$string =~ tr/+/ /; # pluses become spaces
$string =~ s/%([0-9a-fA-F]{2})/pack("c",hex($1))/ge;
return $string;
}
print "Content-type: text/html\n\n";
##############################################################
# Read in data and decide what to do
##############################################################
open (FILE, "display_header.dat") || die print
"$html_path/display_header.dat";
while(<FILE>)
{$row = $_;chop $row;
$header .= "$row\n";}
close (FILE);
open (FILE, "display_footer.dat") || die print "display_footer.dat";
while(<FILE>)
{$row = $_;chop $row;
$footer .= "$row\n";}
close (FILE);
open (FILE, "search_form.dat") || die print "search_form.dat";
while(<FILE>)
{$row = $_;chop $row;
$search_form .= "$row\n";}
close (FILE);
open (DATABASE, "$datafile") || die print "$datafile";
@data=<DATABASE>;
close (DATABASE);
$counter = 1;
foreach $data(@data)
{$search_data{$counter} = $data; $counter++;}
$counter = 0;
foreach $table_fields(@table_fields)
{$field_placement{$table_fields} = "$counter"; $counter++;}
##############################################################
# Search if necessary
##############################################################
$results_counter = 1;
if ($form{'search'})
{
$search_terms_present = 0;
# Split keywords
#########################################
@searchText = split(/\x20/,$form{'searchtext'});
foreach $test (@searchText)
{if ($test =~ /\S{2,}/){ push @searchKey, $test;}}
# Prepare Link
#########################################
$search_query = "search=1";
$form{'searchtext'} and $search_query .= "&searchtext=$form{'searchtext'}"
and $search_terms_present++;
foreach $searchterms(@searchterms)
{$form{$searchterms} ne "" and $search_query .=
"&$searchterms=$form{$searchterms}" and $search_terms_present++;}
# Loop Through Data
#########################################
foreach $key(keys %search_data)
{
$found = 0;
@line = split (/\|/, $search_data{$key});
# For those of you keeping score here...@line is the array we split,
# $key is a number which relates to the original data hash
# %field_placement relates to the position of the field we are searching
for
# Custom Searching
#########################################
foreach $searchterms(@searchterms)
{$form{$searchterms} and $line[$field_placement{$searchterms}] =~
/\b$form{$searchterms}\b/i and $found++;}
# Text Searching
#########################################
if ($form{'searchtext'})
{
foreach $test(@searchKey)
{$search_data{$key} =~ /\b$test\b/i and $found++;}
} # end if we have search text
# Check Results
#########################################
# if we find something we make a new hash relation ship called
%search_results
$found > 0 and $found == $search_terms_present and do{
$search_results{$key} = $search_data{$key};
$result_map{$results_counter} = $key;
$results_counter++;
}; #end found do
} #end foreach search key
} # end search routines
##############################################################
# Begin the page of results
##############################################################
print "$header";
$starting_point = $form{'starting_point'};
!$starting_point and $starting_point = 1;
$current_page_number = int($form{'starting_point'}/$limit_of_search_results)
+1;
$end_point = ($current_page_number * $limit_of_search_results);
if (%search_results)
{
&table_header;
@prices = ($field[13]);
$result = $starting_point;
@sorted_results = sort { $a <=> $b } keys %search_results;
foreach $result($start_point..$end_point)
{
!$search_results{$result_map{$result}} and next;
$last_displayed = $result;
@field = split (/\|/, $search_results{$result_map{$result}});
if ($bgcount > 1)
{$bgcolor=$bgcolor2;$bgcount=1;}
else
{$bgcolor=$bgcolor1;$bgcount=2;}
&table_row;
}
#print "<hr>Procass Debug Data<p>";
#print %search_results;
#print "<p><hr>";
#print @sorted_results;
#print "<p><hr>";
#print @table_fields;
#print "<p><hr>";
#print @prices;
#print "<p><hr>";
&table_footer;
}
else
{
print "<P><font face=\"verdana\" size=2><ul>Nothing found matching your
search.</ul></font><P>";
}
print "<font face=\"verdana\" size=2>";
$results_counter--;
$results_counter > $limit_of_search_results and do{
$page_count = int($results_counter/$limit_of_search_results) +1;
($results_counter/$limit_of_search_results) ==
int($results_counter/$limit_of_search_results) and $page_count--;
$next_starting_point = ($last_displayed + 1);
$count =1;
$starting_point = 1;
until ($count > $page_count)
{
$count == $current_page_number and $next_results_link .= qq~<b>$count</b> |
~;
$count != $current_page_number and $next_results_link .= qq~<a
href="display.cgi?$search_query&starting_point=$starting_point">$count</a> |
~;
$starting_point += $limit_of_search_results;
$count++;
}
$next_starting_point > $results_counter and $next_starting_point = 1;
$next_results_link .= qq~<a
href="display.cgi?$search_query&starting_point=$next_starting_point">Next
Page</a>~;
print "<P><center>$next_results_link</center><P>";
print "</font>";
};#end do
sub byprice
{
$price_a = &get_procassprice($search-results{$a});
$price_b = &get_procassprice($search-results{$b});
$price_a <=> $price_b;
}
print "<P>$search_form<P>";
print "<P>$footer<P>";
======================
I've included everything. Sorry if it's caused any inconvenience.
Basically any light you can shed would be much appreciated...just post any
questions you might have and I'll do my best to reply.
Many thanks,
DD
------------------------------
Date: Mon, 22 Oct 2001 13:48:10 +0100
From: "Diehard Duck" <diehard@nospam.userve.co.uk>
Subject: Re: Sorting a pipe delimited database
Message-Id: <1003754893.10556.0.nnrp-14.9e98e2c7@news.demon.co.uk>
[snip]
> sub byprice
> {
> $price_a = &get_procassprice($search-results{$a});
> $price_b = &get_procassprice($search-results{$b});
> $price_a <=> $price_b;
Ignore that bit...it was a friend's suggestion that didn't work.
DD
------------------------------
Date: Mon, 22 Oct 2001 11:28:10 +0100
From: "Matt L." <mlaw@talk21.comNOSPAM>
Subject: Re: String substitution problem
Message-Id: <9r0sc1$kct$1@newsreaderg1.core.theplanet.net>
Thanks guys!
"Ilya Martynov" <ilya@martynov.org> wrote in message
news:87pu7iqcto.fsf@abra.ru...
> >>>>> On Sat, 20 Oct 2001 21:03:27 +0000, Matt L
<matt@matthewlaw.comNOSPAM> said:
>
> ML> Hi,
> ML> I'm having a problem getting this sub routine to work right. It might
be
> ML> that I don't really know what I'm doing!
> ML> If anyone could help I'd be most grateful.
>
> ML> Many thanks,
>
> ML> Matt.
>
> ML> The error I receive is:
>
> ML> /*H/: ?+*{} folows nothing in regexp at line ....
>
> '*' have special meaning in regexp. It is a quantifier. See 'perldoc
> perlre' section 'Regular Expressions'. If you want to match character
> '*' you should escape it with '\'.
>
> BTW 'perldoc perldiag' provides some help if you do not understand
> 'cryptic' error message. Please check it in future before asking in
> news group.
>
> ML> The problem routine follows. It is meant to replace all occurences of
> ML> '*H', '*h', '/*H', and '/*h' with the approriate starting and ending
html
> ML> style tags within the document:-
>
> ML> sub insert_html {
> ML> # take a string and replace the coded chars with the right
html markup
> ML> my $strtemp = $_[0];
> ML> $strtemp =~ s/*H/<span class="Heading">/g;
> ML> $strtemp =~ s/*h/<span class="SM_Heading">/g;
> $strtemp =~ s/\*H/<span class="Heading">/g;
> $strtemp =~ s/\*h/<span class="SM_Heading">/g;
> ML> $strtemp =~ s|*/H|</span>|g;
> ML> $strtemp =~ s|*/h|</span>|g;
> $strtemp =~ s|\*/h|</span>|gi;
> ML> return $strtemp;
> ML> }
>
> --
> -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
> | Ilya Martynov (http://martynov.org/) TIV.net (http://tiv.net/)
|
> | GnuPG 1024D/323BDEE6 D7F7 561E 4C1D 8A15 8E80 E4AE BE1A 53EB 323B DEE6
|
> -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
------------------------------
Date: Mon, 22 Oct 2001 13:02:12 +0200
From: "Alexander Farber (EED)" <eedalf@eed.ericsson.se>
Subject: Re: Typhoon-Web-DataBase-Administrator-1.3.0 with PostgreSQL support released!!!
Message-Id: <3BD3FCB4.6BE80F11@eed.ericsson.se>
Ron de Jong wrote:
>
> I'm proud to announce you that the latest release of TWDBA now includes
> PGSQL as well.
>
> Download it from:
>
> http://home.planet.nl/~radejong/
>
> Further I would like to thank all those users for testing TWDBA and positive
> feedback.
> Listening to users is the only way to come to a good product...
You do some dangerous things there:
$AppliedNewDatabase = $q->param('Applied_New_Database');
...
$SQLString = "CREATE DATABASE $AppliedNewDatabase";
...
$sth->execute or warn $DBI::errstr; # Oh, tough luck
Have you thought about what happens, when a user will
enter something like "blah; drop database bleh" into
the field 'Applied_New_Database' ?
Regards
Alex
PS: And why so many print's? ;-)
------------------------------
Date: Mon, 22 Oct 2001 11:17:34 +0100
From: "Scott Bell" <news@scottbell.org>
Subject: Webpage Passwords
Message-Id: <FmSA7.54149$sF.4733750@news2-win.server.ntlworld.com>
I wish to create a CGI script that allows users to create accounts. Is there
a way of getting the popup box in internet browsers that asks for the login
name and password via a CGI script?
--
Scott Bell
Email: scott@scottbell.org
------------------------------
Date: Mon, 22 Oct 2001 13:30:26 +0100
From: "Diehard Duck" <diehard@nospam.userve.co.uk>
Subject: Re: Webpage Passwords
Message-Id: <1003753833.10095.0.nnrp-14.9e98e2c7@news.demon.co.uk>
"Scott Bell" <news@scottbell.org> wrote in message
news:FmSA7.54149$sF.4733750@news2-win.server.ntlworld.com...
> I wish to create a CGI script that allows users to create accounts. Is
there
> a way of getting the popup box in internet browsers that asks for the
login
> name and password via a CGI script?
>
I'm not sure of the code to do this, but I think what you need to do is
allow users to set up accounts from a script on a webpage. The script
writes username/password to a .htaccess file in the root of the folder you
want restricted. Then when anyone tries accessing that folder
(www.foo.com/restricted for example) they must have signed up to have
access.
That's a bit vague but I hope you can get the gist of what I'm saying!
DD
------------------------------
Date: Mon, 22 Oct 2001 22:40:01 +1000
From: "Tintin" <tintin@snowy.calculus>
Subject: Re: Webpage Passwords
Message-Id: <PtUA7.14$JE6.526404@news.interact.net.au>
"Scott Bell" <news@scottbell.org> wrote in message
news:FmSA7.54149$sF.4733750@news2-win.server.ntlworld.com...
> I wish to create a CGI script that allows users to create accounts. Is
there
> a way of getting the popup box in internet browsers that asks for the
login
> name and password via a CGI script?
Yes there is, but it has nothing to do with Perl.
------------------------------
Date: Mon, 22 Oct 2001 22:52:08 +1000
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: Webpage Passwords
Message-Id: <slrn9t85jo.cnu.mgjv@martien.heliotrope.home>
On Mon, 22 Oct 2001 13:30:26 +0100,
Diehard Duck <diehard@nospam.userve.co.uk> wrote:
>
> "Scott Bell" <news@scottbell.org> wrote in message
> news:FmSA7.54149$sF.4733750@news2-win.server.ntlworld.com...
>> I wish to create a CGI script that allows users to create accounts. Is
> there
>> a way of getting the popup box in internet browsers that asks for the
> login
>> name and password via a CGI script?
>>
>
> I'm not sure of the code to do this, but I think what you need to do is
> allow users to set up accounts from a script on a webpage. The script
> writes username/password to a .htaccess file in the root of the folder you
> want restricted. Then when anyone tries accessing that folder
> (www.foo.com/restricted for example) they must have signed up to have
> access.
Now, this is the sort of (bad) answer you can expect when you ask an offtopic
question like this. This has nothing at all to do with Perl, and
therefore should not be asked in a Perl newsgroup.
Please, try in one of the newsgroups that start with
comp.infosystems.www.
> That's a bit vague but I hope you can get the gist of what I'm saying!
I hope the OP doesn't get that gist, and instead gets a much more
complete and authoritative answer in another group.
Martien
--
|
Martien Verbruggen | Useful Statistic: 75% of the people
| make up 3/4 of the population.
|
------------------------------
Date: Mon, 22 Oct 2001 13:58:25 +0100
From: "Diehard Duck" <diehard@nospam.userve.co.uk>
Subject: Re: Webpage Passwords
Message-Id: <1003755507.10794.0.nnrp-14.9e98e2c7@news.demon.co.uk>
"Martien Verbruggen" <mgjv@tradingpost.com.au> wrote in message
news:slrn9t85jo.cnu.mgjv@martien.heliotrope.home...
> On Mon, 22 Oct 2001 13:30:26 +0100,
> Diehard Duck <diehard@nospam.userve.co.uk> wrote:
> >
> > "Scott Bell" <news@scottbell.org> wrote in message
> > news:FmSA7.54149$sF.4733750@news2-win.server.ntlworld.com...
> >> I wish to create a CGI script that allows users to create accounts. Is
> > there
> >> a way of getting the popup box in internet browsers that asks for the
> > login
> >> name and password via a CGI script?
> >>
> >
> > I'm not sure of the code to do this, but I think what you need to do is
> > allow users to set up accounts from a script on a webpage. The script
> > writes username/password to a .htaccess file in the root of the folder
you
> > want restricted. Then when anyone tries accessing that folder
> > (www.foo.com/restricted for example) they must have signed up to have
> > access.
>
> Now, this is the sort of (bad) answer you can expect when you ask an
offtopic
> question like this. This has nothing at all to do with Perl, and
> therefore should not be asked in a Perl newsgroup.
>
Could Perl not be used to sign people up and to write to the .htaccess file?
Then all Scott has to do is find out about .htaccess files, in, as you
suggest, comp.infosystems.www. I don't see how this has 'nothing to do with
perl'. Take a look at what he wants to achieve overall, and try and be
helpful, and if you feel this has nothing to with Perl, at least explain
why. Not everyone is necessarily as clued up as you are! I'm sure even you
had to ask questions once that seem dumb now.
(Diehard Duck cowers in a puddle awaiting a good flaming)
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V10 Issue 1980
***************************************