74 lines
1.3 KiB
PHP
74 lines
1.3 KiB
PHP
<!DOCTYPE html>
|
|
|
|
<?php
|
|
include("Question.class.php");
|
|
include("QuestionsFile.class.php");
|
|
|
|
|
|
$id = $_GET['id'];
|
|
|
|
$file = new QuestionsFile("questions.xml");
|
|
$question = $file->get_question($id);
|
|
$question->print_test();
|
|
|
|
|
|
$file = fopen('email.txt', 'r');
|
|
$number = fgets($file);
|
|
|
|
$random = rand(1, $number);
|
|
|
|
for ($i = 0; $i < $random; $i++)
|
|
{
|
|
$line = fgets($file);
|
|
}
|
|
|
|
/* Oui, c'est moche de le réecrire 2 fois mais ma première belle
|
|
tentative s'est soldée par un echec
|
|
*/
|
|
|
|
while ($line == $question->get_validator())
|
|
{
|
|
$random = rand(1, $number);
|
|
|
|
for ($i = 0; $i < $random; $i++)
|
|
{
|
|
$line = fgets($file);
|
|
}
|
|
}
|
|
|
|
echo 'Adresse mail: ' . $line . "<br/>";
|
|
fclose($file);
|
|
|
|
/* This code works, perhaps should be placed in a method in Question class?*/
|
|
$to = $line;
|
|
$subject = "[Nemubot] Validation d'une question";
|
|
$headers = "From: Nemubot <bot@nemunai.re>";
|
|
$message = 'Bonjour,\n
|
|
Adresse de validation d une question:
|
|
$validationAddress . $quest->getId()';
|
|
|
|
if (mail($to, $subject, $message, $headers))
|
|
{
|
|
echo ("Email sent");
|
|
}
|
|
else
|
|
echo ("Error with the email");
|
|
//*/
|
|
|
|
|
|
|
|
echo "Merci de votre participation <br/>";
|
|
echo "Une personne va maintenant confirmer votre question"
|
|
|
|
|
|
?>
|
|
|
|
<html>
|
|
<head>
|
|
<meta charset="utf8" />
|
|
</head>
|
|
<body>
|
|
|
|
</body>
|
|
</html>
|