]> git.mjollnir.org Git - moodle.git/commitdiff
FIxed small bug in password checking
authormoodler <moodler>
Thu, 8 Jul 2004 08:28:50 +0000 (08:28 +0000)
committermoodler <moodler>
Thu, 8 Jul 2004 08:28:50 +0000 (08:28 +0000)
mod/quiz/attempt.php

index 300220d41c27fc03ff9c88b364d4b2d184270094..3bd337eab3fab792f52670743a8b052a5acb9721 100644 (file)
@@ -80,7 +80,7 @@
     }
 
 /// Check password access
-    if ($quiz->password) {
+    if ($quiz->password and empty($_POST['q'])) {
         if (empty($_POST['quizpassword'])) {
     
             print_heading($quiz->name);
             print_simple_box(format_text($quiz->intro), "CENTER");
             echo "<br />\n";
         
-            echo "<form name=\"passwordform\" method=\"post\" action=\"attempt.php?q=$quiz->id\">\n";
+            echo "<form name=\"passwordform\" method=\"post\" action=\"attempt.php?id=$cm->id\">\n";
             print_simple_box_start("center");
             
             echo "<div align=\"center\">\n";
             print_string("requirepasswordmessage", "quiz");
             echo "<br /><br />\n";
             echo " <input name=\"quizpassword\" type=\"password\" value=\"\">";
-            echo " <input name=\"submit\" type=\"submit\" value=\"".get_string("ok")."\">\n";
+            echo " <input type=\"submit\" value=\"".get_string("ok")."\">\n";
             echo "</div>\n";
 
             print_simple_box_end();
             if (strcmp($quiz->password, $_POST['quizpassword']) !== 0) {
                 error(get_string("passworderror", "quiz"), "view.php?id=$cm->id");
             }
-            unset($_POST); /// needed so as not to confuse later code dealing with submitted answers
+            unset($_POST['quizpassword']); /// needed so as not to confuse later code dealing with submitted answers
         }
     }