Guest User

Untitled

a guest
Oct 17th, 2017
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.50 KB | None | 0 0
  1. <?php
  2.  
  3.     /*
  4.     *
  5.     *   Class:      Accounts
  6.     *   Author:     Mike Smit
  7.     *   Version:    0.1
  8.     *   Last edit:  Thu 14 April 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.  
  42.                 return $array;     
  43.             }
  44.             return false;
  45.         }          
  46.     }
  47.  
  48.     $email = new Email();
  49.    
  50.     if(isset($_POST['parse']))
  51.     {
  52.         if(isset($_POST['input']) && !empty($_POST['input']))
  53.         {
  54.             if(!$result = $email->parseString($_POST['input']))
  55.                 $result = 'It seems that something went wrong.';
  56.         }
  57.     }
  58.    
  59. ?>
  60.  
  61. <header>
  62.     <h1>Email Snippit</h1>
  63. </header>
  64.        
  65. <form action="" method="post">
  66.     <label for="input">E-mail addresses</label>
  67.     <input type="text" name="input" placeholder="E-mail addresses" />
  68.     <br />
  69.     <input type="submit" name="parse" value="Parse" />
  70. </form>
  71.  
  72. <br />
  73.  
  74. <?php
  75.  
  76.     if(isset($result))
  77.     {
  78.         echo '<pre>';
  79.         print_r($result);
  80.         echo '</pre>';
  81.     }
  82.        
  83. ?>
Add Comment
Please, Sign In to add comment