#!/usr/bin/perl
#####################################################
# Script by MP.Prakash R.Lewis #
# http://www.bestnetcraft.com #
# This script is offered in the same terms as Perl. #
# Comments and suggestions may be sent through #
# http://www.bestnetcraft.com/contact.html #
# No liability or damage will be accepted by the #
# author under any circumstances. #
#####################################################
# Check out the Readme File
# Version 2 : Integrated module
# needs external questions-answers text
# Q & A text file's name needs to be passes as the query_string
# set up a 12 element array using raw.pl and invoke this script passing the text name
# as query_string
# For a working example - check out : http://www.bestnetcraft.com/resource.html
# Configuration - User defined variables
$pro="quest.cgi";
$lin=1;
$debug=0;
$envy= $ENV{'QUERY_STRING'};
#parse the form
read(STDIN,$temp,$ENV{'CONTENT_LENGTH'});
@pairs=split(/&/,$temp);
foreach $item(@pairs)
{
($key,$content)=split(/=/,$item,2);
$content=~tr/+/ /;
$content=~s/%(..)/pack("c",hex($1))/ge;
$content =~ s///g;
$fields{$key}=$content;
$i++;
$item{$i}=$key;
$response{$i}=$content;
}
$envy =($envy ?$envy:$fields{'what'});
&nyet unless $envy;
$marks =($fields{'total'}?$fields{'total'}:0);
#&nyet unless $fields{'action'};
if ($fields{'action'} eq "indi") {&quest1;}
&quest1 unless $fields{'action'};
#beginning of subs
sub quest1 {
print "Content-type: text/html\n\n";
print <
";
print " Question is :$ele[1]
";
print "Answer is : $fields{'ans'}
";
print "Number of Question: $no
";
print "marks scored is : $marks
";
}
if ($fields{'ans'} ne "") {$no++;}
print "Total Marks scored in this test : $marks
";
my $per=(($marks/31)*100);
my $perc=sprintf "%.2f",$per;
if ($perc >=75){
print <
endo
}
#processing the input data
open (FILE, $envy) || &nyet;
if ($lin ==1){flock FILE, 2;}
@data =
$ele[5]
eof } print <Bestnetcraft for Total web solutions
Finecrafts of the Net. For more of free CGI/Perl/server scripts click on the name "Bestnetcraft".
Note: The next few pages will take you through a series of questions. This is an Online Question- Answer Session. You have a running score visible always at the top. There is no time limit to this test. If you have succesfully completed this test you can move on to another test. Please complete the form at the end of the test which will enable us to serve you better.