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?