contact dosyası
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-9" />
<title>Site İletişim Formu</title>
<style type="text/css">
<!--
.textbox {
border: 1 solid #C2C6CF;
color: #555;
font-family:Lucida Console;
font-size: 9pt;
}
.textarea {
border: 1 solid #C2C6CF;
color: #555;
font-family:Lucida Console;
font-size: 9pt;
}
.listbox {
width:100px;
font-family:Lucida Console;
color: #555;
font-size: 9pt
}
.button {
font-family:Tahoma;
font-weight:bold;
color:#444;
font-size:9pt;
border: 0;
background:#DDD;
padding:5px;
border-radius:3px;
}
.button:hover {
background:#666;
color:#FFF;
}
-->
</style>
</head>
<body>
<script language="javascript">
function kontrol(){
if(document.form1.ad_soyad.value==''){alert("isim alanını boş bıraktınız...");document.form1.ad_soyad.focus();return false;}
if(document.form1.telefon.value==''){alert("Telefon numaranızı yazmadınız...");document.form1.telefon.focus();return false;}
if((document.form1.email.value.indexOf("@"))<1){alert("Geçerli bir e-mail adresi giriniz...");document.form1.email.focus();return false;}
if((document.form1.email.value.lastIndexOf("."))-(document.form1.email.value.indexOf("@"))<2){alert("Geçerli bir e-mail adresi giriniz...");document.form1.email.focus();return false;}
if(document.form1.talep.value==''){alert("Talep konusu seçiniz...");document.form1.talep.focus();return false;}
if(document.form1.mesaj.value==''){alert("Mesajınızı giriniz...");document.form1.mesaj.focus();return false;}
if(document.form1.guvenlik.value==''){alert("Güvenlik kodunu giriniz...");document.form1.guvenlik.focus();return false;}
}
</script>
<div style="color:#515E6C; font-family:Verdana; font-size:11px;">
<form name="form1" onSubmit="return kontrol();" method="post" action="gonder.php">
<table style="background:#fbfbfb; padding:5px; border:2px solid #eee; border-radius:5px;" width="550" border="0" cellpadding="2" cellspacing="0">
<tr>
<td width="235"><strong>Ad Soyad *</strong></td>
<td width="300"><input class="textbox" name="ad_soyad" type="text" size="30" maxlength="100" /></td>
</tr>
<tr>
<td width="235"><strong>Firma Adı</strong></td>
<td><input class="textbox" name="firma" type="text" size="30" maxlength="100" /></td>
</tr>
<tr>
<td width="235"><strong>Telefon *</strong></td>
<td><input class="textbox" name="telefon" type="text" size="30" maxlength="100" /></td>
</tr>
<tr>
<td width="235"><strong>Email *</strong></td>
<td><input class="textbox" name="email" type="text" size="30" maxlength="100" /></td>
</tr>
<tr>
</tr>
<tr>
<td valign="top" width="235"><strong>Mesajınız *</strong></td>
<td><textarea class="textarea" rows="12" name="mesaj" cols="50"></textarea></td>
</tr>
<tr>
<td width="235"><strong>Güvenlik * <img src="captcha.php"></strong></td>
<td valign="bottom"><input class="textbox" name="guvenlik" type="text" size="20" maxlength="100" /></td>
</tr>
<td width="235"></td>
<td></td>
</tr>
</tr>
<td width="235"></td>
<td><input class="button" name="yolla" type="SUBMIT" value="Gönder" /> <input class="button" name="sifirla" type="RESET" value="Temizle" />
<input name="konu2" type="hidden" id="konu2" value="Site İletişim Formu" /></td>
</tr>
</tr>
<td width="235"></td>
<td>(*) İşaretli alanlar zorunludur !</td>
</tr>
</table>
</form>
</div>
</body>
</html>gonder dosyası <?php
session_start();
@setlocale(LC_ALL,"tr_TR");
header("Content-type: text/html; charset=iso-8859-9");
if ($_POST) {
$kime = "mail@mail.com"; /* <<<<<<<<Buraya formun gideceği E-Mail adresini yazmalısınız genellikle kendi sitenizin mail adresi girilir*/
$ad_soyad = $_POST['ad_soyad'];
$firma = $_POST['firma'];
$telefon = $_POST['telefon'];
$email = $_POST['email'];
$talep = $_POST['talep'];
$mesaj = $_POST['mesaj'];
$konu2 = $_POST['konu2'];
$guvenlik = $_POST['guvenlik'];
$captcha=$_SESSION["captcha"];
if ($captcha != $guvenlik) {
echo "<script>alert('Güvenlik Kodunu Yanlış Girdiniz !');</script>";
echo '<meta http-equiv="refresh" content="0;url=contact.php" />';
exit();
}
if (!$ad_soyad or !$telefon or !$email) {
$sonucyaz = '<span style="font-size:14px; color:#FF0000;">Zorunlu alanları doğru olarak doldurduğunuzdan emin olun !</span>';
}
else {
$konu2 = htmlspecialchars($konu2);
$is1_gorev_tanimi = nl2br(htmlspecialchars($is1_gorev_tanimi));
$is2_gorev_tanimi = nl2br(htmlspecialchars($is2_gorev_tanimi));
$referans = nl2br(htmlspecialchars($referans));
$Gidecek_Mesaj = "<p><strong>Gönderen: </strong>".$ad_soyad." <".$email."></p>\n";
$Gidecek_Mesaj .= "<p><strong>Konusu: </strong>".$konu2."</p>\n\n";
$Gidecek_Mesaj .= "<p><strong>Firma Adı: </strong>".$firma."</p>\n\n";
$Gidecek_Mesaj .= "<p><strong>Telefon: </strong>".$telefon."</p>\n\n";
$Gidecek_Mesaj .= "<p><strong>E-Mail: </strong>".$email."</p>\n\n";
$Gidecek_Mesaj .= "<p><strong>Talep Konusu: </strong>".$talep."</p>\n\n";
$Gidecek_Mesaj .= "<p><strong>Mesaj: </strong>".$mesaj."</p>\n\n";
$headers = "From: ".$ad_soyad." <".$email."> \n";
$headers .= "X-Sender: <".$email.">\n";
$headers .= "X-Mailer: ".$ad_soyad." \n";
$headers .= "X-Priority: 0 \n";
$headers .= "Return-Path: <".$email.">\n";
$headers .= "In-Reply-To: <".$email.">\n";
$headers .= "Reply-To: <".$email.">\n";
$headers .= "MIME-Version: 1.0\n";
$headers .= "Content-Type: text/html; charset=windows-1254\n";
$sent = mail($kime,$konu2,$Gidecek_Mesaj,$headers);
if ($sent) {
echo $sonucyaz = '<span style="font-size:14px; color:#008000;"> İletiniz başarıyla gönderilmiştir. Teşekkür ederiz ..!</span>';
}
}
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-9" />
<title>Teşekkürler !</title>
Mesajınız gönderilmiştir.
</head>
<body>
<div>
<p><strong><?php if($sonucyaz) { echo $sonucyaz; $sonucyaz = NULL; } ?></strong></p>
</div>
</body>
</html>captcha dosyası <?php
function olustur () {
$sifre = substr(sha1(rand(0,999999999999)),-6);
$sifre= str_replace(array('0', 'O', 'o', '9', 'g', 'G'), rand(1, 8), $sifre);
if ($sifre) {
session_start();
$_SESSION["captcha"] = $sifre;
$width = 130;
$height = 30;
$resim = ImageCreate($width,$height);
$x1 = rand(100,255);
$x2 = rand(100,255);
$x3 = rand(100,255);
$beyaz = ImageColorAllocate($resim,$x1, $x2, $x3);
$siyah = ImageColorAllocate($resim, 0, 0, 0);
$gray = ImageColorAllocate($resim, 210, 210, 210);
ImageFill($resim, 0, 0, $beyaz);
ImageRectangle($resim,0,0,$width-1,$height-1,$gray);
for ($i=0; $i<10; $i++) {
$x1 = rand(0,130);
$y1 = rand(0,30);
$x2 = rand(0,130);
$y2 = rand(0,30);
imageline($resim, $x1, $y1, $x2, $y2 ,$gray);
};
ImageString($resim, 5, 24, 7, $_SESSION["captcha"], $siyah);
header("Content,type: image/png");
ImagePng($resim);
ImageDestroy($resim);
}
}
olustur();
?>