$value) { if ($key == "question") $question = $value; else if ($key == "course") $course = $value; else if (preg_match("#^answer#", $key)) $answers[] = $value; } //Check we have at least a question and an answer if (empty($question)) die("Veuillez indiquer une question !"); else if (count($answers) <= 0) die("Veuillez indiquer au moins une réponse correcte !"); else { $quest = Question::new_Question($question, $answers, $course); $quest->print_test(); // @TODO: Create/Load a QuestionFile and add the question (it must be unique) // @TODO: Find a validator (from the list of previous senders for example?) // @TODO: Update the question and save the file // @TODO: Send mail to the selected validator /* This code works, perhaps should be placed in a method in Question class? $to = "bertrand.cournaud@gmail.com"; $subject = "[Nemubot] Validation d'une question"; $headers = "From: Nemubot "; $message = "Bonjour,\n"; if (mail($to, $subject, $message, $headers)) { echo ("Email sent"); } else echo ("Error with the email"); //*/ } } else header("Location: ./"); ?>