Advertisement
Guest User

Untitled

a guest
Aug 25th, 2017
176
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.15 KB | None | 0 0
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: luckymancvp
  5. * Date: 3/7/17
  6. * Time: 11:38 PM
  7. */
  8.  
  9. $mailInput = isset($_POST['mailInput']) ? $_POST['mailInput'] : '';
  10. $mails = array_unique(explode(PHP_EOL, trim($mailInput)));
  11. $type = isset($_POST['type']) ? $_POST['type'] : '';
  12. $res = array();
  13. if ($type)
  14. {
  15. $mailInput = "";
  16. foreach ($mails as $mail) {
  17. if (strpos($mail, $type) !== false)
  18. $res[] = $mail;
  19. else
  20. $mailInput .= $mail . PHP_EOL;
  21. }
  22. }
  23.  
  24. $res = implode(PHP_EOL, $res);
  25.  
  26. ?>
  27.  
  28. <html>
  29. <body>
  30. <form method="post">
  31. <select name="type">
  32. <option value="@gmail.com">@gmail.com</option>
  33. <option value="comcast">comcast</option>
  34. <option value="sbcglobal">sbcglobal</option>
  35. <option value="@mail.com">@mail.com</option>
  36. <option value="@att">@att</option>
  37. </select>
  38. <br>
  39. <textarea name="mailInput" placeholder="Input" cols="50" rows="20"><?php echo $mailInput?></textarea>
  40. <br>
  41. <textarea name="res" placeholder="output" cols="50" rows="20"><?php echo $res?></textarea>
  42. <br>
  43. <input type="submit"/>
  44. </form>
  45. </body>
  46. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement