Guest User

Untitled

a guest
Oct 17th, 2017
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.49 KB | None | 0 0
  1. <?php
  2.  
  3.     /*
  4.     *
  5.     *   Class:      Email
  6.     *   Author:     Mike Smit
  7.     *   Version:    0.1
  8.     *   Last edit:  Wed 31 Aug 2011
  9.     *
  10.     *   ------------------------------------------------------------------------------------------------
  11.     *
  12.     */ 
  13.    
  14.     class Email
  15.     {
  16.         private $_error = array();
  17.    
  18.         public function parseString($string)
  19.         {
  20.             if($result = $this->insertInto($this->toArray($string)))
  21.                 return $result;
  22.             return false;  
  23.         }
  24.        
  25.         public function toArray($string)
  26.         {
  27.             if(strlen($string) > 0 && count($array = explode(',', $string)))
  28.                 return $array; 
  29.             return false;      
  30.         }
  31.        
  32.         public function insertInto($array)
  33.         {
  34.             if(is_array($array))
  35.             {
  36.                 foreach($array as $email)
  37.                 {
  38.                     // Query
  39.                 }      
  40.  
  41.                 return $array;     
  42.             }
  43.             return false;
  44.         }          
  45.     }
  46.  
  47.     $email = new Email();
  48.    
  49.     if(isset($_POST['parse']))
  50.     {
  51.         if(isset($_POST['input']) && !empty($_POST['input']))
  52.         {
  53.             if(!$result = $email->parseString($_POST['input']))
  54.                 $result = 'It seems that something went wrong.';
  55.         }
  56.     }
  57.    
  58. ?>
  59.  
  60. <header>
  61.     <h1>Email Snippit</h1>
  62. </header>
  63.        
  64. <form action="" method="post">
  65.     <label for="input">E-mail addresses</label>
  66.     <input type="text" name="input" placeholder="E-mail addresses" />
  67.     <br />
  68.     <input type="submit" name="parse" value="Parse" />
  69. </form>
  70.  
  71. <br />
  72.  
  73. <?php
  74.  
  75.     if(isset($result))
  76.     {
  77.         echo '<pre>';
  78.         print_r($result);
  79.         echo '</pre>';
  80.     }
  81.        
  82. ?>
Add Comment
Please, Sign In to add comment