Esempio n. 1
0
 private function addSubmission($challenge)
 {
     $challengeDetails = \webgoat\ContestChallenges::getByName($challenge);
     $flag = $_POST['flag'];
     $ip = \jf\HttpRequest::IP();
     $challengeID = $challengeDetails[0]['ID'];
     $userID = jf::CurrentUser();
     $data = array('UserID' => $userID, 'ChallengeID' => $challengeID, 'Flag' => $flag, 'IP' => $ip, 'timestamp' => time());
     \webgoat\ContestSubmissions::add($data);
     \webgoat\ContestChallenges::incrementTotalAttempts($challenge);
     if (\webgoat\ContestSubmissions::evaluate($challengeID, $flag)) {
         $this->Submission = 1;
         // Increment complete count
         \webgoat\ContestChallenges::incrementCompletedCount($challenge);
     } else {
         $this->Submission = 0;
     }
 }