| Server IP : 195.130.67.5 / Your IP : 216.73.217.154 Web Server : Microsoft-IIS/10.0 System : Windows NT WEBSERVER1 10.0 build 17763 (Windows Server 2016) i586 User : IUSR ( 0) PHP Version : 7.4.19 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /Old Sites/Teachers/engineering/pkgotsis/ |
Upload File : |
<?php
$admin_email = "pkgotsis@teiser.gr";
$email_subject = "MESSAGE FROM MY WEBSITE";
$check_email = check_email_address($_REQUEST['email']);
$mime_boundary= "==Multipart_Boundary_x".md5(mt_rand())."x";
$headers = "From: $check_email\r\n" .
"MIME-Version: 1.0\r\n" .
"Content-Type: multipart/mixed; charset=utf-8;\r\n" .
" boundary=\"{$mime_boundary}\"";
$message = "Ονοματεπώνυμο:" .$_POST['author'] ."\n".
"Τηλέφωνο:" .$_POST['phone'] ."\n".
"Email:" .$_POST['email'] ."\n".
"Θέμα:" .$_POST['subject'] ."\n".
"Μήνυμα:".$_POST['comment'];
$message = "This is a multi-part message in MIME format.\n\n" .
"--{$mime_boundary}\n" .
"Content-Type: text/plain; charset=\"utf-8\"\n" .
"Content-Transfer-Encoding: 7bit\n\n" . $message . "\n\n";
function check_email_address($email) {
if (!ereg("^[^@]{1,64}@[^@]{1,255}$", $email)) {
header("Location: contact.php?status=0");
}
$email_array = explode("@", $email);
$local_array = explode(".", $email_array[0]);
for ($i = 0; $i < sizeof($local_array); $i++) {
if (!ereg("^(([A-Za-z0-9!#$%&'*+/=?^_`{|}~-][A-Za-z0-9!#$%&'*+/=?^_`{|}~\.-]{0,63})|(\"[^(\\|\")]{0,62}\"))$", $local_array[$i])) {
header("Location: contact.php?status=0");
}
}
if (!ereg("^\[?[0-9\.]+\]?$", $email_array[1])) {
$domain_array = explode(".", $email_array[1]);
if (sizeof($domain_array) < 2) {
die ("Invalid email address");
}
for ($i = 0; $i < sizeof($domain_array); $i++) {
if (!ereg("^(([A-Za-z0-9][A-Za-z0-9-]{0,61}[A-Za-z0-9])|([A-Za-z0-9]+))$", $domain_array[$i])) {
header("Location: contact.php?status=0");
}
}
}
return $email;
}
foreach($_FILES as $userfile){
$tmp_name = $userfile['tmp_name'];
$type = $userfile['type'];
$name = $userfile['name'];
$size = $userfile['size'];
if (file_exists($tmp_name)){
if(is_uploaded_file($tmp_name)){
$file = fopen($tmp_name,'rb');
$data = fread($file,filesize($tmp_name));
fclose($file);
$data = chunk_split(base64_encode($data));
}
$message .= "--{$mime_boundary}\n" .
"Content-Type: {$type};\n" .
" name=\"{$name}\"\n" .
"Content-Disposition: attachment;\n" .
" filename=\"{$fileatt_name}\"\n" .
"Content-Transfer-Encoding: base64\n\n" . $data . "\n\n";
}
}
$message.="--{$mime_boundary}--\n";
if(@mail($admin_email,$email_subject,$message,$headers)) {
header("Location: contact.php?status=1");
exit;
} else {
header("Location: contact.php?status=0");
}
?>