include("top.php");
//fonksiyon baslar
function yukleimg($tmp,$name,$size,$name2,$upload_dir){
$size_bytes = 512000*2; // en fazla byte
$extlimit = "yes"; // yes : tanımlanmış uzantılar haricinde upload yapılamaz.
$limitedext = array(".gif",".jpg",".png",".jpeg");
$hata=0;
$msj="";
if($name2!=""){
$say = strrchr($name,'.');
$name=$name2.$say;
}
if (!is_dir("$upload_dir")) {
$hata=$hata+1;
$msj=$msj."No $upload_dir Folder.
";
}
if (!is_writeable("$upload_dir")){
$hata=$hata+1;
$msj=$msj."$upload_dir folder is not writable.
";
}
if (!is_uploaded_file($tmp)){
$hata=$hata+1;
$msj=$msj."No File.
";
}
if ($size > $size_bytes){
$hata=$hata+1;
$msj=$msj."File Bytes limit has been reached.
";
}
$ext = strrchr($name,'.');
if (($extlimit == "yes") && (!in_array(strtolower($ext),$limitedext))) {
$hata=$hata+1;
$msj=$msj."please check characters of file.
";
}
if(file_exists($upload_dir.$name)){
$hata=$hata+1;
$msj=$msj."$name is already in folder.
";
}
$name = str_replace(' ', '_', $name);
if ($hata==0){
if (move_uploaded_file($tmp,$upload_dir.$name)) {
//dosya yüklendi.
//echo("Dosya Gönderildi");
return $name;
}else{
//dosya yüklenemedi.
echo("File Transfer is failed!");
return "";
}
}else{
//hatalar var
echo($msj);
}
}
//fonksiyon bitti.
$err=""; $errmsj="";
if($_POST["_submit"]==true){
$t1=$_POST["t1"];
$t2=$_POST["t2"];
$t3=$_POST["t3"];
$t4=$_POST["t4"];
$cou=$_POST["country"];
$file_tmp = $_FILES['filetoupload']['tmp_name'];
$file_name = $_FILES['filetoupload']['name'];
$file_size = $_FILES['filetoupload']['size'];
if($t1==""){
$errmsj.="
Forgotten Name Surname.Please go back and fill in the blanks.
";
$err++;
}
if($t4==""){
$errmsj.="Forgotten Message.Please go back and fill in the blanks.
";
$err++;
}
$fname="";
if($file_name!=""){
$fname=date('YmdHis').rand(1,100);
$updir="feedbackimg/";
$nname=yukleimg($file_tmp,$file_name,$file_size,$fname,$updir);
$img="ok";
}
if($err==0){
mysql_query("INSERT INTO feedbackform (country,name,email,phone,message,date,imgpath) VALUES('$cou','$t1','$t2','$t3','$t4','".date('d.m.Y')."','$nname')");
$errmsj="Your feedback form has been sent successfully.
Thanks for your comments.";
$message="Here is the feedback form message.details :
Name : $t1
E-Mail : $t2
Country : $cou
Phone : $t3
Message : $t4
Please log in to admin area and look at the feedback form section.";
emailgonder($t2,$t1,$sitemail,"Feedback Form",$message); // email gider
}
}
?>
![]() |
Buying a property in Turkey is a big decision, look at our customers experiences and feel free to contact them for your own peace of mind about buying in Turkey. if($errmsj==""){ ?> You are welcome to add your own views and opinions about our web site }else{ ?>
|