iletişim formumuza güvenlık kodu ekledık...
Kodu hatalı gırersek gırılen tum bılgıler sayfa refresh oldugu ıcın sılınıyor halı ıle uzun bır form dusunun.. ad soyad tel o bu kod hatalı olursa tumu sılınıyor bastan gırmek gerekıyor sayfa f5 olsada nası bılgılerı post ederız guvenlık kodu hatalı oldugu durumlarda?? form ve kodlar asagıdadır.
ıletısım formları admınden dınamık eklenen alan eklenen yapıda calısmaktadır.
############## Form ##################
function formm($id){
$hangi_form = mysql_fetch_array(mysql_query("select id,form from $GLOBALS[baslik_tbl] where id = '$id'"));
$form_bilgi = mysql_fetch_array(mysql_query("select * from $GLOBALS[formlar_tbl] where id = '$hangi_form[form]'"));
if ($form_bilgi[icerik_yok]!='1') {
echo'<div style="width:'.$form_bilgi[icerik_width].'px; height:auto; float:left;">'; icerik_detay($id); echo'</div>'; }
echo'<div style="width:'.$form_bilgi[form_width].'px; height:auto; float:left;">';form($id); echo'</div>';
}
function form($id){
$hangi_form = mysql_fetch_array(mysql_query("select id,form from $GLOBALS[baslik_tbl] where id = '$id'"));
$form_bilgi = mysql_fetch_array(mysql_query("select * from $GLOBALS[formlar_tbl] where id = '$hangi_form[form]'"));
$form_sql = mysql_query("select * from $GLOBALS[form_alanlar_tbl] where form_id = '$hangi_form[form]' order by sira asc");
echo'<form action="" method="post" name="'.$hangi_form[form].'" id="'.$hangi_form[form].'" enctype="multipart/form-data">';
while ($form = mysql_fetch_array($form_sql)) {
//Metin Alanı (1)
if ($form[alan]==1){
echo'<div class="form_genel">
<span class="form_item_baslik">'.temizle($form[baslik_.$GLOBALS[lang]]);
if ($form[zorunlu]=="1"){
$zorunlu = 'validate[required]';
echo'<span class="form_zorunlu_alan">(*)</span>';}
echo'</span>
<span class="form_kutu_genel"><input type="text" value="" name="'.$form[id].'" id="'.$form[id].'" class="form_input '.$zorunlu.'" style="width:'.$form[boyut].'px"/></span></div>';
$zorunlu=NULL;}
//Yazı ALanı (2)
if ($form[alan]==2){
echo'<div class="form_genel">
<span class="form_item_baslik">'.temizle($form[baslik_.$GLOBALS[lang]]);
if ($form[zorunlu]=="1"){
$zorunlu = 'validate[required]';
echo'<span class="form_zorunlu_alan">(*)</span>';}
echo'</span>
<span class="form_kutu_genel"><textarea name="'.$form[id].'" id="'.$form[id].'" class="form_textarea '.$zorunlu.'" style="width:'.$form[boyut].'px"></textarea></div>';
$zorunlu=NULL;}
//Seçim Kutusu (3)
if ($form[alan]==3){
echo'<div class="form_genel">
<span class="form_item_baslik">'.temizle($form[baslik_.$GLOBALS[lang]]);
if ($form[zorunlu]=="1"){
$zorunlu = 'validate[required] radio';
echo'<span class="form_zorunlu_alan">(*)</span>';}
echo'</span>
<span class="form_kutu_genel">';
$gelenler = explode(",",$form[icerik_.$GLOBALS[lang]]);
$gelenler_say = count($gelenler)-1;
for ($i=0;$i<=$gelenler_say;$i++) {
echo'
<span class="label_genel">
<label class="from_radio_lb1"><input id="'.$i.$form[id].'" value="'.$gelenler[$i].'" name="'.$form[id].'" class="'.$zorunlu.'" type="radio"/></label>
<label for="'.$i.$form[id].'" class="from_radio_lb2">'.temizle($gelenler[$i]).'</label>
</label>
';
}
echo'</div>';
$zorunlu=NULL;}
//Açılan Liste (4)
if ($form[alan]==4){
echo'<div class="form_genel">
<span class="form_item_baslik">'.temizle($form[baslik_.$GLOBALS[lang]]);
if ($form[zorunlu]=="1"){
$zorunlu = 'validate[required]';
echo'<span class="form_zorunlu_alan">(*)</span>';}
echo'</span>
<select class="form_select '.$zorunlu.'" name="'.$form[id].'" id="'.$form[id].'" style="width:'.$form[boyut].'px">
<option value="">'.$GLOBALS[form_seciniz_].'</option>
';
$gelenler = explode(",",$form[icerik_.$GLOBALS[lang]]);
$gelenler_say = count($gelenler)-1;
for ($i=0;$i<=$gelenler_say;$i++) {
echo'
<option value="'.$gelenler[$i].'">'.temizle($gelenler[$i]).'</option>
';}
echo'</select></span></div>';
$zorunlu=NULL;}
//Mail ALanı (5)
if ($form[alan]==5){
echo'<div class="form_genel">
<span class="form_item_baslik">'.temizle($form[baslik_.$GLOBALS[lang]]);
if ($form[zorunlu]=="1"){
$zorunlu="validate[required,custom[email]]";
echo'<span class="form_zorunlu_alan">(*)</span>';}
echo'</span>
<span class="form_kutu_genel"><input type="text" name="'.$form[id].'" id="'.$form[id].'" value="" class="form_input '.$zorunlu.'" style="width:'.$form[boyut].'px"/></span></div>';
$zorunlu=NULL;}
//Çoklu Seçim (6)
if ($form[alan]==6){
echo'<div class="form_genel">
<span class="form_item_baslik">'.temizle($form[baslik_.$GLOBALS[lang]]);
if ($form[zorunlu]=="1"){
$zorunlu = 'validate[minCheckbox[1]]';
echo'<span class="form_zorunlu_alan">(*)</span>';}
echo'</span>
<span class="form_kutu_genel">';
$gelenler = explode(",",$form[icerik_.$GLOBALS[lang]]);
$gelenler_say = count($gelenler)-1;
for ($i=0;$i<=$gelenler_say;$i++) {
echo'
<span class="label_genel">
<label class="from_radio_lb1"><input id="'.$i.$form[id].'" value="'.$gelenler[$i].'" name="'.$form[id].'[]" class="'.$zorunlu.'" type="checkbox"/></label>
<label for="'.$i.$form[id].'" class="from_radio_lb2">'.temizle($gelenler[$i]).'</label>
</label>
';
}
echo'</div>';
$zorunlu=NULL;}
//Bölüm Ayırma (7)
if ($form[alan]==7){
echo'<div class="form_genel">
<span class="form_form_baslik">'.temizle($form[baslik_.$GLOBALS[lang]]);
echo'</span></div>';
}
//Dosya Upload (8)
if ($form[alan]==8){
echo'<div class="form_genel">
<span class="form_item_baslik">'.temizle($form[baslik_.$GLOBALS[lang]]);
if ($form[zorunlu]=="1"){
$zorunlu='validate[required]';
echo'<span class="form_zorunlu_alan">(*)</span>'; }
echo'<span class="file_formatlar">(<strong>'.$GLOBALS[formlar_formatlar].':</strong> ';
$gelenler = explode(",",$form[icerik_.$GLOBALS[lang]]);
$gelenler_say = count($gelenler)-1;
for ($i=0;$i<=$gelenler_say;$i++) {
echo temizle($gelenler[$i]).",";
}
echo')</span></span>
<span class="form_kutu_genel"><input type="file" class="'.$zorunlu.'" name="'.$form[id].'" id="'.$form[id].'" class="form_file"/></span></div>';
$zorunlu=NULL;}
}
echo '
<style>
.asd {
width:250px;
-webkit-box-shadow: 0 0 6px 4px #7bc1f7;
-moz-box-shadow: 0 0 6px 4px #7bc1f7;
border: 1px solid #7BC1F7;
box-shadow: 0px 0px 3px #7BC1F7;
border-radius: 3px;
margin-top: 2px;
background: #EDEDED none repeat scroll 0% 0%;
padding: 3px;
font-weight: bold;
}
</style>
';
echo '<div style="clear:both;"></div>';
echo '<div style="font-weight: bold;">Güvenlik Kodu</div>';
echo '<div class="asd">';
echo '<img id="captcha" src="securimage/securimage_show.php" style="margin-left: 15px;width: 170px;" alt="Güvenlik Kodu" />';
echo "<a href=\"#\" onclick=\"document.getElementById('captcha').src = 'securimage/securimage_show.php?' + Math.random(); return false\">Yenile</a><br>";
//echo '<a href="securimage/securimage_play.php">Dinle</a><br>';
echo 'Kodu Giriniz: <input type="text" name="guvenlikKodu" />';
echo '</div>';
echo'<div class="form_genel">
<input type="submit" name="submit" class="form_submit" value="'.$GLOBALS[formlar_submit].'"/>
</div>';
$round_sayi = mktime(date("H"),date("i"),date("s"),date("m"),date("d"),date("Y"));
$tarih = date("d/m/Y - H:i");
$ip = $_SERVER['REMOTE_ADDR'];
if ($_POST[submit]) {
include_once("securimage/securimage.php");
$securimage = new Securimage();
if(isset($_POST['guvenlikKodu'])){
if ($securimage->check($_POST['guvenlikKodu']) == false) {
echo '<span style="color:#fff;background-color: red;font-size:10pt;padding: 5px;
font-weight: bold;">Güvenlik kodu yanlıştır! Tekrar deneyiniz.</span>';
}else{
//Güvenlik kodunun doğru olması halince yapılacak işlemler
$form_sql = mysql_query("select * from $GLOBALS[form_alanlar_tbl] where alan not in ('7') and form_id = '$hangi_form[form]' order by sira asc");
while ($form = mysql_fetch_array($form_sql)) {
$post_gelen = $_POST[$form[id]];
if ($form[alan]==1 || $form[alan]==2 || $form[alan]==3 || $form[alan]==4 || $form[alan]==5) {
$kaydet = mysql_query("insert into $GLOBALS[form_kayitlar_tbl] (ses_id,alan_id,kayit,form_id,tarih,ip)values('$round_sayi','$form[id]','$post_gelen','$hangi_form[form]','$tarih','$ip')");
}
if ($form[alan]==6) {
$sayi = count($post_gelen)-1;
for ($i=0;$i<=$sayi;$i++) {
$alan_6.= $post_gelen[$i].",";
}
$kaydet = mysql_query("insert into $GLOBALS[form_kayitlar_tbl] (ses_id,alan_id,kayit,form_id,tarih,ip)values('$round_sayi','$form[id]','$alan_6','$hangi_form[form]','$tarih','$ip')");
}
if ($form[alan]==8) {
$gelenler = explode(",",$form[icerik_0]);
$gelenler_say = count($gelenler)-1;
for ($i=0;$i<=$gelenler_say;$i++) {
$gel = ".".$gelenler[$i];
if ($_FILES[$form[id]][tmp_name]) {
$uzanti=strstr($_FILES[$form[id]]['name'],".");
$name=time();
$names="up/".$name.$uzanti;
$file = 'up/'.$name.$uzanti;
if ($gel == $uzanti) {
//////////////////////////////
if($uzanti==".png" || $uzanti==".jpg" || $uzanti==".gif"){
move_uploaded_file($_FILES[$form[id]][tmp_name],$file);
$files = 'up/'.$name.$uzanti;
$percent = 0.5;
list($width, $height) = getimagesize($file);
if ($height>600){
$thumbnail_height = 600;}else{$thumbnail_height = 0;}
$ratio=$thumbnail_height/$height;
$thumbnail_width=$width*$ratio;
$thumbnail_width=ceil($thumbnail_width);
$newwidth = $thumbnail_width;
$newheight = $thumbnail_height;
$thumb = imagecreatetruecolor($newwidth, $newheight);
switch ($uzanti) {
case ".jpg"; $source = imagecreatefromjpeg($file); break;
case ".JPG"; $source = imagecreatefromjpeg($file); break;
case ".GIF"; $source = imagecreatefromgif($file); break;
case ".gif"; $source = imagecreatefromgif($file); break;
case ".PNG"; $source = imagecreatefrompng($file); break;
case ".png"; $source = imagecreatefrompng($file); break;
}
imagecopyresampled($thumb, $source, 0, 0, 0, 0, $newwidth, $newheight, $width, $height);
imagejpeg($thumb, $file, 100);
imagedestroy($thumb);
}else {
$files = 'up/'.$name.$uzanti;
move_uploaded_file($_FILES[$form[id]][tmp_name],$file);
}}
}}
$kaydet = mysql_query("insert into $GLOBALS[form_kayitlar_tbl] (ses_id,alan_id,kayit,form_id,tarih,ip)values('$round_sayi','$form[id]','$files','$hangi_form[form]','$tarih','$ip')");
}
}
echo'<div class="form_genel">
<span class="form_uyari">'.$GLOBALS[formlar_sonuc].'</span>
</div>';
$form_sql = mysql_query("select * from $GLOBALS[form_alanlar_tbl] where form_id = '$hangi_form[form]' order by sira asc");
while ($form = mysql_fetch_array($form_sql)) {
$post_gelen = $_POST[$form[id]];
if ($form[alan]==7){$mesaj.='<span style="font-weight:bold;">'.$form[baslik_0].'</span><br/><br/>';}
elseif ($form[alan]==1 || $form[alan]==2 || $form[alan]==3 || $form[alan]==4 || $form[alan]==5){$mesaj.='<span style="font-weight:bold;">'.$form[baslik_0].': </span>'.$post_gelen.'<br/>';}
elseif ($form[alan]==6) {
$mesaj.='<span style="font-weight:bold;">'.$form[baslik_0].': </span>';
$sayi = count($post_gelen)-1;
for ($i=0;$i<=$sayi;$i++) {
$mesaj.= $post_gelen[$i].",";
}
}elseif ($form[alan]==8){
$kayitbul = mysql_fetch_array(mysql_query("select * from $GLOBALS[form_kayitlar_tbl] where ses_id = '$round_sayi' and alan_id = '$form[id]'"));
$mesaj.='<span style="font-weight:bold;">'.$form[baslik_0].': </span>Eklenmiş dosyayı yönetim panelinden görebilirsiniz.<br/>';
}
}
$mesaj.='<br/><br/>
Tarih: '.$tarih.' - IP: '.$ip.'<br/><br/>
Bu mesaj sistem tarafından otomatik olarak gönderilmektedir...<br/>';
include('htmlMimeMail.php');
$site_bilgileri = mysql_fetch_array(mysql_query("select * from $GLOBALS[site_bilgileri_tbl] where id = '1'"));
$kime= $form_bilgi[mail];
$mail = new htmlMimeMail5();
$mail->setSMTPParams($site_bilgileri[e_posta_sunucu],587,null,false,$site_bilgileri[sistem_eposta],$site_bilgileri[sistem_eposta_sifre]);
$mail->setFrom ("xxxxx.tr");
$mail->setSubject($site_bilgileri[title_0].'-'.$form_bilgi[adi]);
$mail->setHTML($mesaj);
$cevap=$mail->send(array($kime), 'smtp');
}
}
}
}
kod olarak verırsenız deneyebılırım..