File: /home/sinanpasha/public_html/gmail-sistem/iletisim-formu.php
<?php
error_reporting(0);
session_start();
ob_start();
// Formdan bilgileri $_POST ile çek.
$ad_soyad = $_POST ["ad_soyad"];
$tel = $_POST ["tel"];
$konu = $_POST ["konu"];
$aciklama = $_POST ["aciklama"];
$email_adresi = $_POST ["email_adresi"];
$mesaj = $_POST ["mesaj"];
$guvenlik_kodu = $_POST ["guvenlik_kodu"];
$uretilen_kod = $_POST ["uretilen_kod"];
?>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="bursmin.css" rel="stylesheet">
<link href='https://fonts.googleapis.com/css?family=Lato:300,400,700' rel='stylesheet' type='text/css'>
<link href='custom.css' rel='stylesheet' type='text/css'>
</head>
<body>
<div class="container">
<div class="row">
<div class="col-lg-8 col-lg-offset-2">
<form name="form1" method="post" action="">
<div class="messages"></div>
<div class="controls">
<div class="row">
<div class="col-md-6">
<div class="form-group">
<input id="ad_soyad" type="text" name="ad_soyad" class="form-control" placeholder="İsim Soyisim" required="required" data-error="Ad-Soyad Zorunlu." value="<?php echo $ad_soyad;?>">
<div class="help-block with-errors"></div>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<input id="email_adresi" type="email_adresi" name="email_adresi" class="form-control" placeholder="Email *" required="required" data-error="Valid email is required." value="<?php echo $email_adresi;?>">
<div class="help-block with-errors"></div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-6">
<div class="form-group">
<input id="tel" type="tel" name="tel" class="form-control" placeholder=" Tel" value="<?php echo $tel;?>">
<div class="help-block with-errors"></div>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<input id="konu" type="text" name="konu" id="konu" class="form-control" placeholder="Konu *" required="required" data-error="Lastname is required." value="<?php echo $konu;?>">
<div class="help-block with-errors"></div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="form-group">
<textarea id="mesaj" name="mesaj" class="form-control" placeholder="Mesaj *" rows="4" required="required" data-error="mesaj."><?php echo $mesaj;?></textarea>
<div class="help-block with-errors"></div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-8">
<p>
<div class="form-group">
<input type="text" name="guvenlik_kodu" value="" placeholder=" Güvenlik Kodu" size="23" maxlength="6">
<?php
$rastgele_kod = substr(md5(rand(1000,9999)),5,6);
echo "<span style='color:#F00;'>$rastgele_kod</span>";
?>
<input type="hidden" name="uretilen_kod" value="<?php echo $rastgele_kod;?>">
</p>
</div>
</div>
<div class="col-md-4">
<input type="submit" class="btn btn-success btn-send" name="button2" value="Gönder">
</div>
</div>
<div class="row">
<div class="col-md-6">
<p>
<?php
if ($_POST ["button2"]) {
// Butona basılmış ise kontrolleri yaptır.
if (!$guvenlik_kodu) {
echo "Güvenlik kodu giriniz";
} elseif ($guvenlik_kodu != $uretilen_kod) {
echo "HATA : Güvenlik Kodu hatalı";
} else {
// Mesajı Email Olarak gönder
include_once("smtp-email-gonder/class.phpmailer.php");
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->IsHTML(True);
$mail->SMTPSecure = "ssl";
$mail->SMTPAuth = true;
$mail->Host = "46.20.7.176";
$mail->Port = 465;
$mail->Username = "[email protected]";
$mail->Password = "metkirmizigul97";
$mail->From = "[email protected]";
$mail->Fromname = "Mesaj Formu";
$mail->AddAddress("[email protected]","Mail gönderimi");
$mail->Subject = " Mesaj Formu";
$mail->Body =
"
<table width='100%' border='0' cellspacing='5' cellpadding='5'>
<tr>
<td width='120'><strong>Ad Soyad</strong></td>
<td width='10'><strong>:</strong></td>
<td>$ad_soyad</td>
</tr>
<tr>
<td><strong>Email Adresi</strong></td>
<td><strong>:</strong></td>
<td>$email_adresi</td>
</tr>
<tr>
<td><strong>Telefon</strong></td>
<td><strong>:</strong></td>
<td>$tel</td>
</tr>
<tr>
<td><strong>Konu</strong></td>
<td><strong>:</strong></td>
<td>$konu</td>
</tr>
<tr>
<td><strong>Mesaj</strong></td>
<td><strong>:</strong></td>
<td>$mesaj</td>
</tr>
</table>
"
;
if(!$mail->Send()) {
echo '<font color="#F62217"><b>Gönderim Hatası: ' . $mail->ErrorInfo . '</b></font>';
exit;
}
echo '<center> <font color="#41A317"><b>Mesaj başarıyla gönderildi. Size en kısa zamanda dönüş saglanacaktır. </b></font> </center> ';
header( "refresh:3;url=iletisim-formu.php" );
//-----------------------------
}
//---------------------------------------------
}
?>
</p>
</form>
</form>
</div><!-- /.8 -->
</div> <!-- /.row-->
</div> <!-- /.container-->
<script src="https://code.jquery.com/jquery-1.12.0.min.js"></script>
<script src="bootstrap.min.js"></script>
<script src="validator.js"></script>
<script src="contact.js"></script>
</body>
</html>