From 7e7b77769f771ba69c0b966f3426cd9cc468c1c3 Mon Sep 17 00:00:00 2001 From: Bertrand Date: Wed, 23 May 2012 16:30:48 +0200 Subject: [PATCH] Fix issue on question.php -> Need to check email --- email.txt | 4 ++++ index.html | 2 +- questions.php | 21 +++++++-------------- 3 files changed, 12 insertions(+), 15 deletions(-) create mode 100644 email.txt diff --git a/email.txt b/email.txt new file mode 100644 index 0000000..cf86ff3 --- /dev/null +++ b/email.txt @@ -0,0 +1,4 @@ +3 +bertrand.cournaud@gmail.com +ircquizz@23.tf +ircquizz@p0m.fr diff --git a/index.html b/index.html index b09c967..8975d86 100644 --- a/index.html +++ b/index.html @@ -128,7 +128,7 @@ onclick="add()"/>

-
+

diff --git a/questions.php b/questions.php index b3bb357..d03bf23 100755 --- a/questions.php +++ b/questions.php @@ -58,26 +58,19 @@ if (isset ($_POST['send'])) // Get an email from the list - echo 'Mail of user : ' . $_POST['email']; + echo 'Mail of user : ' . $_POST['email'] . "
"; $file = fopen('email.txt', 'r'); $number = fgets($file); - while (true) + $random = rand(1, $number); + + for ($i = 0; $i < $random; $i++) { - $random = rand(1, $number); - - for ($i = 0; $i < $random; $i++) - { - $line = fgets($file); - } - - if ($line != ($_POST['email']) - { - break; - } + $line = fgets($file); } - echo 'Adresse mail: ' . $line; + + echo 'Adresse mail: ' . $line . "
"; fclose($file); /* This code works, perhaps should be placed in a method in Question class?