From d74f8ef47c082d15a2586b53d28b00bcb91ce40f Mon Sep 17 00:00:00 2001 From: Bertrand Date: Wed, 23 May 2012 18:18:23 +0200 Subject: [PATCH] add confirmation step file --- confirmation.php | 72 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 confirmation.php diff --git a/confirmation.php b/confirmation.php new file mode 100644 index 0000000..2d44d37 --- /dev/null +++ b/confirmation.php @@ -0,0 +1,72 @@ + + + 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 . "
"; + 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 "; + $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" + + +?> + + + + + + + + +