<?php
include("ust.php");
date_default_timezone_set('Europe/Istanbul');

## İLETİŞİM MODÜLÜ 
$m_kontrol=mysql_query("SELECT * FROM moduller WHERE modul_adi='iletisim'"); 
$getir=mysql_fetch_array($m_kontrol); 
$iletisim_mo_durum = $getir['modul_durum'];
$iletisim_mo_1 = $getir['modul_v1'];
$iletisim_mo_2 = $getir['modul_v2'];
$iletisim_mo_3 = $getir['modul_v3'];
$iletisim_mo_4 = $getir['modul_v4'];

if($iletisim_mo_durum == "acik"){
?>
	
	<section class="contact-us" style="margin-top:-40px;">
	<div class="container">
			
	<h2><?php echo $dil_v_getir['m35'];?></h2>
	<?php echo $dil_v_getir['m36'];?>
	<hr>
	
	<?php 
	## -> Yeni Mesaj Gönderme
	$islem = g('islem');
	switch($islem){
	case "mesajgonder":

	function getRealIpAddr()  
	{  
	if (!empty($_SERVER['HTTP_CLIENT_IP']))  
	{ $ip=$_SERVER['HTTP_CLIENT_IP']; }  
	elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) 
    { $ip=$_SERVER['HTTP_X_FORWARDED_FOR']; }  
	else { $ip=$_SERVER['REMOTE_ADDR']; }  
	return $ip;  
	}  
	$iletisim_ip = getRealIpAddr();
	$iletisim_adsoyad = p('iletisim_adsoyad');
	$iletisim_konu = p('iletisim_konu');
	$iletisim_mail = p('iletisim_mail');
	$iletisim_mesaj = p('iletisim_mesaj');
	$iletisim_telefon = p('iletisim_telefon');
	$iletisim_tarih = date('d.m.Y');
	$iletisim_durum = "okunmadi";
	
	
	$m_kontrol=mysql_query("SELECT * FROM genelayarlar WHERE id='1'"); 
	$getir=mysql_fetch_array($m_kontrol); 
	$geayar_mail_host = $getir['geayar_mail_host'];
	$geayar_mail_port = $getir['geayar_mail_port'];
	$geayar_cikis_mail = $getir['geayar_cikis_mail'];
	$geayar_cikis_mail_sifre = $getir['geayar_cikis_mail_sifre'];
	$geayar_iletisim_mail = $getir['geayar_iletisim_mail'];
	$geayar_siteadresi = $getir['geayar_siteadresi'];

	include 'core/mailler/class.phpmailer.php';
	$mail = new PHPMailer();
	$mail->IsSMTP();
	$mail->SMTPAuth = true;
	$mail->Host = $geayar_mail_host;
	$mail->Port = $geayar_mail_port;
	$mail->Username = $geayar_cikis_mail;
	$mail->Password = $geayar_cikis_mail_sifre;
	$mail->SetFrom(''.$geayar_cikis_mail.'', 'Yeni İletişim Formu');
	$mail->AddAddress(''.$geayar_iletisim_mail.'', 'Alıcı');
	$mail->CharSet = 'UTF-8';
	$mail->Subject = 'Yeni İletişim Formu';
	$mail->MsgHTML('
	<strong>Merhaba</strong><br>
	'.$geayar_siteadresi.' sitenizden yeni bir iletişim formu aldınız.<br>
	
	<strong>Adı Soyadı :</strong> '.$iletisim_adsoyad.'<br>
	<strong>Telefon Numarası:</strong> '.$iletisim_telefon.'<br>
	<strong>Mail Adresi:</strong> '.$iletisim_mail.'<br>
	<strong>Gönderme Tarihi:</strong> '.$iletisim_tarih.'<br><br>
	<strong>Konu:</strong> '.$iletisim_konu.'<br>
	<strong>Mesaj:</strong> '.$iletisim_mesaj.'<br>
	
	');
	$mail->Send();
	
	$ekle_veri = mysql_query("INSERT INTO iletisim (iletisim_ip,iletisim_adsoyad,iletisim_konu,iletisim_mail,iletisim_mesaj,iletisim_telefon,iletisim_tarih,iletisim_durum)VALUES('$iletisim_ip','$iletisim_adsoyad','$iletisim_konu','$iletisim_mail','$iletisim_mesaj','$iletisim_telefon','$iletisim_tarih','$iletisim_durum')");

	if($ekle_veri){echo '<meta http-equiv="refresh" content="0;URL=iletisim/?durum=basarili"> '; }
	else{ echo '<meta http-equiv="refresh" content="0;URL=iletisim/?durum=hata"> '; }
	break;
	}
	## -> Yeni Mesaj Gönderme
	
	$durum = g("durum");
	if($durum == "basarili"){
	?>	
	<div class="alert alert-success" role="alert">
	<strong><i class="fa fa-check-circle"></i></strong> <?php echo $dil_v_getir['m48'];?>
	</div>
	<?php } ?>
	
	<div class="row">
	
	<?php if($iletisim_mo_3 == "evet"){ ?>
	<div class="col-lg-7 col-md-7 col-12">
	
	<div class="contact-form-area m-top-30">
	<h4> <?php echo $dil_v_getir['m41'];?></h4>
	<form class="form" method="post" action="iletisim/?islem=mesajgonder">
	<div class="row">
	
	<div class="col-lg-6 col-md-6 col-12">
	<div class="form-group">
	<div class="icon"><i class="fa fa-user"></i></div>
	<input type="text" name="iletisim_adsoyad" placeholder="<?php echo $dil_v_getir['m42'];?>" required="required">
	</div>
	</div>
								
	<div class="col-lg-6 col-md-6 col-12">
	<div class="form-group">
	<div class="icon"><i class="fa fa-phone"></i></div>
	<input type="text" name="iletisim_telefon" placeholder="<?php echo $dil_v_getir['m43'];?>" required="required">
	</div>
	</div>
	
	<div class="col-lg-6 col-md-6 col-12">
	<div class="form-group">
	<div class="icon"><i class="fa fa-envelope"></i></div>
	<input type="email" name="iletisim_mail" placeholder="<?php echo $dil_v_getir['m44'];?>" required="required">
	</div>
	</div>
	
	<div class="col-lg-6 col-md-6 col-12">
	<div class="form-group">
	<div class="icon"><i class="fa fa-tag"></i></div>
	<input type="text" name="iletisim_konu" placeholder="<?php echo $dil_v_getir['m45'];?>" required="required">
	</div>
	</div>
	
	<div class="col-12">
	<div class="form-group textarea">
	<div class="icon"><i class="fa fa-pencil"></i></div>
	<textarea type="textarea" name="iletisim_mesaj" rows="5" placeholder="<?php echo $dil_v_getir['m46'];?>" required="required"></textarea>
	</div>
	</div>
							
	<div class="col-12">
	<div class="form-group button">
	<button type="submit" class="bizwheel-btn theme-2"><?php echo $dil_v_getir['m47'];?></button>
	</div>
	</div>
									
	</div>
	</form>
	</div>
	</div>
	<?php } ?>
	
	<?php if($iletisim_mo_4 == "evet"){ ?>
	<div class="col-lg-5 col-md-5 col-12">
	<div class="contact-box-main m-top-30">
	<div class="contact-title">
	<h2><?php echo $dil_v_getir['m37'];?></h2>
	<p><?php echo $dil_v_getir['m38'];?></p>
	</div>
	
					
	<div class="single-contact-box">
	<div class="c-icon"><i class="fa fa-phone"></i></div>
	<div class="c-text">
	<h4><?php echo $dil_v_getir['m39'];?></h4>
	<p><?php echo $geayar_telefon;?></p>
	</div>
	</div>
					
	<div class="single-contact-box">
	<div class="c-icon"><i class="fa fa-envelope-o"></i></div>
	<div class="c-text">
	<h4><?php echo $dil_v_getir['m40'];?></h4>
	<p><?php echo $geayar_mail;?></p>
	</div>
	</div>
	
	<div class="single-contact-box">
	<div class="c-icon"><i class="fa fa-map-marker"></i></div>
	<div class="c-text">
	<h4><?php echo $dil_v_getir['m58'];?></h4>
	<p><?php echo $geayar_adres;?></p>
	</div>
	</div>
	
	
	</div>
	</div>
	<?php } ?>
	
	
	</div>
	
	
	
	</div>
	
	
	</section>	
	
	<?php if($iletisim_mo_1 == "evet"){ ?>
	<iframe src='<?php echo $iletisim_mo_2;?>' style='width:100%;height:450px;' frameborder='0' style='border:0;' allowfullscreen='' aria-hidden='false' tabindex='0'></iframe>
	<?php } ?>
		
<?php
include("alt.php"); }else{echo '<meta http-equiv="refresh" content="0;URL=anasayfa/">';} ## -> Anasayfaya gönder
?>		