session_start(); $session = session_id(); if ($_SERVER['REMOTE_ADDR']) { $rhost = gethostbyaddr($_SERVER['REMOTE_ADDR']); $welcome = "
Welcome $rhost
"; $welcome .= "This form should be used by our customers and professionals interested to leran more about our products and services.
"; } $emailerr = ''; $log_file = "/var/tmp/contact-page.log"; $tz = "America/New_York"; date_default_timezone_set($tz); $datestr = date('r'); $response = FALSE; function response() { print <<"; //print_r($_POST); //echo ""; if (isset($_POST["from"])) { #if ((preg_match($emailpattern, $_POST['from']) === 1) && (strpos($_POST['from'],'@airkiosk')=== FALSE)) { if ((preg_match($emailpattern, $_POST['from']) === 1)) { // emailaddress is valid $response = TRUE; } else { $emailerr .= '
ERROR: The supplied e-mail address is not a valid address. Please check the e-mail address and try again. Thank you for your interest.
'; } } if (isset($_POST['security_code']) && isset($_SESSION['security_code'])) { # Vukasin 8.jan.2013. if(($_SESSION['security_code'] == $_POST['security_code']) && (!empty($_SESSION['security_code']))) { # Vukasin 8.jan.2013. $response = TRUE; }else { $emailerr .= 'ERROR: The text you entered does not match the security image you saw. Please try again.
'; $response = FALSE; } }else{ // print 'The text you entered does not match the security image you saw. Please try again.ERROR: The reCAPTCHA was not entered correctly. Go back and// try it again.' . "(reCAPTCHA said: " . $resp->error . ')
'; // $response = FALSE; // } else { // if ($response == TRUE) {$response = TRUE;} // } //} if ($response) { # response $x = ($_POST['reservations'] == 'yes') ? 'yes' : 'no'; $y = ''; if ($_POST['hear'] == 'colleague') { $y = 'a colleague or another airline'; } else if ($_POST['hear'] == 'search') { $y = 'search engine'; } else { $y = 'something else'; } $body = "Name: ".$_POST['name']."\n" ."Title: ".$_POST['title']."\n" ."Company: ".$_POST['company']."\n" ."Website: ".$_POST['webaddr']."\n" ."Remote host: ".$rhost."\n" ."Do they have a reservations system? $x.\n" ."How did they hear about Sutra? $y.\n\n" ."reCaptcha checked OK \n\n" .$_POST['body']; $to = 'sutra@airkiosk.com,niketic@airkiosk.com,nn@airkiosk.com'; //$to = 'vukasin@airkiosk.com'; $from = $_POST['from']; $subject = 'CustomerEnquiry - '.$_POST['subject']; $hlog = fopen($log_file, 'a'); fwrite($hlog, "STARTMAIL::${datestr}::${from}\n$body\nENDMAIL::${datestr}::${from}\n"); fclose($hlog); $message = fopen("/airkiosk/AKK/log/tmp/$session.mail", 'w'); fwrite($message, "$body\n"); fclose($message); $r = array(); #exec("/var/www/cgi-bin/ak/newmail $to $from $subject $body", $r); #$p = popen("/var/www/cgi-bin/ak/newmail $to $from $subject $body", 'w'); #fwrite($p, $body); #pclose($p); $headers = "From: $from"; # ini_set('display_errors',1); #$test_email = mail("kindt@airkiosk.com","Test subject","Test body"); # mail($to, $subject, $body, $headers); $datastring = shell_exec("/var/www/cgi-bin/mail-contact $session \"$from\" \"$to\" \"$subject\""); # if($test_email){ # echo "Test success"; # }else{ # echo "Test failed."; # } response(); /* $_ENV['PRINT'] = 'no'; #Read in the page this one is embedded in $r = array(); exec("php -f /var/www/html/contact.php", $r); #Don't print headers $r[0] = ''; $r[1] = ''; foreach ($r as $val) { if (strpos($val, '') !== FALSE) { response(); } else { print "$val\n"; } } */ } else { if ($rhost) { mail('sutra@airkiosk.com,niketic@airkiosk.com,nn@airkiosk.com', "CustomerEnquiry - form requested by ${_SERVER['REMOTE_ADDR']}", "Remote host: $rhost"); } $hlog = fopen($log_file, 'a'); fwrite($hlog, "FORMACCESS::${datestr}::" . $_SERVER['REMOTE_ADDR'] . "\n"); fclose($hlog); # # #