Advertisement
Guest User

Untitled

a guest
Jun 11th, 2017
562
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 8.26 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>
  70.                                 <caption>Contact information</caption>
  71.                                 <tr><td>Name: </td><td> " . $post["name"] . " " . $post["last"] ."</td></tr>
  72.                                 <tr><td>Gender: </td><td> " . $post["gender"] . "</td></tr>
  73.                                 <tr><td>Phone: </td><td> " . $post["phone_1"] . "-" .$post["phone_2"] . "-" .$post["phone_3"] ."</td></tr>
  74.                                 <tr><td>Email: </td><td> " . $post["mail"] . " </td></tr>
  75.                                 <tr><td>Income: </td><td> " . $post["income"] . "</td></tr>
  76.                                 <tr><td>Zip: </td><td> " . $post["zip"] . " </td></tr>
  77.                             </table>
  78.                             <table>
  79.                                 <caption>Additional profile information</caption>
  80.                                 <tr><td>Ethnicity: </td><td> " . $post["ethnicity"] . "  </td></tr>
  81.                                 <tr><td>Religion: </td><td> " . $post["religion"] . "  </td></tr>
  82.                                 <tr><td>Work Schedule: </td><td> " . $post["w_schedule"] . "  </td></tr>
  83.                                 <tr><td>Usually available: </td><td> " . $post["available"] . "  </td></tr>
  84.                                 <tr><td>Marital status: </td><td> " . $post["m_status"] . "  </td></tr>
  85.                                 <tr><td>Education: </td><td> " . $post["education"] . "  </td></tr>
  86.                                 <tr><td>Employment status: </td><td> " . $post["employment"] . "  </td></tr>
  87.                                 <tr><td>Primary Social Goal: </td><td> " . $post["goal"] . "  </td></tr>
  88.                             </table>
  89.                             <table>
  90.                                 <caption>About yourself and your goals</caption>
  91.                                 " . $personal . "
  92.                             </table>
  93.                             <table>
  94.                                 <caption>What I'd like to know before the first date</caption>
  95.                                 " . $date . "
  96.                             </table>
  97.                             <table>
  98.                                 <caption>Your dislikes in the other person</caption>
  99.                                 " . $dislikes . "
  100.                             </table>
  101.                             <table>
  102.                                 <caption>Extended questionnaire</caption>
  103.                                 <tr>
  104.                                     <td>What type of priotity is it to you meet someone special for a loving relationship?</td>
  105.                                     <td>" . $priority . "</td>
  106.                                 </tr>
  107.                                 <tr>
  108.                                     <td>Which of the following best describes how do you feel about a relationship to further assit you?</td>
  109.                                     <td>" . $feel . "</td>
  110.                                 </tr>
  111.                             </table>
  112.                             <table>
  113.                                 <caption>In your own words</caption>
  114.                                 <tr>
  115.                                     <td>Lenght of time at your current occupation?</td>
  116.                                     <td>" . $post["l_occ"] . "</td>
  117.                                 </tr>
  118.                                 <tr>
  119.                                     <td>What are the three biggest turn-offs in a potential partner?</td>
  120.                                     <td>" . $post["turnoff_1"] . "\n</td>
  121.                                     <td>" . $post["turnoff_2"] . "\n</td>
  122.                                     <td>" . $post["turnoff_3"] . "</td>
  123.                                 </tr>
  124.                                 <tr>
  125.                                     <td>How are you meeting people now?</td>
  126.                                     <td>" . $post["h_meet"] . "</td>
  127.                                 </tr>
  128.                                 <tr>
  129.                                     <td>How would you describe your ideal mate?</td>
  130.                                     <td>" . $post["i_mate"] . "</td>
  131.                                 </tr>
  132.                             </table>
  133.                         </body>
  134.                     </html>
  135.                    ";
  136.         $headers = "FROM: sender@mail.com\n";
  137.         $headers .= "MIME-Version: 1.0\n";
  138.         $headers .= "Content-type: text/html; charset=iso-8859-1";
  139.        
  140.         mail($to, $subject, $message, $headers);
  141.     }
  142.    
  143.     function _preparePersonalInfo( $data ){
  144.         if($data['y_area'])
  145.             $item = '<tr><td colspan="2">I am new to the area</td></tr>';
  146.         if($data['y_goals'])
  147.             $item .= '<tr><td colspan="2">I am dating someone who has different goals</td></tr>';
  148.         if($data['y_right'])
  149.             $item .= '<tr><td colspan="2">I have not been meeting the right people</td></tr>';
  150.         if($data['y_children'])
  151.             $item .= '<tr><td colspan="2">I would like to have children</td></tr>';
  152.         if($data['y_married'])
  153.             $item .= '<tr><td colspan="2">I would like to get married</td></tr>';
  154.         if($data['y_dating'])
  155.             $item .= '<tr><td colspan="2">I am not dating anyone seriously</td></tr>';
  156.         if($data['y_busy'])
  157.             $item .= '<tr><td colspan="2">I am too busy to make new contacts</td></tr>';
  158.         if($data['y_people'])
  159.             $item .= '<tr><td colspan="2">I would like to date many different people</td></tr>';
  160.         if($data['y_parent'])
  161.             $item .= '<tr><td colspan="2">I am already a parent</td></tr>';
  162.            
  163.         return $item;
  164.     }
  165.    
  166.     function _prepareDateInfo($data){
  167.         if($data['bef_hobbies'])
  168.             $item = '<tr><td colspan="2">Hobbies</td></tr>';
  169.         if($data['bef_athletics'])
  170.             $item .= '<tr><td colspan="2">Athletics interests</td></tr>';
  171.         if($data['bef_goals'])
  172.             $item .= '<tr><td colspan="2">Goals</td></tr>';
  173.         if($data['bef_religion'])
  174.             $item .= '<tr><td colspan="2">Religion</td></tr>';
  175.         if($data['bef_cultural'])
  176.             $item .= '<tr><td colspan="2">Cultural interests</td></tr>';
  177.         if($data['bef_occupation'])
  178.             $item .= '<tr><td colspan="2">Occupation</td></tr>';
  179.         if($data['bef_children'])
  180.             $item .= '<tr><td colspan="2">Wants children</td></tr>';
  181.         if($data['bef_looks'])
  182.             $item .= '<tr><td colspan="2">Looks</td></tr>';
  183.         if($data['bef_education'])
  184.             $item .= '<tr><td colspan="2">Education</td></tr>';
  185.            
  186.         return $item;
  187.     }
  188.    
  189.     function _prepareDislikesInfo($data){
  190.         if($data['dis_jelaous'])
  191.             $item = '<tr><td colspan="2">Over Jealous</td></tr>';
  192.         if($data['dis_moody'])
  193.             $item .= '<tr><td colspan="2">Moody</td></tr>';
  194.         if($data['dis_interests'])
  195.             $item .= '<tr><td colspan="2">Different interests</td></tr>';
  196.         if($data['dis_goals'])
  197.             $item .= '<tr><td colspan="2">Different goals</td></tr>';
  198.         if($data['dis_self'])
  199.             $item .= '<tr><td colspan="2">Self image</td></tr>';
  200.         if($data['dis_infidelity'])
  201.             $item .= '<tr><td colspan="2">Infidelity</td></tr>';
  202.         if($data['dis_sexual'])
  203.             $item .= '<tr><td colspan="2">Sexual incompatibility</td></tr>';
  204.         if($data['dis_commit'])
  205.             $item .= '<tr><td colspan="2">Lack of commitment</td></tr>';
  206.         if($data['dis_affec'])
  207.             $item .= '<tr><td colspan="2">Lack of affection</td></tr>';
  208.         if($data['dis_viewp'])
  209.             $item .= '<tr><td colspan="2">Parental viewpoints</td></tr>';
  210.         if($data['dis_controlling'])
  211.             $item .= '<tr><td colspan="2">Too controlling</td></tr>';
  212.         if($data['dis_inc'])
  213.             $item .= '<tr><td colspan="2">Incompatibility</td></tr>';
  214.         if($data['dis_values'])
  215.             $item .= '<tr><td colspan="2">Different values</td></tr>';
  216.         if($data['dis_child'])
  217.             $item .= '<tr><td colspan="2">Wants children</td></tr>';
  218.         if($data['dis_life'])
  219.             $item .= '<tr><td colspan="2">Different lifestyle</td></tr>';
  220.         if($data['dis_trust'])
  221.             $item .= '<tr><td colspan="2">Trust</td></tr>';
  222.         if($data['dis_manage'])
  223.             $item .= '<tr><td colspan="2">Financial management</td></tr>';
  224.         if($data['dis_religion'])
  225.             $item .= '<tr><td colspan="2">Religious difference</td></tr>';
  226.         if($data['dis_comm'])
  227.             $item .= '<tr><td colspan="2">Lack of communication</td></tr>';
  228.            
  229.         return $item;
  230.     }
  231. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement