Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /*
- *
- * Class: Email
- * Author: Mike Smit
- * Version: 0.1
- * Last edit: Thu 31 Aug 2011
- *
- * ------------------------------------------------------------------------------------------------
- *
- */
- class Email
- {
- private $_error = array();
- public function parseString($string)
- {
- if($result = $this->insertInto($this->toArray($string)))
- return $result;
- return false;
- }
- public function toArray($string)
- {
- if(strlen($string) > 0 && count($array = explode(',', $string)))
- return $array;
- return false;
- }
- public function insertInto($array)
- {
- if(is_array($array))
- {
- foreach($array as $email)
- {
- // Query
- }
- return $array;
- }
- return false;
- }
- }
- $email = new Email();
- if(isset($_POST['parse']))
- {
- if(isset($_POST['input']) && !empty($_POST['input']))
- {
- if(!$result = $email->parseString($_POST['input']))
- $result = 'It seems that something went wrong.';
- }
- }
- ?>
- <header>
- <h1>Email Snippit</h1>
- </header>
- <form action="" method="post">
- <label for="input">E-mail addresses</label>
- <input type="text" name="input" placeholder="E-mail addresses" />
- <br />
- <input type="submit" name="parse" value="Parse" />
- </form>
- <br />
- <?php
- if(isset($result))
- {
- echo '<pre>';
- print_r($result);
- echo '</pre>';
- }
- ?>
Add Comment
Please, Sign In to add comment