Advertisement
Guest User

Untitled

a guest
Jun 11th, 2017
534
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 9.65 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.                            
  179.                         </body>
  180.                     </html>
  181.                    ";
  182.         $headers = "FROM: sender@mail.com\n";
  183.         $headers .= "MIME-Version: 1.0\n";
  184.         $headers .= "Content-type: text/html; charset=iso-8859-1";
  185.        
  186.         mail($to, $subject, $message, $headers);
  187.     }
  188.    
  189.     function _preparePersonalInfo( $data ){
  190.         if($data['y_area'])
  191.             $item = '<tr><td colspan="2">I am new to the area</td></tr>';
  192.         if($data['y_goals'])
  193.             $item .= '<tr><td colspan="2">I am dating someone who has different goals</td></tr>';
  194.         if($data['y_right'])
  195.             $item .= '<tr><td colspan="2">I have not been meeting the right people</td></tr>';
  196.         if($data['y_children'])
  197.             $item .= '<tr><td colspan="2">I would like to have children</td></tr>';
  198.         if($data['y_married'])
  199.             $item .= '<tr><td colspan="2">I would like to get married</td></tr>';
  200.         if($data['y_dating'])
  201.             $item .= '<tr><td colspan="2">I am not dating anyone seriously</td></tr>';
  202.         if($data['y_busy'])
  203.             $item .= '<tr><td colspan="2">I am too busy to make new contacts</td></tr>';
  204.         if($data['y_people'])
  205.             $item .= '<tr><td colspan="2">I would like to date many different people</td></tr>';
  206.         if($data['y_parent'])
  207.             $item .= '<tr><td colspan="2">I am already a parent</td></tr>';
  208.            
  209.         return $item;
  210.     }
  211.    
  212.     function _prepareDateInfo($data){
  213.         if($data['bef_hobbies'])
  214.             $item = '<tr><td colspan="2">Hobbies</td></tr>';
  215.         if($data['bef_athletics'])
  216.             $item .= '<tr><td colspan="2">Athletics interests</td></tr>';
  217.         if($data['bef_goals'])
  218.             $item .= '<tr><td colspan="2">Goals</td></tr>';
  219.         if($data['bef_religion'])
  220.             $item .= '<tr><td colspan="2">Religion</td></tr>';
  221.         if($data['bef_cultural'])
  222.             $item .= '<tr><td colspan="2">Cultural interests</td></tr>';
  223.         if($data['bef_occupation'])
  224.             $item .= '<tr><td colspan="2">Occupation</td></tr>';
  225.         if($data['bef_children'])
  226.             $item .= '<tr><td colspan="2">Wants children</td></tr>';
  227.         if($data['bef_looks'])
  228.             $item .= '<tr><td colspan="2">Looks</td></tr>';
  229.         if($data['bef_education'])
  230.             $item .= '<tr><td colspan="2">Education</td></tr>';
  231.            
  232.         return $item;
  233.     }
  234.    
  235.     function _prepareDislikesInfo($data){
  236.         if($data['dis_jelaous'])
  237.             $item = '<tr><td colspan="2">Over Jealous</td></tr>';
  238.         if($data['dis_moody'])
  239.             $item .= '<tr><td colspan="2">Moody</td></tr>';
  240.         if($data['dis_interests'])
  241.             $item .= '<tr><td colspan="2">Different interests</td></tr>';
  242.         if($data['dis_goals'])
  243.             $item .= '<tr><td colspan="2">Different goals</td></tr>';
  244.         if($data['dis_self'])
  245.             $item .= '<tr><td colspan="2">Self image</td></tr>';
  246.         if($data['dis_infidelity'])
  247.             $item .= '<tr><td colspan="2">Infidelity</td></tr>';
  248.         if($data['dis_sexual'])
  249.             $item .= '<tr><td colspan="2">Sexual incompatibility</td></tr>';
  250.         if($data['dis_commit'])
  251.             $item .= '<tr><td colspan="2">Lack of commitment</td></tr>';
  252.         if($data['dis_affec'])
  253.             $item .= '<tr><td colspan="2">Lack of affection</td></tr>';
  254.         if($data['dis_viewp'])
  255.             $item .= '<tr><td colspan="2">Parental viewpoints</td></tr>';
  256.         if($data['dis_controlling'])
  257.             $item .= '<tr><td colspan="2">Too controlling</td></tr>';
  258.         if($data['dis_inc'])
  259.             $item .= '<tr><td colspan="2">Incompatibility</td></tr>';
  260.         if($data['dis_values'])
  261.             $item .= '<tr><td colspan="2">Different values</td></tr>';
  262.         if($data['dis_child'])
  263.             $item .= '<tr><td colspan="2">Wants children</td></tr>';
  264.         if($data['dis_life'])
  265.             $item .= '<tr><td colspan="2">Different lifestyle</td></tr>';
  266.         if($data['dis_trust'])
  267.             $item .= '<tr><td colspan="2">Trust</td></tr>';
  268.         if($data['dis_manage'])
  269.             $item .= '<tr><td colspan="2">Financial management</td></tr>';
  270.         if($data['dis_religion'])
  271.             $item .= '<tr><td colspan="2">Religious difference</td></tr>';
  272.         if($data['dis_comm'])
  273.             $item .= '<tr><td colspan="2">Lack of communication</td></tr>';
  274.            
  275.         return $item;
  276.     }
  277. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement