![]() |
Ücretsiz Hosting için tıklayınız
|
|
#1
|
||||
|
||||
|
Merhaba,
şimdi bir talep/destek formumuz olduğunu düşünelim: Örnek: http://dosya.sayfa.net/talepformu/talep.php 1- talep.php Kod:
<!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>Talep Formu</title>
</head>
<script language="javascript">
function kontrol(){
bolum = document.form1;
if (bolum.isim.value == "" || bolum.email.value == "" || bolum.telefon.value == "" || bolum.konu.value == "" || bolum.talep_kod.value == ""){
alert("Lütfen formu tam doldurunuz");
return false;
} else{
bolum.action = "talep_gonder.php";
}
}
</script>
<body>
<form id="form1" name="form1" method="post" action="" onsubmit="return kontrol();">
<h3>Talep / Destek Formu </h3>
<table width="500" border="1">
<tr>
<td width="151">Adınız Soyadınız </td>
<td width="333"><input name="isim" type="text" id="isim" /></td>
</tr>
<tr>
<td>Email Adresiniz </td>
<td><input name="email" type="text" id="email" /></td>
</tr>
<tr>
<td>Konu</td>
<td><input name="konu" type="text" id="konu" /></td>
</tr>
<tr>
<td>Telefonunuz</td>
<td><input name="telefon" type="text" id="telefon" /></td>
</tr>
<tr>
<td>Mesajınız</td>
<td><textarea name="mesaj" cols="35" rows="6" id="mesaj"></textarea></td>
</tr>
<tr>
<td>Güvenli Kod </td>
<td><input name="talep_kod" type="text" id="talep_kod" size="3" />
<strong><img src="talep_guvenlik.php?width=80&height=30&characters=4" alt="Güvenlik Kodu" /></strong></td>
</tr>
</table>
<p> </p>
<p>
<input type="submit" name="Submit" value="Formu Gönder" />
</p>
</form>
</body>
</html>
2- talep_guvenlik.php Kod:
<?php
session_start();
/*
* File: CaptchaSecurityImages.php
* Author: Simon Jarvis
* Copyright: 2006 Simon Jarvis
* Date: 03/08/06
* Updated: 07/02/07
* Requirements: PHP 4/5 with GD and FreeType libraries
* Link: http://www.white-hat-web-design.co.uk/articles/php-captcha.php
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details:
* http://www.gnu.org/licenses/gpl.html
*
*/
class CaptchaSecurityImages {
var $font = 'talep_monofont.ttf';
function generateCode($characters) {
/* list all possible characters, similar looking characters and vowels have been removed */
$possible = '23456789bcdfghjkmnpqrstvwxyz';
$code = '';
$i = 0;
while ($i < $characters) {
$code .= substr($possible, mt_rand(0, strlen($possible)-1), 1);
$i++;
}
return $code;
}
function CaptchaSecurityImages($width='120',$height='40',$characters='6') {
$code = $this->generateCode($characters);
/* font size will be 75% of the image height */
$font_size = $height * 0.75;
$image = imagecreate($width, $height) or die('Cannot initialize new GD image stream');
/* set the colours */
$background_color = imagecolorallocate($image, 255, 255, 255);
$text_color = imagecolorallocate($image, 20, 40, 100);
$noise_color = imagecolorallocate($image, 100, 120, 180);
/* generate random dots in background */
for( $i=0; $i<($width*$height)/6; $i++ ) {
imagefilledellipse($image, mt_rand(0,$width), mt_rand(0,$height), 1, 1, $noise_color);
}
/* generate random lines in background */
for( $i=0; $i<($width*$height)/150; $i++ ) {
# imageline($image, mt_rand(0,$width), mt_rand(0,$height), mt_rand(0,$width), mt_rand(0,$height), $noise_color);
}
/* create textbox and add text */
$textbox = imagettfbbox($font_size, 0, $this->font, $code) or die('Error in imagettfbbox function');
$x = ($width - $textbox[4])/2;
$y = ($height - $textbox[5])/2;
imagettftext($image, $font_size, 0, $x, $y, $text_color, $this->font , $code) or die('Error in imagettftext function');
/* output captcha image to browser */
header('Content-Type: image/jpeg');
imagejpeg($image);
imagedestroy($image);
$_SESSION['talep_kod'] = $code;
}
}
$width = isset($_GET['width']) && $_GET['width'] < 600 ? $_GET['width'] : '120';
$height = isset($_GET['height']) && $_GET['height'] < 200 ? $_GET['height'] : '40';
$characters = isset($_GET['characters']) && $_GET['characters'] > 2 ? $_GET['characters'] : '6';
$captcha = new CaptchaSecurityImages($width,$height,$characters);
?>
4- talep_gonder.php Kod:
<?
if (!$_POST['email'] || !$_POST['isim'] || !$_POST['telefon'] || !$_POST['konu'] || !$_POST['talep_kod']){die("email adresinizi giriniz");}
session_start();
if(($_SESSION['talep_kod'] == $_POST['talep_kod']) && (!empty($_SESSION['talep_kod'])) ) {
unset($_SESSION['talep_kod']);
} else {
die ("lütfen formdaki bilgileri kontrol ediniz");
}
$bilgi =' <h3>Talep / Destek Formu </h3>
<table width="600" border="1">
<tr>
<td width="151">Adınız Soyadınız </td>
<td width="433">'.$_POST['isim'].'</td>
</tr>
<tr>
<td>Email Adresiniz </td>
<td>'.$_POST['email'].'</td>
</tr>
<tr>
<td>Konu</td>
<td>'.$_POST['konu'].'</td>
</tr>
<tr>
<td>Telefonunuz</td>
<td>'.$_POST['telefon'].'</td>
</tr>
<tr>
<td>Mesajınız</td>
<td>'.$_POST['mesaj'].'</td>
</tr>
<tr>
<td>IP Adresi</td>
<td>'.$_SERVER['REMOTE_ADDR'].' - '.$_SERVER['HTTP_REFERER'].'</td>
</tr>
<tr>
<td>Tarih</td>
<td>'.date("d/m/Y H:i:s").'</td>
</tr>
</table>
<p> </p>';
$bizimadresimiz = "info@sayfa.net";
$headers = "MIME-Version: 1.0\n";
$headers .= "Content-type: text/html; charset=windows-1254\n";
$headers .= "From: Talep Formu<$bizimadresimiz>\n";
$headers .= "Cc: ".$_POST['email']."\n";
$headers .= "Reply-to: ".$_POST['email']."\n";
mail($bizimadresimiz, $_POST['konu'], $bilgi, $headers);
?>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-9" />
<p>Formunuz Gönderildi.</p>
<p> </p>
<p><a href="talep.php">Yeni form</a> </p>
talep_gonder.php dosyasının içinde $bizimadresimiz = "info@sayfa.net"; kısmında, kendi email adresinizi yazmanız yeterlidir. Dreamweaver programıyla düzenlemeleri yapıp ftp ile sitenize yükleyin. Tüm dosyalar için zip paketi: http://dosya.sayfa.net/talepformu/talep.zip Saygılar,
__________________
Sayfa.NET - Kurumsal Hosting Servisi www.sayfa.net Konu Engin tarafından (05-24-2009 Saat 05:38 PM ) değiştirilmiştir. |
|
#2
|
|||
|
|||
|
Engin bey anlatım için teşekkürler, Yeni açmış olduğum kişisel sitemde uğraşıyordum ve bir iletişim formu uygulamayı düşündüm tesadüfen bu konuya rastladım sağlam bir şekilde uyguladım ve kurulum gerçekleşti ancak çözemediğim bir sorun var. Mesajımı falan yazdıktan sonra formu gönder diyorum gönderildi diye bir ekran çıkıyor ama mail adresimde uzun bir süre beklememe rağmen mail falan gelmiyor. sizce sorun neyden kaynaklı olabilir?.
Demo adres: http://www.musaoztek.com/iletişim-bilgilerim/ $bizimadresimiz kısmına @gmail.com uzantılı mail adresimi ve o olmayınca şüphelenerek @live.com uzantılı mail adresimi yazmama rağmen bir mail gelmedi. ******** Mesaj düzenlendi: Sitem windows tabanlı olduğu için .php dosyalarını desteklemiyor sanırım, bende linux tabanlı olan diğer siteme dosyaları yükleyip kodların uzantılarını değiştim. şimdi çalışıyor ama dosyalar linux tabanlı olan diğer hostta yüklü. Konu Musa tarafından (07-20-2009 Saat 11:47 PM ) değiştirilmiştir. Sebep: .... |
|
#3
|
||||
|
||||
|
windows tabanlı hostunuz için CDOsys ile mail gönderim makalemi okuyabilirsiniz.
http://www.sayfa.net/showthread.php?t=49203
__________________
Sayfa.NET - Kurumsal Hosting Servisi www.sayfa.net |
![]() |
| Seçenekler | |
| Stil | |
|
|