CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Need a Custom or Prewritten Perl Program?: I need a program that...:
Need a list Script

 



Tom_R
newbie

Jul 9, 2001, 12:36 PM

Post #1 of 2 (651 views)
Need a list Script Can't Post

I need a cgi script for my "fastest visitors" in a 3DMark2001 list where there is input forms for scores, names, config and so on. The list must have the ability to sort by scores.

Is there any script that is near?? I have been searching the big cgi sites severel times with no luck :(



nathan
stranger

Jul 17, 2001, 11:17 PM

Post #2 of 2 (631 views)
Re: Need a list Script [In reply to] Can't Post

Hi.

Here's a script but it isn't debuged.
Sorry i've forgotten to sort....

#!/usr/bin/perl -w
use CGI;

### Configuration
my $optionfile = 'options.txt';
my $separator = '###';
#
# File format is: <val>$separator<desc>
#
#################

my $ch = new CGI();
print $ch->header;
print "<FORM>\n";

# Get parameter "option" and "new"
my $option = $ch->param('option');
my $new = $ch->param('new');

# Opens the file and reads the option-pairs in an array @options
open(OPTIONFILE,$optionfile) or die "Error in opening $optionfile: $!\n";
my @options = <OPTIONFILE>;
close OPTIONFILE;

if (!$option) ### Just show the SELECT Box with the options (Parameter option isn't set)
{
print "<SELECT name=option>\n";
foreach $single (@options)
{
my ($value,$description) = split($separator,$single);
print "<OPTION value=$value>$description</OPTION>\n";
}
print "<OPTION value="new">Add one</OPTION>\n";
print "</SELECT>\n";
print "<INPUT type=submit></FORM>";
}
elsif($option eq 'new')
{
if (!$new)
{
print "Please specify: <INPUT type=text name=new><INPUT type=hidden name=option value=new\n";
print "<INPUT type=submit></FORM>";
}
else
{
open(OF,">>$optionfile") or die "...$!";
print OF, $new . "_value" . $separator . $new ### Please specify
close OF;
print "Thank you! Your option has been added.\n</FROM>";
}
}
else
{
print "You choose \"$option\" (value)\n";
}


 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives