add confirmation step file
This commit is contained in:
parent
ad66d30c23
commit
d74f8ef47c
72
confirmation.php
Normal file
72
confirmation.php
Normal file
@ -0,0 +1,72 @@
|
|||||||
|
<!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 "La question a été validée"
|
||||||
|
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="utf8" />
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
Reference in New Issue
Block a user