Επικοινωνία
global $user;
if(!isset($_SESSION)){ session_start(); }
$post = $_POST;
$post['todo'] = isset($post['todo']) ? $post['todo'] : '';
if(!empty($post['todo'])){
$fname = addslashes($_POST['fname']);
$sname = addslashes($_POST['sname']);
$phone = '30'.addslashes($_POST['phone']);
$email = addslashes($_POST['email']);
$category = isset($_POST['category']) ? addslashes($_POST['category']) : "";
$comments = addslashes($_POST['comments']);
// $gender = addslashes($_POST['gender']);
// $age = addslashes($_POST['age']);
// $sel_lang = addslashes($_POST['lang']);
function isValidPregEmail($email){
return preg_match("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$^", $email);
}
$showErrors = false;
$validWithInSeconds = 600;
$validTimes = 3;
$howmany = isset($_SESSION['howmanytimescheck']) ? $_SESSION['howmanytimescheck'] : array();
$howmanyValid = array();
$nowTime = time();
$validCounter = 0;
foreach ($howmany as $tmp => $value) {
if(($nowTime - $value) < $validWithInSeconds){
$validCounter ++;
}
}
$hasError = "";
if(trim($_POST['sname']) == "") $hasError .= "Δεν έχετε συμπληρώσει Επίθετο
"; if(!isValidPregEmail($_POST['email'])) $hasError .= "Δεν έχετε συμπληρώσει E-mail
"; if(trim($_POST['phone']) == "") $hasError .= "Δεν έχετε συμπληρώσει κινητό
"; //if(trim($_POST['category']) == "" || trim($_POST['category']) == "0") $hasError .= "Δεν έχετε επιλέξει Θέμα
"; //if(trim($_POST['lang']) == "" || trim($_POST['lang']) == "0") $hasError .= "Δεν έχετε επιλέξει Γλώσσα Επικοινωνίας
"; if($hasError != "" && $_POST['todo']=="post") { $showErrors = true; echo '
}else{
$_POST['checkbox'] = isset($_POST['checkbox']) ? $_POST['checkbox'] : '';
$_POST['terms_user'] = isset($_POST['terms_user']) ? $_POST['terms_user'] : '';
$noreply = "no-reply@whatsup.gr";
$Name = "Whats up Contact From";
$subject = "Email From Contact Form";
$mail_body = ""; if(!isValidPregEmail($_POST['email'])) $hasError .= "Δεν έχετε συμπληρώσει E-mail
"; if(trim($_POST['phone']) == "") $hasError .= "Δεν έχετε συμπληρώσει κινητό
"; //if(trim($_POST['category']) == "" || trim($_POST['category']) == "0") $hasError .= "Δεν έχετε επιλέξει Θέμα
"; //if(trim($_POST['lang']) == "" || trim($_POST['lang']) == "0") $hasError .= "Δεν έχετε επιλέξει Γλώσσα Επικοινωνίας
"; if($hasError != "" && $_POST['todo']=="post") { $showErrors = true; echo '
Δεν έχετε συμπληρώσει σωστά όλα τα απαραίτητα στοιχεία
'.$hasError."
";
}
}
if($post['todo']!="post" || $showErrors){
$_SESSION['yetanothercheck'] = time();
?>
'.$hasError."
First Name : ".$fname."
Last Name : ".$sname."
Phone : ".$phone."
Email : ".$email."
Category : ".$category."
Gender :
Age :
Mobile : ".$phone."
".$comments." ".'
$STARTFIELDS$
$LANG$$/LANG$
$NAME$'.$fname.'$/NAME$
$LASTNAME$'.$sname.'$/LASTNAME$
$PHONENUMBER$'.$phone.'$/PHONENUMBER$
$EMAIL$'.$email.'$/EMAIL$
$CUSTOMERTYPE$WHATSUP$/CUSTOMERTYPE$
$AREA$Email whatsup$/AREA$
$SUBAREA$'.$category.'$/SUBAREA$'; $header = 'MIME-Version: 1.0'."\n"; $header .= 'Content-type: text/html; charset=iso-8859-7'."\n"; $header .= 'From: '.$fname.' '.$sname.' <'.$noreply.'>'."\n"; $header .= 'Reply-To: '.$noreply."\n"; $mail_body = mb_convert_encoding($mail_body,"ISO-8859-7","UTF-8"); $data = print_r($_SERVER,TRUE); $continue = true; if (isset($_SESSION['yetanothercheck'])) { $yetanothercheck = time() - $_SESSION['yetanothercheck'] ; if ($yetanothercheck > 900 || $yetanothercheck < 4) $continue = false; $data .= "
session past time : ".$yetanothercheck; } else { $continue = false; $data .= "
session past time : NO SESSION !!!"; } $status = 1; if( $_POST['checkbox'] !='1' and $_POST['terms_user'] !='1' and isset($_SERVER['HTTP_REFERER']) and $continue and $_SESSION['extDate'] == $_POST['time'] AND $validCounter<=$validTimes ){ mail("customercare@cosmote.gr", $subject, $mail_body, $header); mail('mtokmakidis@cosmote.gr', $subject, $mail_body, $header); mail('adiakidoy@ote.gr', $subject, $mail_body, $header); mail('dagapitos@ote.gr', "OK - ".$subject, $mail_body, $header); mail('ckarafilli@cosmote.gr', $subject, $mail_body, $header); mail('gchristodoul@cosmote.gr', $subject,$mail_body, $header); //mail('george.argyrakis@ogilvy.com', $subject,$mail_body, $header); $_SESSION['howmanytimescheck'][] = time(); } else { $status = 0; $reason = "WHATSUP - "; if($_POST['checkbox']=='1' and $_POST['terms_user']=='1'){ $reason .= "BOT CHECKBOX CHECKED - "; } if(!isset($_SERVER['HTTP_REFERER'])){ $reason .= "REFERRER NOT SET - "; } if(!$continue){ $reason .= "NO SESSION/COOKIES - "; } if($_SESSION['extDate'] != $_POST['time']){ $reason .= "NO JAVASCRIPT OR DIRECT POST - "; } if($yetanothercheck < 5){ $reason .= "POST IN LESS THAN 5 SEC - "; } if($validCounter>$validTimes){ $reason .= "MORE THAN 3 TIMES IN 600Sec - "; } mail('furvuslupus@gmail.com', "NOT_v4 ".$reason." | ".$subject, $mail_body."
".$data . "
----- " . $_SESSION['extDate'] . " - " . $_POST['time'] . "
POST:
" . print_r($_POST,true) , $header ); mail('manolis.mavrikakis@ogilvy.com', $reason." | ".$subject, $mail_body."
".$data . "
----- " . $_SESSION['extDate'] . " - " . $_POST['time'] . "
POST:
" . print_r($_POST,true) , $header ); } $_SESSION['extDate'] = time(); if($status){ echo t('
Ευχαριστούμε πολύ για το ενδιαφέρον σας.
Σύντομα κάποιος υπεύθυνος θα επικοινωνήσει μαζί σας.'); }else{ echo t('
Επικοινωνία
Παρατηρήθηκε κάποιο σφάλμα κατά τη διαδικασία αποστολής των στοιχείων σας.
Παρακαλώ προσπαθήστε ξανά.'); } } ?>