#! Perl utiliser CGI; $ Q = new CGI; # Obtenir les paramètres passés au script # # # # # # # # # # # # # # # # # # # $ Nom = $ q-> param ('nom'); $ TestName = $ q-> param ('TestName'); $ NumQuestions = $ q-> param ('NumQuestions'); $ PassingGrade = $ q-> param ('PassingGrade'); $ Marquer = $ q-> param ('Score'); if ($ TestName eq "" | | numQuestions de $ eq "") { print "Content-type: text / html \ n \ n"; imprimer "<html>"; imprimer "<head> <title> défaut </ title> </ head>"; imprimer "body"; print "STATUS = 500"; imprimer "Photos"; print "Impossible d'analyser les résultats des tests en raison d'une erreur de paramétrage."; print "</ body> </ html>"; exit 0; } # # # # # # # # # # # # # # # # # # # # # # Obtenir l'heure actuelle # # # # # # # # # # # # # # # # # # # # # ($ Sec, $ min, $ heures, $ mday, mon $ $ annee, $ sjour, $ ajour, $ isdst) = Localtime (time); $ Year = $ l'an + 1900; $ $ = Mon mon + 1; $ Currtime = "$ l'an-$ $ mon-mday $ heure: $ min: $ sec";
# # # # # # # # # # # # # # # # # # # # # # Ouvre le fichier de données de test pour l'ajout et écrire les données . # # # # # # # # # # # # # # # # # # # # # $ TestName = ". Log"; ouvert (TESTDATA, ">> c: \ \ $ TestName") ou mourir; impression TESTDATA "$ currtime $ name $ numQuestions $ $ passingGrade partition \ n";
# # # # # # # # # # # # # # # # # # # # # # Cours âgées produites par le programme utilise un index de base zéro pour la questions (c.-à-Question0 est la première question) «cours # récents sont un base (c.-à-Question 1 est la première question) » # Déterminer lequel il est ' # # # # # # # # # # # # # # # # # # # # # Startindex = 0 $; $ Temp = $ q-> param (' Question0 '); if ($ temp eq "") { Startindex = 1 $; } $ Index = $ startindex;
# # # # # # # # # # # # # # # # # # # # # # Écrivez à toutes les questions et réponses # # # # # # # # # # # # # # # # # # # # # while ($ index <($ startindex + $ numQuestions)) { $ TVQ = "question $ index"; $ ans = "réponse $ index"; $ qval = $ q-> param ($ TVQ); $ aval = $ q-> param ($ ans); impression TESTDATA "$ TVQ: $ qval \ n"; impression TestData "$ ans: $ aval \ n"; $ Index + = 1; }
près TESTDATA; # # # # # # # # # # # # # # # # # # # # # # Réponse qu'il a travaillé # # # # # # # # # # # # # # # # # # # # Print $ q-> header (); print "STATUS = 200 \ r \ n";
Soutien | A propos de Trivantis
© Copyright Trivantis 2017