Advertisement
Guest User

Untitled

a guest
Jun 11th, 2017
542
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 9.64 KB | None | 0 0
  1. <?php
  2.     $post = array();
  3.     foreach($_POST as $field => $value){
  4.         $post[$field] = $value;
  5.     }
  6.     if(!$post['turnoff_1'])
  7.         sendMail( $post );
  8.     else
  9.         sendFullMail( $post );
  10.    
  11.     function sendMail( $post ){
  12.         $to = 'mail@mail.com';
  13.         $subject = 'Form mail';
  14.         $message =
  15.             "Name: " . $post['name'] . " " . $post['last'] . "\n" .
  16.             "Gender: " . $post['gender'] . "\n" .
  17.             "Age: " . $post['age'] . "\n" .
  18.             "Phone: " . $post["phone_1"] . "-" . $post["phone_2"] . "-" . $post["phone_3"] . "\n" .
  19.             "Email: " . $post["mail"] . "\n" .
  20.             "Income: " . $post["income"] . "\n" .
  21.             "Zip: " . $post["zip"];
  22.         $headers = 'FROM: sender@mail.com';
  23.        
  24.         mail($to, $subject, $message, $headers);
  25.     }
  26.    
  27.     function sendFullMail( $post ){
  28.         $personal = _preparePersonalInfo($post);
  29.         $date = _prepareDateInfo($post);
  30.         $dislikes = _prepareDislikesInfo($post);
  31.        
  32.         switch($post['priority']){
  33.             case 'top':
  34.                 $priority = 'It\'s at the top of my priority list.';
  35.                 break;
  36.             case 'three':
  37.                 $priority = 'It\'s one of my top three priorities.';
  38.                 break;
  39.             case 'seven':
  40.                 $priority = 'It\'s one of my top seven priorities.';
  41.                 break;
  42.             case 'none':
  43.                 $priority = 'It\'s not one of my priorities.';
  44.                 break;
  45.         }
  46.         switch($post['feel']){
  47.             case 'excellent':
  48.                 $feel = 'Excellent, I know I need to try something new.';
  49.                 break;
  50.             case 'ok':
  51.                 $feel = 'Ok, I\'m always open to try new ideas.';
  52.                 break;
  53.             case 'uncomfortable':
  54.                 $feel = 'Little uncomfortable, something new to me.';
  55.                 break;
  56.             case 'nervous':
  57.                 $feel = 'Nervous, this process is new to me.';
  58.                 break;
  59.         }
  60.        
  61.         $to = 'mail@mail.com';
  62.         $subject = 'From mail';
  63.         $message = "
  64.                     <html>
  65.                         <head>
  66.                             <title>Send information</title>
  67.                         </head>
  68.                         <body>
  69.                             <table width="800" border="1" cellspacing="0" cellpadding="5">
  70.                               <tr>
  71.                                 <td colspan="2"><div align="center">Contact Information</div></td>
  72.                                 <td colspan="4"><div align="center">Additional Information</div></td>
  73.                               </tr>
  74.                               <tr>
  75.                                 <td width="85">Name:</td>
  76.                                 <td width="333">" . $post["name"] . " " . $post["last"] ."</td>
  77.                                 <td colspan="2">Ethnicity</td>
  78.                                 <td width="171" colspan="2">" . $post["ethnicity"] . " </td>
  79.                               </tr>
  80.                               <tr>
  81.                                 <td>Gender:</td>
  82.                                 <td>" . $post["gender"] . "</td>
  83.                                 <td colspan="2">Religion</td>
  84.                                 <td colspan="2">" . $post["religion"] . " </td>
  85.                               </tr>
  86.                               <tr>
  87.                                 <td>Phone:</td>
  88.                                 <td>" . $post["phone_1"] . "-" .$post["phone_2"] . "-" .$post["phone_3"] ."</td>
  89.                                 <td colspan="2">Work Schedule:</td>
  90.                                 <td colspan="2">" . $post["w_schedule"] . " </td>
  91.                               </tr>
  92.                               <tr>
  93.                                 <td>Email:</td>
  94.                                 <td>" . $post["mail"] . " </td>
  95.                                 <td colspan="2">Usually Available:</td>
  96.                                 <td colspan="2">" . $post["available"] . " </td>
  97.                               </tr>
  98.                               <tr>
  99.                                 <td>Income:</td>
  100.                                 <td>" . $post["income"] . "</td>
  101.                                 <td colspan="2">Marital Status:</td>
  102.                                 <td colspan="2">" . $post["m_status"] . " </td>
  103.                               </tr>
  104.                               <tr>
  105.                                 <td>Zip:</td>
  106.                                 <td>" . $post["zip"] . "</td>
  107.                                 <td colspan="2">Education:</td>
  108.                                 <td colspan="2">" . $post["education"] . "</td>
  109.                               </tr>
  110.                               <tr>
  111.                                 <td>&nbsp;</td>
  112.                                 <td>&nbsp;</td>
  113.                                 <td colspan="2">Employment Status:</td>
  114.                                 <td colspan="2">" . $post["employment"] . "</td>
  115.                               </tr>
  116.                               <tr>
  117.                                 <td>&nbsp;</td>
  118.                                 <td>&nbsp;</td>
  119.                                 <td colspan="2">Primary Social Goal:</td>
  120.                                 <td colspan="2">" . $post["goal"] . "</td>
  121.                               </tr>
  122.                               <tr>
  123.                                 <td colspan="6">&nbsp;</td>
  124.                               </tr>
  125.                               <tr>
  126.                                 <td colspan="6"><div align="center">About Yourself and Your Goals:</div></td>
  127.                               </tr>
  128.                               <tr>
  129.                                 <td colspan="2">What I'd Like to Know Before the First Date:</td>
  130.                                 <td colspan="4">" . $date . "</td>
  131.                               </tr>
  132.                               <tr>
  133.                                 <td colspan="2">Your Dislikes In the Other Person:</td>
  134.                                 <td colspan="4">" . $dislikes . "</td>
  135.                               </tr>
  136.                               <tr>
  137.                                 <td colspan="6">&nbsp;</td>
  138.                               </tr>
  139.                               <tr>
  140.                                 <td colspan="6"><div align="center">Extended Questionnaire:</div></td>
  141.                               </tr>
  142.                               <tr>
  143.                                 <td colspan="2">What Type of Priority is it to You to Meet Someone Special for a Loving Relationship?</td>
  144.                                 <td colspan="4">" . $priority . "</td>
  145.                               </tr>
  146.                               <tr>
  147.                                 <td colspan="2">Which of the Following Best Describes How You Feel About a Relationship to Further Assist You?</td>
  148.                                 <td colspan="4">" . $feel . "</td>
  149.                               </tr>
  150.                               <tr>
  151.                                 <td colspan="6">&nbsp;</td>
  152.                               </tr>
  153.                               <tr>
  154.                                 <td colspan="6"><div align="center">In Your Own Words:</div></td>
  155.                               </tr>
  156.                               <tr>
  157.                                 <td colspan="2">Length of Time at your Current Occupation?</td>
  158.                                 <td colspan="4">" . $post["l_occ"] . "</td>
  159.                               </tr>
  160.                               <tr>
  161.                                 <td colspan="2">What are the three biggest turn-offs in a potential partner?</td>
  162.                                 <td width="72">" . $post["turnoff_1"] . "\n</td>
  163.                                 <td width="77">" . $post["turnoff_2"] "\n</td>
  164.                                 <td>" . $post["turnoff_3"] . "</td>
  165.                               </tr>
  166.                               <tr>
  167.                                 <td colspan="2">How are you meeting people now?</td>
  168.                                 <td colspan="4">" . $post["h_meet"] . "</td>
  169.                               </tr>
  170.                               <tr>
  171.                                 <td colspan="2">How would you describe your ideal mate?</td>
  172.                                 <td colspan="4">" . $post["i_mate"] . "</td>
  173.                               </tr>
  174.                               <tr>
  175.                                 <td colspan="6">&nbsp;</td>
  176.                               </tr>
  177. </table>
  178.                         </body>
  179.                     </html>
  180.                    ";
  181.         $headers = "FROM: sender@mail.com\n";
  182.         $headers .= "MIME-Version: 1.0\n";
  183.         $headers .= "Content-type: text/html; charset=iso-8859-1";
  184.        
  185.         mail($to, $subject, $message, $headers);
  186.     }
  187.    
  188.     function _preparePersonalInfo( $data ){
  189.         if($data['y_area'])
  190.             $item = '<tr><td colspan="2">I am new to the area</td></tr>';
  191.         if($data['y_goals'])
  192.             $item .= '<tr><td colspan="2">I am dating someone who has different goals</td></tr>';
  193.         if($data['y_right'])
  194.             $item .= '<tr><td colspan="2">I have not been meeting the right people</td></tr>';
  195.         if($data['y_children'])
  196.             $item .= '<tr><td colspan="2">I would like to have children</td></tr>';
  197.         if($data['y_married'])
  198.             $item .= '<tr><td colspan="2">I would like to get married</td></tr>';
  199.         if($data['y_dating'])
  200.             $item .= '<tr><td colspan="2">I am not dating anyone seriously</td></tr>';
  201.         if($data['y_busy'])
  202.             $item .= '<tr><td colspan="2">I am too busy to make new contacts</td></tr>';
  203.         if($data['y_people'])
  204.             $item .= '<tr><td colspan="2">I would like to date many different people</td></tr>';
  205.         if($data['y_parent'])
  206.             $item .= '<tr><td colspan="2">I am already a parent</td></tr>';
  207.            
  208.         return $item;
  209.     }
  210.    
  211.     function _prepareDateInfo($data){
  212.         if($data['bef_hobbies'])
  213.             $item = '<tr><td colspan="2">Hobbies</td></tr>';
  214.         if($data['bef_athletics'])
  215.             $item .= '<tr><td colspan="2">Athletics interests</td></tr>';
  216.         if($data['bef_goals'])
  217.             $item .= '<tr><td colspan="2">Goals</td></tr>';
  218.         if($data['bef_religion'])
  219.             $item .= '<tr><td colspan="2">Religion</td></tr>';
  220.         if($data['bef_cultural'])
  221.             $item .= '<tr><td colspan="2">Cultural interests</td></tr>';
  222.         if($data['bef_occupation'])
  223.             $item .= '<tr><td colspan="2">Occupation</td></tr>';
  224.         if($data['bef_children'])
  225.             $item .= '<tr><td colspan="2">Wants children</td></tr>';
  226.         if($data['bef_looks'])
  227.             $item .= '<tr><td colspan="2">Looks</td></tr>';
  228.         if($data['bef_education'])
  229.             $item .= '<tr><td colspan="2">Education</td></tr>';
  230.            
  231.         return $item;
  232.     }
  233.    
  234.     function _prepareDislikesInfo($data){
  235.         if($data['dis_jelaous'])
  236.             $item = '<tr><td colspan="2">Over Jealous</td></tr>';
  237.         if($data['dis_moody'])
  238.             $item .= '<tr><td colspan="2">Moody</td></tr>';
  239.         if($data['dis_interests'])
  240.             $item .= '<tr><td colspan="2">Different interests</td></tr>';
  241.         if($data['dis_goals'])
  242.             $item .= '<tr><td colspan="2">Different goals</td></tr>';
  243.         if($data['dis_self'])
  244.             $item .= '<tr><td colspan="2">Self image</td></tr>';
  245.         if($data['dis_infidelity'])
  246.             $item .= '<tr><td colspan="2">Infidelity</td></tr>';
  247.         if($data['dis_sexual'])
  248.             $item .= '<tr><td colspan="2">Sexual incompatibility</td></tr>';
  249.         if($data['dis_commit'])
  250.             $item .= '<tr><td colspan="2">Lack of commitment</td></tr>';
  251.         if($data['dis_affec'])
  252.             $item .= '<tr><td colspan="2">Lack of affection</td></tr>';
  253.         if($data['dis_viewp'])
  254.             $item .= '<tr><td colspan="2">Parental viewpoints</td></tr>';
  255.         if($data['dis_controlling'])
  256.             $item .= '<tr><td colspan="2">Too controlling</td></tr>';
  257.         if($data['dis_inc'])
  258.             $item .= '<tr><td colspan="2">Incompatibility</td></tr>';
  259.         if($data['dis_values'])
  260.             $item .= '<tr><td colspan="2">Different values</td></tr>';
  261.         if($data['dis_child'])
  262.             $item .= '<tr><td colspan="2">Wants children</td></tr>';
  263.         if($data['dis_life'])
  264.             $item .= '<tr><td colspan="2">Different lifestyle</td></tr>';
  265.         if($data['dis_trust'])
  266.             $item .= '<tr><td colspan="2">Trust</td></tr>';
  267.         if($data['dis_manage'])
  268.             $item .= '<tr><td colspan="2">Financial management</td></tr>';
  269.         if($data['dis_religion'])
  270.             $item .= '<tr><td colspan="2">Religious difference</td></tr>';
  271.         if($data['dis_comm'])
  272.             $item .= '<tr><td colspan="2">Lack of communication</td></tr>';
  273.            
  274.         return $item;
  275.     }
  276. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement