#! Perl use CGI; $ Q = new CGI; # Bekommen die Parameter an das Skript übergeben # # # # # # # # # # # # # # # # # # # $ Name = $ q-> param ('name'); Testname $ = $ q-> param ('Testname'); NumQuestions $ = $ q-> param ('NumQuestions'); PassingGrade $ = $ q-> param ('PassingGrade'); $ Score = $ q-> param ('Score'); if ($ testname eq "" | | $ numQuestions eq "") { print "Content-type: text / html n \ \ n"; print "<html>"; print "<head> <title> Failure </ title> </ head>"; print "<body>"; print "STATUS = 500"; drucken "<br>"; print "konnte nicht analysiert werden Testergebnisse aufgrund einer Parameterfehler."; print "</ body> </ html>"; exit 0; } # # # # # # # # # # # # # # # # # # # # # # Die aktuelle Zeit # # # # # # # # # # # # # # # # # # # # # ($ Sec, $ min, $ Stunden, $ mday, $ mon, $ year, $ wday, $ yday, $ isdst) = Localtime (time); $ Year = $ + Jahr 1900; Mo $ $ = Mo + 1; CurrTime $ = "$ year-$ mon-$ $ mday Stunde: $ min: $ s";
# # # # # # # # # # # # # # # # # # # # # # Öffnet Testdaten-Datei für Append und schreiben die Daten . # # # # # # # # # # # # # # # # # # # # # $ = Testname ". Log"; offen (TESTDATA ">> c: \ \ $ Testname") oder sterben; Drucktestdata "$ $ $ name CurrTime numQuestions $ $ passingGrade Punktzahl \ n";
# # # # # # # # # # # # # # # # # # # # # # Ältere Kurse, die von dem Programm verwendet, produziert eine Null basierenden Index für die Fragen (dh Question0 ist die erste Frage) '# Neuere Kurse sind ein Basis (dh Question1 ist die erste Frage) " # Bestimmen, welche es ist ' # # # # # # # # # # # # # # # # # # # # # $ Start = 0; $ Temp = $ q-> param (' Question0 '); if ($ temp eq "") { $ Start = 1; } $ Index = $ start;
# # # # # # # # # # # # # # # # # # # # # # Schreiben Sie alle Fragen und Antworten # # # # # # # # # # # # # # # # # # # # # while ($ index <($ start + $ numQuestions)) { $ QST = "Frage $ Index", $ ans = "Antwort $ index", $ qval = $ q-> param ($ QST); Aval $ = $ q-> param ($ ans); Drucktestdata "$ qst: $ qval \ n"; Drucktestdata "$ ans: $ Aval \ n"; + $ Index = 1; }
TEST Nähe; # # # # # # # # # # # # # # # # # # # # # # Antwort, dass es funktioniert # # # # # # # # # # # # # # # # # # # # Print $ q-> header (); print "STATUS = 200 \ r \ n";
Unterstützungt | Über Trivantis
© Copyright Trivantis 2017