473,396 Members | 2,013 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

How to write the 3 fields on the first page of the form (entry page) to the 2nd page?

I know I can post to page 2 but the problem is I need to capture the name, email (optional), and referral source. If i post to page 2 then it simply asks for the required fields. If I do get it doesn't work at all. I'm sure there must be a relatively easy solution and I know my code has extra mess... I'm more of a coder than developer so please bear with me and just give me the code and where to insert it and I'd be most grateful!

Entry Page (page 1)
Expand|Select|Wrap|Line Numbers
  1. <?php
  2.  
  3. $deny = array("61.21.111.134", "89.149.208.14");
  4. if (in_array ($_SERVER['REMOTE_ADDR'], $deny)) {
  5.    header("location: http://www.ftc.gov/bcp/conline/edcams/spam/report.html");
  6.    exit();
  7. }
  8. // --------------------------------------------------------------
  9. // Form generated by 4rm.net Script.
  10. // You can save this form by clicking on File->Save As in your
  11. // browser menu and choose the file name ( should end with .php )
  12. // --------------------------------------------------------------
  13. // Warning: Please do not modify the PHP code of this form, unless
  14. //          you know what you do.
  15.  
  16. // Form data names and variables
  17. $FName = 'Izigg Inquiry';
  18. $FEmail = 'Support Team <mobile_media@globalvoipmobile.com>';
  19. $FSpamEmail = '';
  20. $FWebsiteAfter = 'izigg_query2.php';
  21. $FCopyToSender = 1;
  22. $FExporting = 0;
  23. $FDMode = 1;
  24. $FMesFromT = 2;
  25. $FMesName = 0;
  26. $FMesFrom = 1;
  27. $FMesSubjectT = 2;
  28. $FMesSubject = 2;
  29. $FCopyToSender = 1;
  30. $FExporting = 0;
  31. $FieldsNo = 3;
  32.  
  33. $FieldName[0] = 'First & Last Name';
  34. $FieldS[0] = 0;
  35. $FieldRequired[0] = 1;
  36.  
  37. $FieldName[1] = 'Email';
  38. $FieldType[1] = 1;
  39. $FieldS[1] = 0;
  40. $FieldRequired[1] = 0;
  41.  
  42. $FieldName[2] = 'Comments';
  43. $FieldType[2] = 2;
  44. $FieldS[2] = 0;
  45. $FieldRequired[2] = 0;
  46.  
  47.  
  48. // Error Messages
  49. $HtmlErrorStart = '<font size="2" color="#CC0808">';
  50. $HtmlErrorEnd = '</font>';
  51. $msgErrorTooLongs = ' is too long! (Max ';
  52. $msgErrorTooLonge = ' characters)';
  53. $msgErrorTooShorts = ' is too short! (Min ';
  54. $msgErrorTooShorte = ' characters)';
  55. $msgErrorFieldEmpty = ' is required.';
  56. $msgError = 'Error : ';
  57. $msgErrorBadFields = 'Some fields are empty or invalid.';
  58.  
  59. // Needed functions
  60. // --------------------------------------------------------------
  61. function checkminsize($input, $min) // Check a string size
  62. {
  63. if (strlen($input)<$min) return 0;
  64.     else return 1;
  65.  
  66. }
  67.  
  68. // --------------------------------------------------------------
  69. function checkmaxsize($input, $max) // Check a string size
  70. {
  71. if (strlen($input)>$max) return 0;
  72.     else return 1;
  73. }
  74.  
  75. // --------------------------------------------------------------
  76. function CheckTextSize($text, $min, $max, $errno, $errfieldname)
  77. {
  78. global $mmsg, $verifyok, $HtmlErrorStart, $HtmlErrorEnd, $msgErrorTooLongs, $msgErrorTooLonge, $msgErrorTooShorts, $msgErrorTooShorte, $msgErrorFieldEmpty, $mmsgt, $msgError, $msgErrorBadFields;
  79.  
  80. if (!checkminsize($text,$min)) 
  81.     {                        
  82.     $mmsg[$errno] = $HtmlErrorStart . $errfieldname . $msgErrorTooShorts . $min . $msgErrorTooShorte . $HtmlErrorEnd; 
  83.     $verifyok = 0;
  84.     }
  85. if (!checkmaxsize($text,$max)) 
  86.     {
  87.     $mmsg[$errno] = $HtmlErrorStart . $errfieldname . $msgErrorTooLongs . $max . $msgErrorTooLonge . $HtmlErrorEnd; 
  88.     $verifyok = 0;
  89.     }
  90. if ($min>0)
  91. if (!checkminsize($text,1)) 
  92.     {
  93.     $mmsg[$errno] = $HtmlErrorStart . $errfieldname . $msgErrorFieldEmpty . $HtmlErrorEnd;
  94.     $verifyok = 0;
  95.     }
  96.  
  97. if ($verifyok == 0 ) 
  98.     {
  99.     $mmsg[0] = $msgError . $msgErrorBadFields; 
  100.     $mmsgt = 1;
  101.     } 
  102.  
  103. return $verifyok;
  104.  
  105. }
  106.  
  107.  
  108. // --------------------------------------------------------------
  109. function getip() // Returns the real Ip in most cases
  110. {
  111. if (isSet($_SERVER)) {
  112.  if (isSet($_SERVER["HTTP_X_FORWARDED_FOR"])) {
  113.  $realip = $_SERVER["HTTP_X_FORWARDED_FOR"];
  114.  } elseif (isSet($_SERVER["HTTP_CLIENT_IP"])) {
  115.  $realip = $_SERVER["HTTP_CLIENT_IP"];
  116.  } else {
  117.  $realip = $_SERVER["REMOTE_ADDR"];
  118.  }
  119.  
  120. } else {
  121.  if ( getenv( 'HTTP_X_FORWARDED_FOR' ) ) {
  122.  $realip = getenv( 'HTTP_X_FORWARDED_FOR' );
  123.  } elseif ( getenv( 'HTTP_CLIENT_IP' ) ) {
  124.  $realip = getenv( 'HTTP_CLIENT_IP' );
  125.  } else {
  126.  $realip = getenv( 'REMOTE_ADDR' );
  127.  }
  128. }
  129. return $realip; 
  130. }
  131.  
  132. // Processing form
  133. // --------------------------------------------------------------
  134.  
  135. session_start();
  136.  
  137. $RealIp = getip();
  138.  
  139. if ( $_SESSION['FReferer'] == '' ) 
  140.     {
  141.     $R = @$_SERVER['HTTP_REFERER'];
  142.     if ( R != '' ) $_SESSION['FReferer'] = $R;
  143.     }
  144.  
  145. $Referer = $_SESSION['FReferer'];
  146.  
  147. // -------------------------------------------------------------------------------------
  148. function CheckEmail($email,$minsize,$maxsize,$err,$fieldname)
  149. {
  150. global $mmsg, $mmsgt, $HtmlErrorStart, $HtmlErrorEnd, $verifyok;
  151.  
  152. // check if the email string is not empty, has at least 4 chars, is smaller than 64
  153. CheckTextSize($email, $minsize, $maxsize, $err, $fieldname);
  154.  
  155. if ( ($minsize == 0 ) AND ( $email == '') ) return 0;
  156.  
  157. // check if is has a valid email format xxx@yyy.domainname
  158. if ( ! (valid_email($email)) )
  159.     {$mmsg[$err] = $HtmlErrorStart . 'Email does not appear to be valid.' . $HtmlErrorEnd; $mmsgt = 1; $verifyok = 0; return 1;}
  160.  
  161. // check if the email string contains more than 1 email
  162. if ( substr_count($FEmail, '@') > 1 ) 
  163.     {$mmsg[$err] = $HtmlErrorStart . 'Only one email is allowed' . $HtmlErrorEnd; $mmsgt = 1; $verifyok = 0;};
  164.  
  165. }
  166.  
  167. // -------------------------------------------------------------------------------------
  168.  
  169. function valid_email($email) { 
  170.   // First, we check that there's one @ symbol, and that the lengths are right 
  171.   if (!ereg("^[^@]{1,64}@[^@]{1,255}$", $email)) { 
  172.     // Email invalid because wrong number of characters in one section, or wrong number of @ symbols. 
  173.     return false; 
  174.   } 
  175.   // Split it into sections to make life easier 
  176.   $email_array = explode("@", $email); 
  177.   $local_array = explode(".", $email_array[0]); 
  178.   for ($i = 0; $i < sizeof($local_array); $i++) { 
  179.      if (!ereg("^(([A-Za-z0-9!#$%&'*+/=?^_`{|}~-][A-Za-z0-9!#$%&'*+/=?^_`{|}~\.-]{0,63})|(\"[^(\\|\")]{0,62}\"))$", $local_array[$i])) { 
  180.       return false; 
  181.     } 
  182.   }   
  183.   if (!ereg("^\[?[0-9\.]+\]?$", $email_array[1])) { // Check if domain is IP. If not, it should be valid domain name 
  184.     $domain_array = explode(".", $email_array[1]); 
  185.     if (sizeof($domain_array) < 2) { 
  186.         return false; // Not enough parts to domain 
  187.     } 
  188.     for ($i = 0; $i < sizeof($domain_array); $i++) { 
  189.       if (!ereg("^(([A-Za-z0-9][A-Za-z0-9-]{0,61}[A-Za-z0-9])|([A-Za-z0-9]+))$", $domain_array[$i])) { 
  190.         return false; 
  191.       } 
  192.     } 
  193.   } 
  194.   return true; 
  195.  
  196.  
  197. // Get form settings and fields
  198. for ($i=0;$i<$FieldsNo;$i++)
  199.     {
  200.     if ( $FieldType[$i] ==3 ) 
  201.         {
  202.         // checkbox
  203.         $FieldData[$i] = '';
  204.         $Options = explode('|', $FieldTypeExt[$i]);
  205.          $OptionsNo = count($Options);
  206.          for ($j=0;$j<$OptionsNo;$j++)
  207.             {
  208.             $fd = trim($_POST['FieldData' . $i . '-' . $j]);
  209.             $FieldData[$i] .= $fd;
  210.             if ( ($j<($OptionsNo-1)) and ( $fd !='' ) ) $FieldData[$i] .= ', ';
  211.             }
  212.         }
  213.        else $FieldData[$i] = trim($_POST['FieldData' . $i]); 
  214.     }
  215.  
  216. if ( $HTTP_POST_VARS )
  217.     {
  218.     // Basic verifications of the form submitted, check if the version is ok 
  219.     // and the fields number corsesponds
  220.  
  221.     if ($FieldsNo <> count($FieldData))
  222.         {
  223.             echo 'Error: The number of submitted data fields ( ' . count($FieldData) . ' ) does not corespond to the form ( ' . $FName . ' wich has ' . $FieldsNo . ' fields ).';
  224.             return 3;
  225.             }   
  226.  
  227.     $Hida2 = trim($_POST['hida2']);
  228.  
  229.     if ($Hida2 != '')
  230.         {
  231.             echo 'Error: Spam submission detected ).';
  232.             return 4;
  233.             }   
  234.  
  235.     $mmsgt = 0;
  236.     $verifyok = 1;
  237.  
  238.     $SpamScore = 0;
  239.     $DupFields = 0;
  240.  
  241.     $Spam = 0;
  242.  
  243.     $Hida2 = trim($_POST['hida2']);
  244.  
  245.     if ($Hida2 != '')
  246.         {
  247.               $mmsg[0] = $HtmlErrorStart . 'Error: Your submission is spam.' . $HtmlErrorEnd; 
  248.         $mmsgt = 1;
  249.         $Spam = 1;
  250.             }   
  251.  
  252.     $SpamWord = array( 'http', 'URL', 'cialis', 'viagra', 'xxx', 'valium');
  253.  
  254.     for ($i=0;$i<$FieldsNo;$i++)
  255.         if ($FieldType[$i]<6) 
  256.         {
  257.         if ($FieldRequired[$i] == 1)
  258.             {    
  259.             CheckTextSize($FieldData[$i], 1, 10000, ($i+1), $FieldName[$i]);
  260.  
  261.             if ( ($FMesFromT ==2) && ( $FMesFrom == $i ) ) CheckEmail($FieldData[$FMesFrom], 4, 64, ($i+1), $FieldName[$i]);              
  262.             }
  263.         for ($j=0;$j<Count($SpamWord);$j++)
  264.             {
  265.             $SpamNo = substr_count($FieldData[$i],$SpamWord[$j]);
  266.             $SpamScore = $SpamScore + $SpamNo;
  267.             }
  268.         for ($j=$i+1;$j<$FieldsNo;$j++)
  269.             if  ( ( ($FieldType[$i] ==1 ) or ( $FieldType[$i] ==2) ) and ( ($FieldType[$j] ==1 ) or ( $FieldType[$j] ==2) ) ) if ($FieldData[$i] != '' ) if ($FieldData[$i] == $FieldData[$j]) $DupFields = $DupFields + 1;
  270.         }
  271.  
  272.     if ($SpamScore > 10)
  273.         {
  274.               $mmsg[0] = $HtmlErrorStart . 'Error: Your submission is spam.' . $HtmlErrorEnd; 
  275.         $mmsgt = 1;
  276.         $Spam = 2;
  277.         }
  278.  
  279.     if ( $DupFields > $FieldsNo / 2)
  280.         {
  281.               $mmsg[0] = $HtmlErrorStart . 'Error: Your submission is spam.' . $HtmlErrorEnd; 
  282.         $mmsgt = 1;
  283.         $Spam = 3;
  284.         }
  285.  
  286.  
  287.  
  288.     // check for new lines in inapropiate places
  289.     // check for new lines in the From name and email
  290.     if ($FMesFromT ==2)
  291.         if (preg_match("/(%0A|%0D|\\n+|\\r+)/i",$FieldData[$FMesName] . $FieldData[$FMesFrom]))
  292.             {
  293.                   $mmsg[0] = $HtmlErrorStart . 'Error: The script has detected you as a spammer.' . $HtmlErrorEnd; 
  294.             $mmsgt = 1;
  295.             $Spam = 6;
  296.             }
  297.  
  298.     // check for new lines in the Subject
  299.     if ($FMesSubjectT ==2)
  300.         if (preg_match("/(%0A|%0D|\\n+|\\r+)/i",$FieldData[$FMesSubject]))
  301.             {
  302.                   $mmsg[0] = $HtmlErrorStart . 'Error: The script has detected you as a spammer.' . $HtmlErrorEnd; 
  303.             $mmsgt = 1;
  304.             $Spam = 7;
  305.             }
  306.  
  307.     if ( ($mmsgt !=1) or ($Spam > 0 ) )
  308.     {                       
  309.  
  310.     $mime_boundary=md5(time());
  311.  
  312.     // Prepare email
  313.     $headers = "";
  314.  
  315.     if ($Spam == 0) 
  316.         {
  317.         if ($FMesFromT ==1)            
  318.             $fromaddress = "Support Team <no-reply@globalvoipmobile.com>";
  319.                elseif ($FMesFromT ==2)
  320.                 {
  321.                 $CustomerName = $FieldData[$FMesName];
  322.                 $CustomerEmail = $FieldData[$FMesFrom];
  323.  
  324.                 $fromaddress = "$CustomerName <no-reply@Global VoIP Mobile.net>";
  325.                 }
  326.         $headers .= "From: $fromaddress\r\n";
  327.         $headers .= "Reply-To: $FieldData[$FMesName] <$FieldData[$FMesFrom]>\r\n";
  328.         }
  329.         else $headers .= "From: Global VoIP Mobile <no-reply@Global VoIP Mobile>\r\n";
  330.  
  331.     $subject = 'Feedback via the ' . $FName;
  332.  
  333.     if ($FMesSubjectT ==2)
  334.               $subject = $FName . ': ' . $FieldData[$FMesSubject];
  335.  
  336.     if ($Spam > 0) $subject = $FName . ' Spam submission detected';
  337.  
  338.     $headers .= "Message-ID: <".time()."-@blueplaza.net>\r\n";
  339.     $headers .= "X-Mailer: PHP v".phpversion()."\r\n";
  340.  
  341.     $headers .= "Content-Type: multipart/mixed; boundary=\"".$mime_boundary. '"' . "\r\n\r\n";
  342.  
  343.     $body = "--".$mime_boundary. "\r\n";
  344.  
  345.     $body .= "Content-Type: text/plain; charset=\"utf-8\"\r\n";
  346.     $body .= "Content-Transfer-Encoding: 8bit\r\n\r\n";
  347.  
  348.     if ($Spam > 0) 
  349.         {
  350.         $body .= " The following submission has been detected as spam.\r\n";
  351.         $body .= ' Spam type: ';
  352.         switch ($Spam) {
  353.             case 1 : $body .= "Bad hidden field\r\n\r\n"; break;
  354.             case 2 : $body .= "Bad words detected\r\n\r\n"; break;
  355.             case 3 : $body .= "Same data was filled in more than half fields\r\n\r\n"; break;
  356.             case 4 : $body .= "Bad or invalid captcha code\r\n\r\n"; break;
  357.             case 5 : $body .= "Unknown Ip\r\n\r\n"; break;
  358.             case 6 : $body .= "Injection attack\r\n\r\n"; break;
  359.             case 7 : $body .= "Injection attack\r\n\r\n"; break;
  360.             }
  361.         }
  362.  
  363.     for ($i=0;$i<$FieldsNo;$i++)
  364.         if ($FieldType[$i]<6) $body .= $FieldName[$i] . ': ' . $FieldData[$i] . "\r\n";
  365.     $body .= "---------------------------------------------------------------------\r\n";
  366.     $body .= 'Visitor Ip: ' . $RealIp . "\r\n";
  367.     $body .= "www.voiceprocess.net/ip-to-country.php\r\n";
  368.     if ($FExporting == 1)
  369.         {
  370.         $body .= "*** Text Database Entry ***\r\n";
  371.         for ($i=0;$i<($FieldsNo-1);$i++)
  372.             $body .= '"' . $FieldName[$i] . '",';
  373.         $body .= '"' . $FieldName[$FieldsNo-1] . '"' . "\r\n";
  374.  
  375.         for ($i=0;$i<($FieldsNo-1);$i++)
  376.             $body .= '"' . $FieldData[$i] . '",';
  377.         $body .= '"' . $FieldData[$FieldsNo-1] . '"' . "\r\n";
  378.         }
  379.  
  380.     // Adding attachments
  381.     for($i=0; $i<$FieldsNo; $i++)
  382.             if ($FieldType[$i] == 6) 
  383.             {     
  384.             $fd = 'FieldData' . $i;
  385.                   if (is_uploaded_file($_FILES["$fd"][tmp_name]))
  386.                       {         
  387.                     $handle=fopen($_FILES["$fd"][tmp_name], 'rb');
  388.                     $f_contents=fread($handle, filesize($_FILES["$fd"][tmp_name]));
  389.                     $f_contents=chunk_split(base64_encode($f_contents));    
  390.                     $f_type=filetype($_FILES["$fd"][tmp_name]);
  391.                     fclose($handle);
  392.  
  393.                 # Attachment
  394.                     $filename = $_FILES["$fd"][name]; 
  395.                 $body .= "--".$mime_boundary."\r\n";
  396.                     $body .= 'Content-Type: ' . $_FILES["$fd"][type] . '; name="' . $filename . '"' . "\r\n";  
  397.                     $body .= "Content-Transfer-Encoding: base64\r\n";
  398.                     $body .= "Content-Description: $FieldName[$i]\r\n";
  399.                     $body .= 'Content-Disposition: attachment; filename="' . $filename . '"'."\r\n\r\n";                        $body .= $f_contents."\r\n\r\n";
  400.                       }
  401.                 }
  402.  
  403.       # Finished
  404.       $body .= "--".$mime_boundary."--\r\n\r\n";  // finish with two eol's for better security. see Injection.
  405.  
  406.     if ($Spam == 0) 
  407.         {
  408.     // We try to send the email with verification code
  409.     if (mail("$FEmail", $subject, $body, $headers) )
  410.         if ( $SaveEmails == 1)
  411.         { 
  412.         // The mail has been sent succesfuly, update the email table
  413.          $query="UPDATE email SET Status='delivered', DateDelivered = NOW() WHERE EmailId='$EmailId'";
  414.          mysql_query($query) or die(mysql_error());
  415.         }
  416.         }
  417.        else if ($FSpamEmail != '') @mail("$FSpamEmail", $subject, $body, $headers);
  418.  
  419.     // If Sending a copy to visitor is checked and the field from where to get the visitor email
  420.     // address is selected we send a copy to the visitor
  421.     if ( ($FCopyToSender == 1) && ($FMesFromT ==2) AND ($Spam == 0) )
  422.         { 
  423.         $headers = "From: $FFirstName $FLastName <no-reply@globalvoipmobile.net>\r\n";
  424.         $headers = "Reply-to: $FFirstName $FLastName <$FEmail>\r\n";
  425.         $subject = 'Thank you for your Inquiry!';
  426.         if ($FMesSubjectT ==2) 
  427.         $subject .= ': ' . $FieldData[$FMesSubject];
  428.         $body = 'Hello ' . $FieldData[$FMesName] . ",\r\n";
  429.         $body .= "\r\n";
  430.         $body .= "We have received your form submission. Thank you! 
  431.         A representative will call or email you to answer any questions or 
  432.         concerns you may have once you have reviewed the website below and 
  433.         completed the form which you have hopefully completed already:
  434.         www.globalvoipmobile.com/izigg_query2.php.\r\n \r\n";
  435.         $body .= "Below is the data submitted:\r\n";
  436.         $body .= "\r\n";
  437.         for ($i=0;$i<$FieldsNo;$i++)
  438.             if ( $FieldType[$i] <6 ) $body .= $FieldName[$i] . ': ' . $FieldData[$i] . "\r\n";
  439.             $body .= "\r\n";
  440. $body .= "For more details about mobile media please visit:
  441. www.izigg.com/mobilepower
  442.  
  443. To Our Success,
  444.  
  445. Support Team
  446. \r\n";
  447.         $body .= "$FFirstName $FLastName\r\n";
  448.  
  449.         // We try to send the email with verification code
  450.         @mail("$FieldData[$FMesName] <$FieldData[$FMesFrom]>", $subject, $body, $headers);
  451.         }
  452.  
  453.     if ($Spam == 0 )
  454.         {
  455.         // Redirect visitor if form was on site, or display an message if form was in window
  456.         switch ($FDMode) {
  457.         case 0 : 
  458.         case 1 : 
  459.         case 2 : $loc = 'Location: ' . $FWebsiteAfter;
  460.              header($loc);
  461.               exit;
  462.         case 3: echo 'We received your message, thank you for contacting us.';
  463.  
  464.         }
  465.         return 0;
  466.         }
  467.     }
  468.     }
  469.  
  470. // preparing font formating
  471. $ft = '<font';
  472. $sf = 0;
  473. if ($FFontFace != '' ) { $ft .= ' face="' . $FFontFace . '"'; $sf = 1; }
  474. if ($FFontSize != '' ) { $ft .= ' size="' . $FFontSize . '"'; $sf = 1; }
  475. if ($FColor != '' ) { $ft .= ' color="' . $FColor . '"'; $sf = 1; }
  476. if ($sf == 1 ) { $ft .= '>'; $fta = '</font>'; }
  477. else {$ft = ''; $fta = ''; }
  478.  
  479.  
  480. ?>
  481.  
  482. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  483. <html xmlns="http://www.w3.org/1999/xhtml">
  484. <head>
  485. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  486. <title>Discover the Power of Mobile Media for Your Business!</title>
  487.  
  488. <link href="globalvoip.ico" rel="shortcut Icon">
  489.  
  490. <script type="text/javascript" src="izigg_a.js"></script>
  491.  
  492.  
  493. <style type="text/css">
  494. <!--
  495. .style1 {font-family: Verdana, Arial, Helvetica, sans-serif}
  496. .style2 {font-family: Verdana, Arial, Helvetica,font-size: 12px}
  497. .style3 {font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; }
  498. .style4 {color: #0000FF; Verdana, Arial, Helvetica, sans-serif; font-size: 12px;}
  499. -->
  500. .initial{
  501. background-image:url(images/submit.png); background-color: transparent; border:none; background-repeat:no-repeat; height:39px; width:99px}
  502.     input:focus {border-color: #3333CC #6666FF #6666FF #3333FF; padding-left:2px; font-size:13px; font-family:Verdana}
  503. textarea:focus {border-color: #3333CC #6666FF #6666FF #3333FF; padding-left:2px; font-size:13px; font-family:Verdana}
  504.  
  505. input {
  506.     border-style: solid;
  507.     border-width:1px;
  508. border-color: #999999 #CCCCCC #CCCCCC #999999;
  509.     text-align: left;
  510.     padding-left:2px;
  511.     font-family: Verdana;
  512.     font-size: 13px;
  513.     font-weight: normal; color:#000000; background-color:#FFFFFF}
  514.  
  515.     input disabled {
  516.     border-style: solid;
  517.     border-width:1px;
  518. border-color: #999999 #CCCCCC #CCCCCC #999999;
  519.     text-align: left;
  520.     padding-left:2px;
  521.     font-family: Verdana;
  522.     font-size: 13px;
  523.     font-weight: normal; color:#000000; background-color:#FFFFFF}
  524.  
  525.          textarea {
  526.     border-style: solid;
  527.     border-width:1px;
  528. border-color: #999999 #CCCCCC #CCCCCC #999999;
  529.     text-align: left;
  530.     padding-left:2px;
  531.     font-family: Verdana;
  532.     font-size: 13px;
  533.     font-weight: normal;}
  534. </style>
  535. <script type="text/javascript"><!--
  536.  
  537. /***********************************************
  538. * Rollover background-image button- © Dynamic Drive (www.dynamicdrive.net)
  539. * This notice must stay intact for use
  540. * Visit http://www.dynamicdrive.net/ for full source code
  541. ***********************************************/
  542.  
  543. //Specify optional button target: "_new" for new window, or name of FRAME target (ie "myframe")
  544. var buttontarget=""
  545.  
  546. function change(e, image){
  547. var el=window.event? event.srcElement: e.target
  548. if (el.tagName=="INPUT"&&el.type=="image")
  549. el.style.backgroundImage="url"+"('"+image+"')"
  550. }
  551.  
  552. //--></script>
  553. </head>
  554.  
  555. <body> <form method="post" name="validate" action="izigg_query.php" enctype="multipart/form-data" onmouseover="change(event,'images/submit1.png')" onmouseout="change(event,'images/submit.png')" onkeyup="highlight(event)" onclick="highlight(event)">
  556.   <tr>
  557.     <td width="24" background="images/topleft.png">&nbsp;</td>
  558.     <td height="24" colspan="2" background="images/topmid.png" style="background-repeat:repeat-x"></td>
  559.     <td width="24" background="images/topright.png">&nbsp;</td>
  560.   </tr>
  561.   <tr>
  562.     <td width="24" height="155" style="background-image:url(images/left.png); background-repeat:repeat-y">&nbsp;</td>
  563.     <td colspan="2" valign="top" background="images/inner.png" class="style17">
  564.  
  565.             <div align="left"><span class="style13"><span class="style18" style="padding-left:20px"><a href="#" onmouseover="Tip('Your information will be kept confidential and secure. We respect your privacy.', CLOSEBTN, false, SHADOW, true, TITLE, 'Data Security', STICKY, false, PADDING, 9, OFFSETY, 20, OPACITY, 90)" onmouseout="UnTip()"><img src="images/lock.png" width="15" height="19" border="0"></a></span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="style4">*</span><span class="style3"> = Required Fields</span></div>
  566.           <br />
  567.           <table width="734" border="0" align="center">
  568.             <tr>
  569.               <td width="485" valign="top"><table width="541" border="0" align="center" cellpadding="3" cellspacing="0">
  570.                 <tr>
  571.                   <td width="326" bgcolor="#F9F9F9"><div align="right" id="FieldData0"><span class="style13 style4">*</span><span class="style3">First &amp; Last Name</span></div></td>
  572.                   <td width="203" bgcolor="#F9F9F9"><div align="left">
  573.                     <input name="FieldData0" type="text" value="<? echo $FieldData[0] ?>" size="20" />
  574.                     <span class="class3"><? echo ' ' . $mmsg[1]; ?></span></div></td>
  575.                 </tr>
  576.                 <tr>
  577.                   <td class="style17 style1 style2"><div align="right" class="style3" id="FieldData1">Email</div>
  578.                       <div id="idmail" style="color:#CC6600; display:none; text-align:left">Please enter in a valid email. We respect your privacy. See <span class="small"><a href="javascript:openWin('privacy.html')">Privacy Page</a></span> for more details.</div></td>
  579.                   <td valign="top"><input name="FieldData1" type="text" value="<? echo $FieldData[1] ?>" size="20" /></td>
  580.                 </tr>
  581.                 <tr>
  582.                   <td class="style3"><div align="right" id="FieldData2"><span class="style13 style4">*</span>Referral Source (How'd you hear about us?) </div></td>
  583.                   <td valign="top"><input name="FieldData2" type="text" value="<? echo $FieldData[2] ?>" size="20" />
  584.                   <span class="class3"><? echo ' ' . $mmsg[1]; ?></span></td>
  585.                 </tr>
  586.                 <tr>
  587.                   <td valign="top" class="style3">After submitting this form you will be redirected to the page with further details and after reviewing can complete the short questionaire to receive a support team call or email at your convenience. <br />
  588.                     <strong class="style4">We're here to help! </strong></td>
  589.                   <td valign="top"><div align="left">
  590.                     <input name="image" type="image" class="initial" onclick="return CheckTheForm();" value="" src="images/send1.png" alt="submit" /></div></td>
  591.                 </tr>
  592.               </table></td>
  593.               <td width="19" valign="top"><img src="images/spacer.gif" alt="" width="19" height="7" /></td>
  594.               <td width="216" align="right" valign="top"><img src="images/globe.jpg" width="216" height="233" /></td>
  595.             </tr>
  596.         </table>
  597.   </td>
  598.     <td style="background-image:url(images/right.png); background-repeat:repeat-y" width="24"></td>
  599.   </tr>
  600.  
  601.   <tr>
  602.     <td width="24" height="23">&nbsp;</td>
  603.     <td colspan="2" background="images/bottom.png">&nbsp;</td>
  604.     <td width="24">&nbsp;</td>
  605.   </tr>
  606.   <tr>
  607.     <td height="23" colspan="4">&nbsp;</td>
  608.   </tr>
  609. </form>
  610. <div style="visibility:hidden"><img src="images/submit1.png" width="99" height="39" alt="over"/></div>
  611. <script type="text/javascript" src="wz_tooltip.js"></script> 
  612. </body>
  613. </html>
  614.  
Page 2 (Where the 3 fields should populate AFTER sending the mail}
Expand|Select|Wrap|Line Numbers
  1. <?php
  2.  
  3. $deny = array("61.21.111.134", "89.149.208.14");
  4. if (in_array ($_SERVER['REMOTE_ADDR'], $deny)) {
  5.    header("location: http://www.ftc.gov/bcp/conline/edcams/spam/report.html");
  6.    exit();
  7. }
  8. // --------------------------------------------------------------
  9. // Form generated by 4rm.net Script.
  10. // You can save this form by clicking on File->Save As in your
  11. // browser menu and choose the file name ( should end with .php )
  12. // --------------------------------------------------------------
  13. // Warning: Please do not modify the PHP code of this form, unless
  14. //          you know what you do.
  15.  
  16. // Form data names and variables
  17. $FName = 'Izigg Inquiry';
  18. $FEmail = 'Support Team <mobile_media@globalvoipmobile.com>';
  19. $FSpamEmail = '';
  20. $FWebsiteAfter = 'http://www.izigg.com/mobilepower';
  21. $FCopyToSender = 1;
  22. $FExporting = 0;
  23. $FDMode = 1;
  24. $FMesFromT = 2;
  25. $FMesName = 0;
  26. $FMesFrom = 1;
  27. $FMesSubjectT = 2;
  28. $FMesSubject = 2;
  29. $FCopyToSender = 1;
  30. $FExporting = 0;
  31. $FieldsNo = 13;
  32.  
  33. $FieldName[0] = 'First & Last Name';
  34. $FieldS[0] = 0;
  35. $FieldRequired[0] = 1;
  36.  
  37. $FieldName[1] = 'Email';
  38. $FieldType[1] = 1;
  39. $FieldS[1] = 0;
  40. $FieldRequired[1] = 1;
  41.  
  42. $FieldName[2] = 'Cell Phone';
  43. $FieldType[2] = 2;
  44. $FieldS[2] = 0;
  45. $FieldRequired[2] = 1;
  46.  
  47. $FieldName[3] = 'Work Phone ';
  48. $FieldType[3] = 2;
  49. $FieldS[3] = 0;
  50. $FieldRequired[3] = 1;
  51.  
  52. $FieldName[4] = 'Best Time to Reach You';
  53. $FieldType[4] = 2;
  54. $FieldS[4] = 0;
  55. $FieldRequired[4] = 1;
  56.  
  57. $FieldName[5] = 'Are you curently using mobile media?';
  58. $FieldType[5] = 2;
  59. $FieldS[5] = 0;
  60. $FieldRequired[5] = 1;
  61.  
  62. $FieldName[6] = 'Are you curently using marketing lists?';
  63. $FieldType[6] = 2;
  64. $FieldS[6] = 0;
  65. $FieldRequired[6] = 1;
  66.  
  67. $FieldName[7] = 'Business or Industry Type';
  68. $FieldType[7] = 2;
  69. $FieldS[7] = 0;
  70. $FieldRequired[7] = 1;
  71.  
  72. $FieldName[8] = 'Company Name';
  73. $FieldType[8] = 2;
  74. $FieldS[8] = 0;
  75. $FieldRequired[8] = 1;
  76.  
  77. $FieldName[9] = 'Company Website';
  78. $FieldType[9] = 2;
  79. $FieldS[9] = 0;
  80. $FieldRequired[9] = 0;
  81.  
  82. $FieldName[10] = 'Monthly Marketing Budget';
  83. $FieldType[10] = 2;
  84. $FieldS[10] = 0;
  85. $FieldRequired[10] = 1;
  86.  
  87. $FieldName[11] = 'Marketing Methods Currently Used';
  88. $FieldType[11] = 2;
  89. $FieldS[11] = 0;
  90. $FieldRequired[11] = 1;
  91.  
  92. $FieldName[12] = 'Comments';
  93. $FieldType[12] = 2;
  94. $FieldS[12] = 0;
  95. $FieldRequired[12] = 0;
  96.  
  97.  
  98.  
  99.  
  100. // Error Messages
  101. $HtmlErrorStart = '<font size="2" color="#CC0808">';
  102. $HtmlErrorEnd = '</font>';
  103. $msgErrorTooLongs = ' is too long! (Max ';
  104. $msgErrorTooLonge = ' characters)';
  105. $msgErrorTooShorts = ' is too short! (Min ';
  106. $msgErrorTooShorte = ' characters)';
  107. $msgErrorFieldEmpty = ' is required.';
  108. $msgError = 'Error : ';
  109. $msgErrorBadFields = 'Some fields are empty or invalid.';
  110.  
  111. // Needed functions
  112. // --------------------------------------------------------------
  113. function checkminsize($input, $min) // Check a string size
  114. {
  115. if (strlen($input)<$min) return 0;
  116.     else return 1;
  117.  
  118. }
  119.  
  120. // --------------------------------------------------------------
  121. function checkmaxsize($input, $max) // Check a string size
  122. {
  123. if (strlen($input)>$max) return 0;
  124.     else return 1;
  125. }
  126.  
  127. // --------------------------------------------------------------
  128. function CheckTextSize($text, $min, $max, $errno, $errfieldname)
  129. {
  130. global $mmsg, $verifyok, $HtmlErrorStart, $HtmlErrorEnd, $msgErrorTooLongs, $msgErrorTooLonge, $msgErrorTooShorts, $msgErrorTooShorte, $msgErrorFieldEmpty, $mmsgt, $msgError, $msgErrorBadFields;
  131.  
  132. if (!checkminsize($text,$min)) 
  133.     {                        
  134.     $mmsg[$errno] = $HtmlErrorStart . $errfieldname . $msgErrorTooShorts . $min . $msgErrorTooShorte . $HtmlErrorEnd; 
  135.     $verifyok = 0;
  136.     }
  137. if (!checkmaxsize($text,$max)) 
  138.     {
  139.     $mmsg[$errno] = $HtmlErrorStart . $errfieldname . $msgErrorTooLongs . $max . $msgErrorTooLonge . $HtmlErrorEnd; 
  140.     $verifyok = 0;
  141.     }
  142. if ($min>0)
  143. if (!checkminsize($text,1)) 
  144.     {
  145.     $mmsg[$errno] = $HtmlErrorStart . $errfieldname . $msgErrorFieldEmpty . $HtmlErrorEnd;
  146.     $verifyok = 0;
  147.     }
  148.  
  149. if ($verifyok == 0 ) 
  150.     {
  151.     $mmsg[0] = $msgError . $msgErrorBadFields; 
  152.     $mmsgt = 1;
  153.     } 
  154.  
  155. return $verifyok;
  156.  
  157. }
  158.  
  159.  
  160. // --------------------------------------------------------------
  161. function getip() // Returns the real Ip in most cases
  162. {
  163. if (isSet($_SERVER)) {
  164.  if (isSet($_SERVER["HTTP_X_FORWARDED_FOR"])) {
  165.  $realip = $_SERVER["HTTP_X_FORWARDED_FOR"];
  166.  } elseif (isSet($_SERVER["HTTP_CLIENT_IP"])) {
  167.  $realip = $_SERVER["HTTP_CLIENT_IP"];
  168.  } else {
  169.  $realip = $_SERVER["REMOTE_ADDR"];
  170.  }
  171.  
  172. } else {
  173.  if ( getenv( 'HTTP_X_FORWARDED_FOR' ) ) {
  174.  $realip = getenv( 'HTTP_X_FORWARDED_FOR' );
  175.  } elseif ( getenv( 'HTTP_CLIENT_IP' ) ) {
  176.  $realip = getenv( 'HTTP_CLIENT_IP' );
  177.  } else {
  178.  $realip = getenv( 'REMOTE_ADDR' );
  179.  }
  180. }
  181. return $realip; 
  182. }
  183.  
  184. // Processing form
  185. // --------------------------------------------------------------
  186.  
  187. session_start();
  188.  
  189. $RealIp = getip();
  190.  
  191. if ( $_SESSION['FReferer'] == '' ) 
  192.     {
  193.     $R = @$_SERVER['HTTP_REFERER'];
  194.     if ( R != '' ) $_SESSION['FReferer'] = $R;
  195.     }
  196.  
  197. $Referer = $_SESSION['FReferer'];
  198.  
  199. // -------------------------------------------------------------------------------------
  200. function CheckEmail($email,$minsize,$maxsize,$err,$fieldname)
  201. {
  202. global $mmsg, $mmsgt, $HtmlErrorStart, $HtmlErrorEnd, $verifyok;
  203.  
  204. // check if the email string is not empty, has at least 4 chars, is smaller than 64
  205. CheckTextSize($email, $minsize, $maxsize, $err, $fieldname);
  206.  
  207. if ( ($minsize == 0 ) AND ( $email == '') ) return 0;
  208.  
  209. // check if is has a valid email format xxx@yyy.domainname
  210. if ( ! (valid_email($email)) )
  211.     {$mmsg[$err] = $HtmlErrorStart . 'Email does not appear to be valid.' . $HtmlErrorEnd; $mmsgt = 1; $verifyok = 0; return 1;}
  212.  
  213. // check if the email string contains more than 1 email
  214. if ( substr_count($FEmail, '@') > 1 ) 
  215.     {$mmsg[$err] = $HtmlErrorStart . 'Only one email is allowed' . $HtmlErrorEnd; $mmsgt = 1; $verifyok = 0;};
  216.  
  217. }
  218.  
  219. // -------------------------------------------------------------------------------------
  220.  
  221. function valid_email($email) { 
  222.   // First, we check that there's one @ symbol, and that the lengths are right 
  223.   if (!ereg("^[^@]{1,64}@[^@]{1,255}$", $email)) { 
  224.     // Email invalid because wrong number of characters in one section, or wrong number of @ symbols. 
  225.     return false; 
  226.   } 
  227.   // Split it into sections to make life easier 
  228.   $email_array = explode("@", $email); 
  229.   $local_array = explode(".", $email_array[0]); 
  230.   for ($i = 0; $i < sizeof($local_array); $i++) { 
  231.      if (!ereg("^(([A-Za-z0-9!#$%&'*+/=?^_`{|}~-][A-Za-z0-9!#$%&'*+/=?^_`{|}~\.-]{0,63})|(\"[^(\\|\")]{0,62}\"))$", $local_array[$i])) { 
  232.       return false; 
  233.     } 
  234.   }   
  235.   if (!ereg("^\[?[0-9\.]+\]?$", $email_array[1])) { // Check if domain is IP. If not, it should be valid domain name 
  236.     $domain_array = explode(".", $email_array[1]); 
  237.     if (sizeof($domain_array) < 2) { 
  238.         return false; // Not enough parts to domain 
  239.     } 
  240.     for ($i = 0; $i < sizeof($domain_array); $i++) { 
  241.       if (!ereg("^(([A-Za-z0-9][A-Za-z0-9-]{0,61}[A-Za-z0-9])|([A-Za-z0-9]+))$", $domain_array[$i])) { 
  242.         return false; 
  243.       } 
  244.     } 
  245.   } 
  246.   return true; 
  247.  
  248.  
  249. // Get form settings and fields
  250. for ($i=0;$i<$FieldsNo;$i++)
  251.     {
  252.     if ( $FieldType[$i] ==3 ) 
  253.         {
  254.         // checkbox
  255.         $FieldData[$i] = '';
  256.         $Options = explode('|', $FieldTypeExt[$i]);
  257.          $OptionsNo = count($Options);
  258.          for ($j=0;$j<$OptionsNo;$j++)
  259.             {
  260.             $fd = trim($_POST['FieldData' . $i . '-' . $j]);
  261.             $FieldData[$i] .= $fd;
  262.             if ( ($j<($OptionsNo-1)) and ( $fd !='' ) ) $FieldData[$i] .= ', ';
  263.             }
  264.         }
  265.        else $FieldData[$i] = trim($_POST['FieldData' . $i]); 
  266.     }
  267.  
  268. if ( $HTTP_POST_VARS )
  269.     {
  270.     // Basic verifications of the form submitted, check if the version is ok 
  271.     // and the fields number corsesponds
  272.  
  273.     if ($FieldsNo <> count($FieldData))
  274.         {
  275.             echo 'Error: The number of submitted data fields ( ' . count($FieldData) . ' ) does not corespond to the form ( ' . $FName . ' wich has ' . $FieldsNo . ' fields ).';
  276.             return 3;
  277.             }   
  278.  
  279.     $Hida2 = trim($_POST['hida2']);
  280.  
  281.     if ($Hida2 != '')
  282.         {
  283.             echo 'Error: Spam submission detected ).';
  284.             return 4;
  285.             }   
  286.  
  287.     $mmsgt = 0;
  288.     $verifyok = 1;
  289.  
  290.     $SpamScore = 0;
  291.     $DupFields = 0;
  292.  
  293.     $Spam = 0;
  294.  
  295.     $Hida2 = trim($_POST['hida2']);
  296.  
  297.     if ($Hida2 != '')
  298.         {
  299.               $mmsg[0] = $HtmlErrorStart . 'Error: Your submission is spam.' . $HtmlErrorEnd; 
  300.         $mmsgt = 1;
  301.         $Spam = 1;
  302.             }   
  303.  
  304.     $SpamWord = array( 'http', 'URL', 'cialis', 'viagra', 'xxx', 'valium');
  305.  
  306.     for ($i=0;$i<$FieldsNo;$i++)
  307.         if ($FieldType[$i]<6) 
  308.         {
  309.         if ($FieldRequired[$i] == 1)
  310.             {    
  311.             CheckTextSize($FieldData[$i], 1, 10000, ($i+1), $FieldName[$i]);
  312.  
  313.             if ( ($FMesFromT ==2) && ( $FMesFrom == $i ) ) CheckEmail($FieldData[$FMesFrom], 4, 64, ($i+1), $FieldName[$i]);              
  314.             }
  315.         for ($j=0;$j<Count($SpamWord);$j++)
  316.             {
  317.             $SpamNo = substr_count($FieldData[$i],$SpamWord[$j]);
  318.             $SpamScore = $SpamScore + $SpamNo;
  319.             }
  320.         for ($j=$i+1;$j<$FieldsNo;$j++)
  321.             if  ( ( ($FieldType[$i] ==1 ) or ( $FieldType[$i] ==2) ) and ( ($FieldType[$j] ==1 ) or ( $FieldType[$j] ==2) ) ) if ($FieldData[$i] != '' ) if ($FieldData[$i] == $FieldData[$j]) $DupFields = $DupFields + 1;
  322.         }
  323.  
  324.     if ($SpamScore > 10)
  325.         {
  326.               $mmsg[0] = $HtmlErrorStart . 'Error: Your submission is spam.' . $HtmlErrorEnd; 
  327.         $mmsgt = 1;
  328.         $Spam = 2;
  329.         }
  330.  
  331.     if ( $DupFields > $FieldsNo / 2)
  332.         {
  333.               $mmsg[0] = $HtmlErrorStart . 'Error: Your submission is spam.' . $HtmlErrorEnd; 
  334.         $mmsgt = 1;
  335.         $Spam = 3;
  336.         }
  337.  
  338.  
  339.  
  340.     // check for new lines in inapropiate places
  341.     // check for new lines in the From name and email
  342.     if ($FMesFromT ==2)
  343.         if (preg_match("/(%0A|%0D|\\n+|\\r+)/i",$FieldData[$FMesName] . $FieldData[$FMesFrom]))
  344.             {
  345.                   $mmsg[0] = $HtmlErrorStart . 'Error: The script has detected you as a spammer.' . $HtmlErrorEnd; 
  346.             $mmsgt = 1;
  347.             $Spam = 6;
  348.             }
  349.  
  350.     // check for new lines in the Subject
  351.     if ($FMesSubjectT ==2)
  352.         if (preg_match("/(%0A|%0D|\\n+|\\r+)/i",$FieldData[$FMesSubject]))
  353.             {
  354.                   $mmsg[0] = $HtmlErrorStart . 'Error: The script has detected you as a spammer.' . $HtmlErrorEnd; 
  355.             $mmsgt = 1;
  356.             $Spam = 7;
  357.             }
  358.  
  359.     if ( ($mmsgt !=1) or ($Spam > 0 ) )
  360.     {                       
  361.  
  362.     $mime_boundary=md5(time());
  363.  
  364.     // Prepare email
  365.     $headers = "";
  366.  
  367.     if ($Spam == 0) 
  368.         {
  369.         if ($FMesFromT ==1)            
  370.             $fromaddress = "Support Team <no-reply@globalvoipmobile.com>";
  371.                elseif ($FMesFromT ==2)
  372.                 {
  373.                 $CustomerName = $FieldData[$FMesName];
  374.                 $CustomerEmail = $FieldData[$FMesFrom];
  375.  
  376.                 $fromaddress = "$CustomerName <no-reply@Global VoIP Mobile.net>";
  377.                 }
  378.         $headers .= "From: $fromaddress\r\n";
  379.         $headers .= "Reply-To: $FieldData[$FMesName] <$FieldData[$FMesFrom]>\r\n";
  380.         }
  381.         else $headers .= "From: Global VoIP Mobile <no-reply@Global VoIP Mobile>\r\n";
  382.  
  383.     $subject = 'Feedback via the ' . $FName;
  384.  
  385.     if ($FMesSubjectT ==2)
  386.               $subject = $FName . ': ' . $FieldData[$FMesSubject];
  387.  
  388.     if ($Spam > 0) $subject = $FName . ' Spam submission detected';
  389.  
  390.     $headers .= "Message-ID: <".time()."-@blueplaza.net>\r\n";
  391.     $headers .= "X-Mailer: PHP v".phpversion()."\r\n";
  392.  
  393.     $headers .= "Content-Type: multipart/mixed; boundary=\"".$mime_boundary. '"' . "\r\n\r\n";
  394.  
  395.     $body = "--".$mime_boundary. "\r\n";
  396.  
  397.     $body .= "Content-Type: text/plain; charset=\"utf-8\"\r\n";
  398.     $body .= "Content-Transfer-Encoding: 8bit\r\n\r\n";
  399.  
  400.     if ($Spam > 0) 
  401.         {
  402.         $body .= " The following submission has been detected as spam.\r\n";
  403.         $body .= ' Spam type: ';
  404.         switch ($Spam) {
  405.             case 1 : $body .= "Bad hidden field\r\n\r\n"; break;
  406.             case 2 : $body .= "Bad words detected\r\n\r\n"; break;
  407.             case 3 : $body .= "Same data was filled in more than half fields\r\n\r\n"; break;
  408.             case 4 : $body .= "Bad or invalid captcha code\r\n\r\n"; break;
  409.             case 5 : $body .= "Unknown Ip\r\n\r\n"; break;
  410.             case 6 : $body .= "Injection attack\r\n\r\n"; break;
  411.             case 7 : $body .= "Injection attack\r\n\r\n"; break;
  412.             }
  413.         }
  414.  
  415.     for ($i=0;$i<$FieldsNo;$i++)
  416.         if ($FieldType[$i]<6) $body .= $FieldName[$i] . ': ' . $FieldData[$i] . "\r\n";
  417.     $body .= "---------------------------------------------------------------------\r\n";
  418.     $body .= 'Visitor Ip: ' . $RealIp . "\r\n";
  419.     $body .= "www.voiceprocess.net/ip-to-country.php\r\n";
  420.     if ($FExporting == 1)
  421.         {
  422.         $body .= "*** Text Database Entry ***\r\n";
  423.         for ($i=0;$i<($FieldsNo-1);$i++)
  424.             $body .= '"' . $FieldName[$i] . '",';
  425.         $body .= '"' . $FieldName[$FieldsNo-1] . '"' . "\r\n";
  426.  
  427.         for ($i=0;$i<($FieldsNo-1);$i++)
  428.             $body .= '"' . $FieldData[$i] . '",';
  429.         $body .= '"' . $FieldData[$FieldsNo-1] . '"' . "\r\n";
  430.         }
  431.  
  432.     // Adding attachments
  433.     for($i=0; $i<$FieldsNo; $i++)
  434.             if ($FieldType[$i] == 6) 
  435.             {     
  436.             $fd = 'FieldData' . $i;
  437.                   if (is_uploaded_file($_FILES["$fd"][tmp_name]))
  438.                       {         
  439.                     $handle=fopen($_FILES["$fd"][tmp_name], 'rb');
  440.                     $f_contents=fread($handle, filesize($_FILES["$fd"][tmp_name]));
  441.                     $f_contents=chunk_split(base64_encode($f_contents));    
  442.                     $f_type=filetype($_FILES["$fd"][tmp_name]);
  443.                     fclose($handle);
  444.  
  445.                 # Attachment
  446.                     $filename = $_FILES["$fd"][name]; 
  447.                 $body .= "--".$mime_boundary."\r\n";
  448.                     $body .= 'Content-Type: ' . $_FILES["$fd"][type] . '; name="' . $filename . '"' . "\r\n";  
  449.                     $body .= "Content-Transfer-Encoding: base64\r\n";
  450.                     $body .= "Content-Description: $FieldName[$i]\r\n";
  451.                     $body .= 'Content-Disposition: attachment; filename="' . $filename . '"'."\r\n\r\n";                        $body .= $f_contents."\r\n\r\n";
  452.                       }
  453.                 }
  454.  
  455.       # Finished
  456.       $body .= "--".$mime_boundary."--\r\n\r\n";  // finish with two eol's for better security. see Injection.
  457.  
  458.     if ($Spam == 0) 
  459.         {
  460.     // We try to send the email with verification code
  461.     if (mail("$FEmail", $subject, $body, $headers) )
  462.         if ( $SaveEmails == 1)
  463.         { 
  464.         // The mail has been sent succesfuly, update the email table
  465.          $query="UPDATE email SET Status='delivered', DateDelivered = NOW() WHERE EmailId='$EmailId'";
  466.          mysql_query($query) or die(mysql_error());
  467.         }
  468.         }
  469.        else if ($FSpamEmail != '') @mail("$FSpamEmail", $subject, $body, $headers);
  470.  
  471.     // If Sending a copy to visitor is checked and the field from where to get the visitor email
  472.     // address is selected we send a copy to the visitor
  473.     if ( ($FCopyToSender == 1) && ($FMesFromT ==2) AND ($Spam == 0) )
  474.         { 
  475.         $headers = "From: $FFirstName $FLastName <no-reply@globalvoipmobile.net>\r\n";
  476.         $headers = "Reply-to: $FFirstName $FLastName <$FEmail>\r\n";
  477.         $subject = 'Thank you for your Inquiry!';
  478.         if ($FMesSubjectT ==2) 
  479.         $subject .= ': ' . $FieldData[$FMesSubject];
  480.         $body = 'Hello ' . $FieldData[$FMesName] . ",\r\n";
  481.         $body .= "\r\n";
  482.         $body .= "We have received your form submission. Thank you! 
  483.         A representative will call or email you to answer any questions or 
  484.         concerns you may have once you have reviewed the website below.\r\n \r\n";
  485.         $body .= "Below is the data submitted:\r\n";
  486.         $body .= "\r\n";
  487.         for ($i=0;$i<$FieldsNo;$i++)
  488.             if ( $FieldType[$i] <6 ) $body .= $FieldName[$i] . ': ' . $FieldData[$i] . "\r\n";
  489.             $body .= "\r\n";
  490. $body .= "For more details about mobile media please visit:
  491. www.izigg.com/mobilepower
  492.  
  493. To Our Success,
  494.  
  495. Support Team
  496. \r\n";
  497.         $body .= "$FFirstName $FLastName\r\n";
  498.  
  499.         // We try to send the email with verification code
  500.         @mail("$FieldData[$FMesName] <$FieldData[$FMesFrom]>", $subject, $body, $headers);
  501.         }
  502.  
  503.     if ($Spam == 0 )
  504.         {
  505.         // Redirect visitor if form was on site, or display an message if form was in window
  506.         switch ($FDMode) {
  507.         case 0 : 
  508.         case 1 : 
  509.         case 2 : $loc = 'Location: ' . $FWebsiteAfter;
  510.              header($loc);
  511.               exit;
  512.         case 3: echo 'We received your message, thank you for contacting us.';
  513.  
  514.         }
  515.         return 0;
  516.         }
  517.     }
  518.     }
  519.  
  520. // preparing font formating
  521. $ft = '<font';
  522. $sf = 0;
  523. if ($FFontFace != '' ) { $ft .= ' face="' . $FFontFace . '"'; $sf = 1; }
  524. if ($FFontSize != '' ) { $ft .= ' size="' . $FFontSize . '"'; $sf = 1; }
  525. if ($FColor != '' ) { $ft .= ' color="' . $FColor . '"'; $sf = 1; }
  526. if ($sf == 1 ) { $ft .= '>'; $fta = '</font>'; }
  527. else {$ft = ''; $fta = ''; }
  528.  
  529.  
  530. ?>
  531.  
  532. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  533. <html xmlns="http://www.w3.org/1999/xhtml">
  534. <head>
  535. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  536. <title>Discover the Power of Mobile Media for Your Business!</title>
  537.  
  538. <link href="globalvoip.ico" rel="shortcut Icon">
  539.  
  540. <script type="text/javascript" src="izigg.js"></script>
  541.  
  542.  
  543. <style type="text/css">
  544. <!--
  545. .style1 {font-family: Verdana, Arial, Helvetica, sans-serif}
  546. .style2 {font-family: Verdana, Arial, Helvetica,font-size: 12px}
  547. .style3 {font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; }
  548. .style4 {color: #0000FF; Verdana, Arial, Helvetica, sans-serif; font-size: 12px;}
  549. -->
  550. .initial{
  551. background-image:url(images/submit.png); background-color: transparent; border:none; background-repeat:no-repeat; height:39px; width:99px}
  552.     input:focus {border-color: #3333CC #6666FF #6666FF #3333FF; padding-left:2px; font-size:13px; font-family:Verdana}
  553. textarea:focus {border-color: #3333CC #6666FF #6666FF #3333FF; padding-left:2px; font-size:13px; font-family:Verdana}
  554.  
  555. input {
  556.     border-style: solid;
  557.     border-width:1px;
  558. border-color: #999999 #CCCCCC #CCCCCC #999999;
  559.     text-align: left;
  560.     padding-left:2px;
  561.     font-family: Verdana;
  562.     font-size: 13px;
  563.     font-weight: normal; color:#000000; background-color:#FFFFFF}
  564.  
  565.     input disabled {
  566.     border-style: solid;
  567.     border-width:1px;
  568. border-color: #999999 #CCCCCC #CCCCCC #999999;
  569.     text-align: left;
  570.     padding-left:2px;
  571.     font-family: Verdana;
  572.     font-size: 13px;
  573.     font-weight: normal; color:#000000; background-color:#FFFFFF}
  574.  
  575.          textarea {
  576.     border-style: solid;
  577.     border-width:1px;
  578. border-color: #999999 #CCCCCC #CCCCCC #999999;
  579.     text-align: left;
  580.     padding-left:2px;
  581.     font-family: Verdana;
  582.     font-size: 13px;
  583.     font-weight: normal;}
  584. </style>
  585. <script type="text/javascript"><!--
  586.  
  587. /***********************************************
  588. * Rollover background-image button- © Dynamic Drive (www.dynamicdrive.net)
  589. * This notice must stay intact for use
  590. * Visit http://www.dynamicdrive.net/ for full source code
  591. ***********************************************/
  592.  
  593. //Specify optional button target: "_new" for new window, or name of FRAME target (ie "myframe")
  594. var buttontarget=""
  595.  
  596. function change(e, image){
  597. var el=window.event? event.srcElement: e.target
  598. if (el.tagName=="INPUT"&&el.type=="image")
  599. el.style.backgroundImage="url"+"('"+image+"')"
  600. }
  601.  
  602. //--></script>
  603. </head>
  604.  
  605. <body> <form method="post" name="validate" action="izigg_query2b.php" enctype="multipart/form-data" onmouseover="change(event,'images/submit1.png')" onmouseout="change(event,'images/submit.png')" onkeyup="highlight(event)" onclick="highlight(event)">
  606.   <tr>
  607.     <td width="24" background="images/topleft.png">&nbsp;</td>
  608.     <td height="24" colspan="2" background="images/topmid.png" style="background-repeat:repeat-x"></td>
  609.     <td width="24" background="images/topright.png">&nbsp;</td>
  610.   </tr>
  611.   <tr>
  612.     <td width="24" height="155" style="background-image:url(images/left.png); background-repeat:repeat-y">&nbsp;</td>
  613.     <td colspan="2" valign="top" background="images/inner.png" class="style17">
  614.  
  615.             <div align="left"><span class="style13"><span class="style18" style="padding-left:20px"><a href="#" onmouseover="Tip('Your information will be kept confidential and secure. We respect your privacy.', CLOSEBTN, false, SHADOW, true, TITLE, 'Data Security', STICKY, false, PADDING, 9, OFFSETY, 20, OPACITY, 90)" onmouseout="UnTip()"><img src="images/lock.png" width="15" height="19" border="0"></a></span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="style4">*</span><span class="style3"> = Required Fields</span></div>
  616.           <br />
  617.           <table width="734" border="0" align="center">
  618.             <tr>
  619.               <td width="485" valign="top"><table width="541" border="0" align="center" cellpadding="3" cellspacing="0">
  620.                 <tr>
  621.                   <td bgcolor="#F9F9F9"><div align="right" id="FieldData0"><span class="style13 style4">*</span><span class="style3">First &amp; Last Name</span></div></td>
  622.                   <td bgcolor="#F9F9F9"><div align="left">
  623.                     <input name="FieldData0" type="text" value="<? echo $FieldData[0] ?>" size="20" />
  624.                   </div></td>
  625.                 </tr>
  626.                 <tr>
  627.                   <td class="style17 style1 style2"><div align="right" class="style3" id="FieldData1"><span class="style13 style4">*</span>Email</div>
  628.                       <div id="idmail" style="color:#CC6600; display:none; text-align:left">Please enter in a valid email. We respect your privacy. See <span class="small"><a href="javascript:openWin('privacy.html')">Privacy Page</a></span> for more details.</div></td>
  629.                   <td valign="top"><input name="FieldData1" type="text" value="<? echo $FieldData[1] ?>" size="20" /></td>
  630.                 </tr>
  631.  
  632.                 <tr>
  633.                   <td bgcolor="#F9F9F9" class="style17"><div align="right" class="style3" id="FieldData2"><span class="style4">*</span>Cell Phone </div></td>
  634.                   <td bgcolor="#F9F9F9"><input name="FieldData2" type="text" value="<? echo $FieldData[2] ?>" size="20" /></td>
  635.                 </tr>
  636.                 <tr>
  637.                   <td class="style17"><div align="right" class="style3" id="FieldData3">Work Phone </div></td>
  638.                   <td><input name="FieldData3" type="text" id="FieldData3" value="<? echo $FieldData[3] ?>" size="20" /></td>
  639.                 </tr>
  640.                 <tr>
  641.                   <td nowrap="nowrap" bgcolor="#F9F9F9" class="style17"><div align="right" class="style3" id="FieldData4"><span class="style4">*</span>Best Time to Reach You </div></td>
  642.                   <td bgcolor="#F9F9F9"><input name="FieldData4" type="text" value="<? echo $FieldData[4] ?>" size="20" /></td>
  643.                 </tr>
  644.                 <tr>
  645.                   <td align="left" nowrap="nowrap" id="FieldData5"><div align="right"><span class="style4">*</span><span class="style3">Are you curently using mobile media? </span></div></td>
  646.                   <td><select name="FieldData5">
  647.                     <option value="">Select</option>
  648.                     <option value="Yes">Yes</option>
  649.                     <option value="No">No</option>
  650.                                     </select>
  651.                     <div></div></td>
  652.                 </tr>
  653.                 <tr>
  654.                   <td width="326" nowrap="nowrap" bgcolor="#F9F9F9" class="style17" id="FieldData6"><div align="right"><span class="style4">*</span><span class="style3">Are you curently using marketing lists?</span></div></td>
  655.                   <td width="203" nowrap="nowrap" bgcolor="#F9F9F9" class="style15"><select name="FieldData6">
  656.                     <option value="">Select</option>
  657.                     <option value="Yes">Yes</option>
  658.                     <option value="No">No</option>
  659.                   </select></td>
  660.                 </tr>
  661.                 <tr>
  662.                   <td><div align="right" class="style3" id="FieldData7"><span class="style4">*</span>Business or Industry Type </div></td>
  663.                   <td valign="top"><input name="FieldData7" type="text" value="<? echo $FieldData[7] ?>" size="20" /></td>
  664.                 </tr>
  665.                 <tr>
  666.                   <td bgcolor="#F9F9F9"><div align="right" class="style3" id="FieldData8" ><span class="style4">*</span>Company Name </div></td>
  667.                   <td valign="top" bgcolor="#F9F9F9"><input name="FieldData8" type="text" value="<? echo $FieldData[8] ?>" size="20" /></td>
  668.                 </tr>
  669.                 <tr> 
  670.                   <td><div align="right" class="style3" id="FieldData9">Company Website </div></td>
  671.                   <td valign="top"><input name="FieldData9" type="text" value="<? echo $FieldData[9] ?>" size="20" /></td>
  672.                 </tr>
  673.                 <tr>
  674.                   <td bgcolor="#F9F9F9"><div align="right" class="style3" id="FieldData10" ><span class="style4">*</span>Monthly Marketing Budget $ </div></td>
  675.                   <td valign="top" bgcolor="#F9F9F9"><input name="FieldData10" type="text" value="<? echo $FieldData[10] ?>" size="20" /></td>
  676.                 </tr>
  677.                 <tr>
  678.                   <td valign="top"><div align="right" class="style3" id="FieldData11"><span class="style4">*</span>Marketing Methods Currently Used </div></td>
  679.                   <td valign="top"><label>
  680.                     <textarea name="FieldData11"><? echo $FieldData[11] ?></textarea>
  681.                   </label></td>
  682.                 </tr>
  683.                 <tr>
  684.                   <td valign="top" bgcolor="#F9F9F9"><div align="right" class="style3" id="FieldData12">Comments</div></td>
  685.                   <td valign="top" bgcolor="#F9F9F9"><textarea name="FieldData12"><? echo $FieldData[12] ?></textarea></td>
  686.                 </tr>
  687.                 <tr>
  688.                   <td valign="top">&nbsp;</td>
  689.                   <td valign="top"><div align="left">
  690.                     <input name="image" type="image" class="initial" onclick="return CheckTheForm();" value="" src="images/send1.png" alt="submit" />
  691.                     <br />
  692.                     <br />
  693.                     <a href="http://www.izigg.com/mobilepower" target="_blank" class="style3">Take me straight to the details and I'll fill this out after! </a><br />
  694.                   </div></td>
  695.                 </tr>
  696.               </table></td>
  697.               <td width="19" valign="top"><img src="images/spacer.gif" alt="" width="19" height="7" /></td>
  698.               <td width="216" align="right" valign="top"><img src="images/globe.jpg" width="216" height="233" /></td>
  699.             </tr>
  700.         </table>
  701.   </td>
  702.     <td style="background-image:url(images/right.png); background-repeat:repeat-y" width="24"></td>
  703.   </tr>
  704.  
  705.   <tr>
  706.     <td width="24" height="23">&nbsp;</td>
  707.     <td colspan="2" background="images/bottom.png">&nbsp;</td>
  708.     <td width="24">&nbsp;</td>
  709.   </tr>
  710.   <tr>
  711.     <td height="23" colspan="4">&nbsp;</td>
  712.   </tr>
  713. </form>
  714. <div style="visibility:hidden"><img src="images/submit1.png" width="99" height="39" alt="over"/></div>
  715. <script type="text/javascript" src="wz_tooltip.js"></script> 
  716. </body>
  717. </html>
  718.  
  719.  
Apr 18 '11 #1
5 1941
Holy shit mate, that's a lot of code! I'd love to help you, but can you perhaps highlight the code that needs to be checked? :)

Also, I don't think I understand what your problem is. Is it that you need to have your $_POST data from page 1 available on page 2?
Apr 18 '11 #2
dlite922
1,584 Expert 1GB
You pasted a whole bunch of snippets of code you found on the internet and expect us to debug it?

Write your own code, point us to the problem, we'll help.


Dan
Apr 18 '11 #3
Yes Stephan. I'm not asking for debugging. Just the basic code required to make the data write from page 1 form to page 2 form while also submitting an email from page 1. I read somewhere about an include but it wasn't very clear and didn't work. Thanks!
Apr 19 '11 #4
dlite922
1,584 Expert 1GB
My Point: Your request is very vague and that's a lot of (ugly) code to comb through. Here's how to do what you're asking

(but if you don't know PHP, you wouldn't know how to use it anyway, just like your current code)

page 1:
Expand|Select|Wrap|Line Numbers
  1. <form method='post' action='page2'>
  2. <input type='text' name='foo' value='bar'>
  3. <input type='submit' name='submit' value='go' />
  4. </form>
  5.  
page 2
Expand|Select|Wrap|Line Numbers
  1. <?php 
  2. if($_POST['submit']) {
  3. mail('to@address.abc','Subject','foo value is '.$_POST['foo'],'From: from@you.abc'); 
  4. } else {
  5.    die("Error, no post given. email not sent."); 
  6. }
  7.  
  8. echo "Value from page 1:" . $_POST['foo']; 
  9.  
Refactor your code to this. if it works, add more of the code back until you get to the issue or get to the functions that you desire.

Cheers,


DM
Apr 19 '11 #5
Well I guess this will help a developer. Thanks anyway...
Apr 20 '11 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Jishnu | last post by:
HI All, I am writing a multi page form. I am using hidden input statements to pass my variables between different pages. Now I want to provide a page whereusers can update the previous entered...
2
by: Pat Scott | last post by:
I am looking for a general purpose javascript snippet that enables me to <div> or <span> HTML to make portions of the form be hidden and then appear. The form contains about 12 sections and some...
6
by: nate | last post by:
Hello, Does anyone know where I can find an ASP server side script written in JavaScript to parse text fields from a form method='POST' using enctype='multipart/form-data'? I'd also like it to...
1
by: Andy Davis | last post by:
I have a table of agent names and address details and I would like to automate the data entry process of these records on a form. If a user selects a particular agent say, upon selection of this...
5
by: johnny | last post by:
hi all, I wonder if I could do the following task in PHP before searching for javascript which I prefer not to have in my code: I have a form to create new tables in a database and, since I...
3
by: laryten | last post by:
Hi, Is there a way to update the same web page instead of getting a new page each time we click the submit button? The simplest thing to do is to delete the current page (or go back to the...
5
by: lvroye | last post by:
I have a table of about 6000 clients which have unique client numbers. I am creating a data entry form to log contacts with the clients. I want the client information (Name, Sales Rep, phone...
26
by: pepper.gabriela | last post by:
Hello, a stupid question but... page_A.php is a page with a form. The user inserts text in four fields, then he clicks a submit button. The data goes to page_B.php: this page controls the data...
5
by: karsagarwal | last post by:
I have a bounded form and after I click the button to update/save. THe fields are still there. Is there a way to clear off the fields in the bounded form. Thanks, SA Here's the code that I...
1
by: Amanda Semijalac | last post by:
I am making a two-page form that will be used to have a classroom of people submit their information by passing around an iPad. I have 'form1.php', where a leader types their name and a class they...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.