Tam Versiyonu Görüntüle: v.06 anketler.asp yi v.05 e uyarlama

bademix
29.11.2008, 23:44
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

yahzon
30.11.2008, 00:00
anketler.asp aÅ?aÄ?ıdaki gibi olucak
_____________________________________

<% @ Language=VBScript %>

<!--#include file="inc_ayarlar.asp"-->
<!--#include file="inc_fonksiyonlar.asp"-->
<%
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
' MyDesign Haber
' http://www.mydesign.gen.tr

' Anketler Sayfası Kodları
' Son Düzenleme: 30 Eylül 2008 (v0.6)
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

'// Sayfanın önbellekten alnması önleniyor
Response.Buffer = True
Response.Expires = -1
Response.ExpiresAbsolute = Now() - 2
Response.AddHeader "pragma","no-cache"
Response.AddHeader "cache-control","private"
Response.CacheControl = "No-Store"

'// DeÄ?iÅ?kenler Tanımlanıyor
Dim SQL
Dim intToplam
Dim intLooper
Dim intOySayisi
Dim intGenislik
Dim intSecenek
Dim intAnketID
Dim intGenislik2
Dim strOrderBy2
Dim intOySayisi2
%>
<!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>
<title>Anketler - <%=strSiteAdi%></title>
<!--#include file="inc/head.asp"-->
<link rel="stylesheet" type="text/css" href="<%=strScriptYolu%>inc/stil.css" />
<meta name="generator" content="MyDesign Haber <%=strVersiyon%>" />
<!--
Uygulama: MyDesign Haber
Versiyon: <%=strVersiyon%>
Download: http://www.mydesign.gen.tr
-->
<script type="text/javascript" src="<%=strScriptYolu%>inc/ajax.js"></script>
<!--#include file="inc/ajax.asp"-->
</head>
<body>
<table id="main" cellpadding="0" cellspacing="0">
<tr>
<td colspan="3" id="ust">
<table width="100%" cellpadding="0" cellspacing="0">
<tr>
 <td><h1><a href="<%=strScriptYolu%>" title="Anasayfa" class="sitebaslik"><%=strSiteAdi%></a></h1></td>
 <td id="ust-banner"><!--#include file="inc/banner.asp"--></td></tr>
</table>
</td></tr>
<tr>
<td colspan="3" id="bant"><!--#include file="inc/ust_menu.asp"--></td></tr>
<tr>
<td id="sol">
<div id="kategoriler">
 <h3>KATEGORÝLER</h3>
 <ul>
<li><a href="<%=strScriptYolu%>">Anasayfa</a></li>
<% Call KategoriListele("", "", "<li>", "</li>", 0, False, "", "", "", "") %>
 </ul>
</div>
<!--#include file="blok/arama.asp"-->
<!--#include file="blok/en_cok_okunanlar.asp"-->
</td>

<td id="orta"> <%

Response.Write "<h1>Anketler</h1>"

'// Formdan Veriler Alınıyor
intSecenek = Temizle(Request.Form("anket_secenek"))
intAnketID = Temizle(Request.Form("AnketID"))

If intAnketID <> "" AND IsNumeric(intAnketID) AND intSecenek <> "" AND IsNumeric(intSecenek) Then

 '// Veri, sayıysa veritabanı kontrolü yapılıyor
 SQL = "SELECT tblAnketSorular.Aktif, tblAnketSorular.Soru, tblAnketSecenekler.Oy, tblAnketSecenekler.Anket_ID, tblAnketSecenekler.Secenek_ID "
 SQL = SQL & " FROM tblAnketSorular, tblAnketSecenekler "
 SQL = SQL & " WHERE tblAnketSorular.Oy = "& strDBTrue &" AND tblAnketSorular.Anket_ID = tblAnketSecenekler.Anket_ID AND tblAnketSorular.Anket_ID = "& intAnketID
 SQL = SQL & " AND tblAnketSecenekler.Secenek_ID = "& intSecenek &" And tblAnketSorular.Aktif = "& strDBTrue
 kdGenel.Open SQL, adoCon, 1, 3
 If Not kdGenel.EOF Then
intCerezAnketID = Temizle(Request.Cookies(strCerezAdi)("Anket"& kdGenel("Anket_ID")))
If intCerezAnketID <> "" Then
Response.Write "Daha önce oy kullandınız."

Else
Call OyEkle(intSecenek)

Response.Cookies(strCerezAdi)("Anket"& intAnketID) = intSecenek
Response.Cookies(strCerezAdi).Expires = Date() + 30

Response.Redirect "anketler.asp"
End If
kdGenel.Close

 End If
End If

kdGenel.open "SELECT * FROM tblAnketSorular WHERE Aktif = "& strDBTrue &" ORDER BY tarih DESC", adoCon, 1, 3
If kdGenel.EOF Then
 Response.Write "<p>Henüz anket oluÅ?turulmadı.</p>"
Else
 Response.Write "<table width=""100%"" cellpadding=""0"" cellspacing=""0""><tr>"
 intLooper = 1

 Do While Not kdGenel.Eof

Response.Write "<td style=""width:50%; vertical-align:top; padding:3px;"
If intLooper Mod 2 = 0 Then Response.Write "background:url("& strScriptYolu &"img/orta_aralik.gif) top left repeat-y; padding-left:15px;"
Response.Write """>"

intCerezAnketID = Temizle(Request.Cookies(strCerezAdi)("Anket"& kdGenel("Anket_ID")))

If intCerezAnketID <> "" Then

kdFonksiyon.Open "SELECT * FROM tblAnketSorular WHERE Anket_ID = "& kdGenel("Anket_ID") &" ORDER BY Tarih DESC", adoCon, 1, 3
If Not kdFonksiyon.Eof Then

  kdYardimci.Open "SELECT SUM(Oy) AS Toplam FROM tblAnketSecenekler WHERE Anket_ID = "& kdFonksiyon("Anket_ID") &"", adoCon, 1, 3
  intOySayisi2 = CInt(kdYardimci("Toplam"))
  kdYardimci.Close

  If DBBool(kdFonksiyon("Sonuc")) = strDBTrue Then strOrderBy2 = " ORDER BY Oy DESC"
  kdYardimci.Open "SELECT * FROM tblAnketSecenekler WHERE Anket_ID = "& kdFonksiyon("Anket_ID") & strOrderBy2 &"", adoCon, 1, 3
  If Not kdYardimci.Eof Then
Response.Write "<p class=""anket-baslik-2"">"& kdFonksiyon("Soru") &"</p>"
Do While Not kdYardimci.Eof
If kdYardimci("Oy") = 0 Then
intGenislik2 = 0
Else
intGenislik2 = kdYardimci("Oy")*100/intOySayisi2
End If

If DBBool(kdFonksiyon("Sonuc")) = strDBTrue Then %>
<p><div class="oy_bg_2"><img src="<%=strScriptYolu%>img/oy_sol.gif" /><img src="<%=strScriptYolu%>img/oy.gif" height="7" width="<%=186*(intGenislik2)/100%>" alt="%<%=Round(intGenislik2,0)%>" /><img src="<%=strScriptYolu%>img/oy_sag.gif" /></div>
<%=kdYardimci("Secenek")%><br />
<span class="yuzde_2">%<%=Round(intGenislik2,0)%> | <%=kdYardimci("Oy")%> Oy</span></p><%
Else
Response.Write "<p><div class=""oy_bg_2""> </div>"& kdYardimci("Secenek") &"</p>"
End If
kdYardimci.Movenext
Loop
 
If DBBool(kdFonksiyon("Sonuc")) = strDBFalse Then Response.Write "<p><em>Anket sonucu gösterimi kapatılmıÅ?tır.</em></p>"
  End If
  kdYardimci.Close

End If
kdFonksiyon.Close

Else
If DBBool(kdGenel("Oy")) = strDBTrue Then

  kdYardimci.Open "SELECT * FROM tblAnketSecenekler WHERE Anket_ID = "& kdGenel("Anket_ID") &"", adoCon, 1, 3
  If Not kdYardimci.Eof Then %>
<div id="anket-sonuc<%=kdGenel("Anket_ID")%>">
<form action="anketler.asp" method="post" style="margin:0; padding:0; display:inline;">
<input type="hidden" style="display:none;" name="AnketID" id="AnketID" value="<%=kdGenel("Anket_ID")%>" />
<p class="anket-baslik"><%=kdGenel("Soru")%></p><%
Do While Not kdYardimci.Eof %>
<input type="radio" id="anket_secenek" value="<%=kdYardimci("Secenek_ID")%>" name="anket_secenek" /> <label for="anket_secenek_<%=kdYardimci("Secenek_ID")%>"><%=kdYardimci("Secenek")%></label><br /><%
kdYardimci.Movenext
Loop %>
<p><input type="submit" value=" Oy Ver " class="buton" /></p>
</form>
</div><%
  End If
  kdYardimci.Close
Else
  Call AnketSonuc(kdGenel("Anket_ID"))
End If
End If

Response.Write "</td>"

If intLooper Mod 2 = 0 Then
Response.Write "</tr></tr><td colspan=""2"" style=""background:url("& strScriptYolu &"img/bg/yatay_ayrac.gif) bottom left repeat-x;""> </td></tr><tr>"
End If
intLooper = intLooper + 1
kdGenel.Movenext
 Loop
 Response.Write "</table>"
End If
kdGenel.Close %>


</td>

<td id="sag">
<!--#include file="blok/yazarlar.asp"-->
<!--#include file="blok/son_dakika.asp"-->
<!--#include file="blok/anket.asp"-->
<!--#include file="blok/en_son_yorumlananlar.asp"-->
</td>
</tr>
<tr>
<td colspan="3" id="alt">
<p><%=strCopyright%><br /><a href="<%=strScriptYolu%>rss.asp">RSS KaynaÄ?ı</a> | <a href="<%=strScriptYolu%>yonetim.asp">Yazar GiriÅ?i</a></p>
<!--#include file="inc/alt.asp"-->

<%
' Bu kısmı deÄ?iÅ?tirmek lisans anlaÅ?masına aykırıdır
Response.Write "<p>Altyapı: <a href=""http://www.mydesign.gen.tr"" target=""_blank"" title=""MyDesign | Kod ArÅ?ivi"">MyDesign Haber Sistemi</a></p>"
' Bu kısmı deÄ?iÅ?tirmek lisans anlaÅ?masına aykırıdır
%>
</td>
</tr>
</table>
</body>
</html>

_________________________________________


in.fonksiyonlar.asp'de aÅ?aÄ?ıdakini bulup

______________________________________

Sub AnketSonuc(AnketID)

Dim intGenislik

kdFonksiyon.Open "SELECT * FROM tblAnketSorular WHERE Anket_ID = "& AnketID &" ORDER BY Tarih DESC", adoCon, 1, 3
If Not kdFonksiyon.Eof Then

Dim intOySayisi

kdYardimci.Open "SELECT SUM(Oy) AS Toplam FROM tblAnketSecenekler WHERE Anket_ID = "& kdFonksiyon("Anket_ID") &"", adoCon, 1, 3
intOySayisi = CInt(kdYardimci("Toplam"))
kdYardimci.Close

kdYardimci.Open "SELECT * FROM tblAnketSecenekler WHERE Anket_ID = "& kdFonksiyon("Anket_ID") &" ORDER BY Oy DESC", adoCon, 1, 3
If Not kdYardimci.Eof Then
 Response.Write "<p class=""anket-baslik"">"& kdFonksiyon("Soru") &"</p>"
 Do While Not kdYardimci.Eof

If kdYardimci("Oy") = 0 Then
intGenislik = 0
Else
intGenislik = kdYardimci("Oy")*100/intOySayisi
End If %>
<p><div class="oy_bg"><img src="<%=strScriptYolu%>img/oy_sol.gif" /><img src="<%=strScriptYolu%>img/oy.gif" height="7" width="<%=136*(intGenislik)/100%>" alt="%<%=Round(intGenislik,0)%>" /><img src="<%=strScriptYolu%>img/oy_sag.gif" /></div>
<%=kdYardimci("Secenek")%><br />
<span class="yuzde">%<%=Round(intGenislik,0)%> | <%=kdYardimci("Oy")%> Oy</span></p><%
kdYardimci.Movenext
 Loop
End If
kdYardimci.Close

End If
kdFonksiyon.Close
End Sub
_______________________________________


bununla deÄ?iÅ?tiriniz.

___________________

Sub AnketSonuc(AnketID)

Dim intGenislik
Dim strOrderBy

kdFonksiyon.Open "SELECT * FROM tblAnketSorular WHERE Anket_ID = "& AnketID &" ORDER BY Tarih DESC", adoCon, 1, 3
If Not kdFonksiyon.Eof Then

Dim intOySayisi

kdYardimci.Open "SELECT SUM(Oy) AS Toplam FROM tblAnketSecenekler WHERE Anket_ID = "& kdFonksiyon("Anket_ID") &"", adoCon, 1, 3
intOySayisi = kdYardimci("Toplam")
kdYardimci.Close

If IsNull(intOySayisi) Then intOySayisi = 0 Else intOySayisi = CInt(intOySayisi)

If DBBool(kdFonksiyon("Sonuc")) = strDBTrue Then strOrderBy = " ORDER BY Oy DESC"
kdYardimci.Open "SELECT * FROM tblAnketSecenekler WHERE Anket_ID = "& kdFonksiyon("Anket_ID") & strOrderBy &"", adoCon, 1, 3
If Not kdYardimci.Eof Then
 Response.Write "<p class=""anket-baslik"">"& kdFonksiyon("Soru") &"</p>"
 Do While Not kdYardimci.Eof
If kdYardimci("Oy") = 0 Then
intGenislik = 0
Else
intGenislik = kdYardimci("Oy")*100/intOySayisi
End If

If DBBool(kdFonksiyon("Sonuc")) = strDBTrue Then %>
<p><div class="oy_bg"><img src="<%=strScriptYolu%>img/oy_sol.gif" /><img src="<%=strScriptYolu%>img/oy.gif" height="7" width="<%=136*(intGenislik)/100%>" alt="%<%=Round(intGenislik,0)%>" /><img src="<%=strScriptYolu%>img/oy_sag.gif" /></div>
<%=kdYardimci("Secenek")%><br />
<span class="yuzde">%<%=Round(intGenislik,0)%> | <%=kdYardimci("Oy")%> Oy</span></p><%
Else
Response.Write "<p>"& kdYardimci("Secenek") &"</p>"
End If
kdYardimci.Movenext
 Loop
 
 If DBBool(kdFonksiyon("Sonuc")) = strDBFalse Then Response.Write "<p><em>Anket sonucu gösterimi kapatılmıÅ?tır.</em></p>"
End If
kdYardimci.Close

End If
kdFonksiyon.Close
End Sub
_______________________________________________


yonetim.anket.asp'Debody'den body'ye aÅ?aÄ?ıdaki ile deÄ?iÅ?tiriniz.


____________________________________________________


<div id="header">
<a href="http://www.mydesign.gen.tr" title="MyDesign Haber"><h1></h1></a><br />
<h2>Yönetim Paneli</h2>
<% If blnAdmin AND strVtTuru = "Access" AND strVeriTabaniYolu = strScriptYolu &"veritabani/mydesign_haber.mdb" Then %>
<div id="ust-uyari"><img src="img/sari_uyari.png" alt="Uyarı!" align="left" style="padding:0 5px 0 0" /><b>UYARI:</b> Veritabanı, varsayılan ismiyle kullanılıyor. Sitenizin güvenliÄ?i için veritabani klasöründeki veritabanı dosyasının
adını deÄ?iÅ?tiriniz.</div><%
End If %>
</div>
<div id="menu1"><% Call UstMenu("anket","<ul>","</ul>","<li>","</li>") %></div>
<div id="menu2"><% Call AltMenu("anket","<ul>","</ul>","<li>","</li>") %></div>
<div id="icerik">
<%
If blnAdmin <> True Then
Response.Write "<div class=""uyari"">Bu bölümü görme yetkiniz yok</div>"

Else

'// Anket Düzenleme Bölümü
If strIslem = "duzenle" Then

intAnketID = Temizle(Trim(Request.Querystring("anket")))
If intAnketID <> "" AND IsNumeric(intAnketID) Then

 kdGenel.open "SELECT * FROM tblAnketSorular WHERE Anket_ID="& CInt(intAnketID) &"", adoCon, 1, 3
 If Not kdGenel.EOF Then %>
<h1>Anket Düzenle</h1>
<form method="post" action="yonetim_anket.asp?islem=duzenle_islem" style="display:inline">
<fieldset>
<legend>Anket Düzenle</legend>

<label for="soru">Anket Sorusu</label>
<input id="soru" type="text" name="soru" value="<%=kdGenel("Soru")%>" class="input" size="75" /><br />

<label for="goster">Durum</label>
<select id="goster" name="goster" class="input">
<option value="True"<% If DBBool(kdGenel("Aktif")) = strDBTrue Then Response.Write " selected=""selected"""%>>Aktif</option>
<option value="False"<% If DBBool(kdGenel("Aktif")) = strDBFalse Then Response.Write " selected=""selected"""%>>Pasif</option>
</select><br />

<label for="oy">Oy Verme</label>
<select id="oy" name="oy" class="input">
<option value="True"<% If DBBool(kdGenel("Oy")) = strDBTrue Then Response.Write " selected=""selected"""%>>Açık</option>
<option value="False"<% If DBBool(kdGenel("Oy")) = strDBFalse Then Response.Write " selected=""selected"""%>>Kapalı</option>
</select><br />

<label for="sonuc">Sonuç Gösterimi</label>
<select id="sonuc" name="sonuc" class="input">
<option value="True"<% If DBBool(kdGenel("Sonuc")) = strDBTrue Then Response.Write " selected=""selected"""%>>Açık</option>
<option value="False"<% If DBBool(kdGenel("Sonuc")) = strDBFalse Then Response.Write " selected=""selected"""%>>Kapalı</option>
</select><br />

</fieldset>
<br />
<fieldset>
<legend>Seçenekler</legend><%
kdYardimci.Open "SELECT * FROM tblAnketSecenekler WHERE Anket_ID = "& intAnketID &"", adoCon, 1, 3
If Not kdYardimci.Eof Then
intLooper = 1
Do While Not kdYardimci.Eof %>
<label for="secenek_<%=kdYardimci("Secenek_ID")%>">Seçenek <%=intLooper%> (<a onClick="return secenekSil()" href="?islem=secenek_sil&secID=<%=kdYardimci("Secenek_ID")%>">Sil</a>)</label>
<input id="secenek_<%=kdYardimci("Secenek_ID")%>" type="text" name="secenek_<%=kdYardimci("Secenek_ID")%>" value="<%=kdYardimci("Secenek")%>" class="input" size="60" />
<input id="oy_<%=kdYardimci("Secenek_ID")%>" type="text" name="oy_<%=kdYardimci("Secenek_ID")%>" value="<%=kdYardimci("Oy")%>" class="input" size="10" style="margin-left:5px;" /><br />
<%
intLooper = intLooper + 1
kdYardimci.Movenext
Loop
End If
kdYardimci.Close %>
<input type="hidden" name="secenekSayisi" value="<%=intLooper-1%>" />
</fieldset>
<div class="bDiv"><input type="hidden" name="anket" value="<%=intAnketID%>"><input type="submit" value=" Anket Düzenle " class="buton" /> <input type="reset" value=" Sıfırla " class="buton" /></div>
</form>
<br />
<form method="post" action="yonetim_anket.asp?islem=secenek_ekle" style="display:inline">
<fieldset>
<legend>Seçenek Ekle</legend>

<label for="secenek">Seçenek</label>
<input id="secenek" type="text" name="secenek" value="" class="input" size="75" /><br />

</fieldset>
<div class="bDiv"><input type="hidden" name="anket" value="<%=intAnketID%>"><input type="submit" value=" Seçenek Ekle " class="buton" /> <input type="reset" value=" Sıfırla " class="buton" /></div>
</form><%
 Else
Response.Redirect "yonetim_anket.asp?t=ab"
 End If
 kdGenel.Close
Else
 Response.Redirect "yonetim_anket.asp?t=ab"
End If


'// Anket Düzenlemenin Kaydedilmesi
Elseif strIslem = "duzenle_islem" Then

intAnketID = Temizle(Trim(Request.Form("anket")))
strSoru = BaslikTemizle(Trim(Request.Form("soru")))
blnDurum = BaslikTemizle(Trim(Request.Form("goster")))
blnOy = BaslikTemizle(Trim(Request.Form("oy")))
blnSonuc = BaslikTemizle(Trim(Request.Form("sonuc")))

If intAnketID <> "" AND IsNumeric(intAnketID) AND strSoru <> "" Then

 kdGenel.Open "SELECT * FROM tblAnketSorular WHERE Anket_ID = "& CInt(intAnketID) &"", adoCon, 1, 3
 If Not kdGenel.EOF Then
kdGenel("Soru") = strSoru
kdGenel("Aktif") = DBBool(blnDurum)
kdGenel("Oy") = DBBool(blnOy)
kdGenel("Sonuc") = DBBool(blnSonuc)
kdGenel.Update

kdYardimci.Open "SELECT * FROM tblAnketSecenekler WHERE Anket_ID = "& CInt(intAnketID) &"", adoCon, 1, 3
If Not kdYardimci.Eof Then
Do While Not kdYardimci.Eof
kdYardimci("Secenek") = BaslikTemizle(Trim(Request.Form("secenek_"& kdYardimci("Secenek_ID"))))
If IsNumeric(BaslikTemizle(Trim(Request.Form("oy_"& kdYardimci("Secenek_ID"))))) Then kdYardimci("Oy") = BaslikTemizle(Trim(Request.Form("oy_"& kdYardimci("Secenek_ID"))))
kdYardimci.Movenext
Loop
End If
kdYardimci.Close

Response.Redirect "yonetim_anket.asp?t=ad"
 Else
Response.Redirect "yonetim_anket.asp?t=ab"
 End If
 kdGenel.Close
Else
 Response.Write "<div class=""uyari"">Anket bulunamadı veya anket sorusu geçersiz.</div>"
End If


'// Anket Ekleme Formu
Elseif strIslem = "anket_ekle" Then %>

<h1>Anket Ekle</h1>
<form method="post" action="yonetim_anket.asp?islem=anket_ekle_islem" style="display:inline">
<fieldset>
<legend>Anket Bilgileri</legend>

<label for="soru">Anket Sorusu</label>
<input id="soru" type="text" name="soru" value="" class="input" size="75" /><br />

<label for="sonuc">Sonuç Gösterimi</label>
<select id="sonuc" name="sonuc" class="input"><option value="True">Açık</option><option value="False">Kapalı</option></select><br />

<label for="secenekler">Seçenekler<br /><span style="font-size:9px;color:#666666">Her satıra bir seçenek yazınız.</label>
<textarea name="secenekler" id="secenekler" class="input" rows="10" cols="72" /></textarea><br />

</fieldset>

<div class="bDiv"><input type="submit" value=" Anket Ekle " class="buton" /></div>
</form><%


'// Anket Ekleme Formunun Kaydedilmesi
Elseif strIslem = "anket_ekle_islem" Then

strSoru = Temizle(Trim(Request.Form("soru")))
strSecenekler = Temizle(Trim(Request.Form("secenekler")))
blnSonuc = Temizle(Trim(Request.Form("sonuc")))

If strSoru <> "" AND strSecenekler <> "" Then

 kdGenel.Open "SELECT * FROM tblAnketSorular", adoCon, 1, 3
 kdGenel.AddNew
 kdGenel("Soru") = strSoru
 kdGenel("Tarih") = Now()
 kdGenel("Aktif") = strDBTrue
 kdGenel("Oy") = strDBTrue
 kdGenel("Sonuc") = DBBool(blnSonuc)
 kdGenel.Update
 kdGenel.Close

 SQL = "SELECT "
 If strVtTuru <> "mySQL" Then SQL = SQL & "TOP 1 "
 SQL = SQL & " Anket_ID FROM tblAnketSorular ORDER BY Anket_ID DESC"
 If strVtTuru = "mySQL" Then SQL = SQL & " LIMIT 1 "
 kdGenel.Open SQL, adoCon, 1, 3
 intSonAnketID = kdGenel("Anket_ID")
 kdGenel.Close

 arrSecenekler = Split(strSecenekler, vbCrLf)

 For intLooper = 0 To UBound(arrSecenekler)
If arrSecenekler(intLooper) <> "" Then
kdGenel.Open "SELECT * FROM tblAnketSecenekler", adoCon, 1, 3
kdGenel.AddNew
kdGenel("Anket_ID") = intSonAnketID
kdGenel("Secenek") = arrSecenekler(intLooper)
kdGenel("Oy") = 0
kdGenel.Update
kdGenel.Close
End If
 Next
 Response.Redirect "yonetim_anket.asp?t=ae"
Else
 Response.Write "<div class=""uyari""><h1>Lütfen anket sorusunu ve seçenekleri yazınız.</h1><input type=""button"" class=""buton"" value="" Geri Dön "" onClick=""document.location='yonetim_anket.asp?islem=anket_ekle'"" /></div>"
End If


'// Seçenek eklemenin kaydedilmesi
Elseif strIslem = "secenek_ekle" Then

intAnketID = Temizle(Trim(Request.Form("anket")))
strSecenek = BaslikTemizle(Trim(Request.Form("secenek")))

If intAnketID <> "" AND IsNumeric(intAnketID) AND strSecenek <> "" Then

 kdGenel.Open "SELECT * FROM tblAnketSecenekler", adoCon, 1, 3
 kdGenel.Addnew
 kdGenel("Secenek") = strSecenek
 kdGenel("Anket_ID") = intAnketID
 kdGenel("Oy") = 0
 kdGenel.Update
 kdGenel.Close
 Response.Redirect "yonetim_anket.asp?islem=duzenle&anket="& intAnketID
Else
 Response.Redirect "yonetim_anket.asp?islem=duzenle&anket="& intAnketID
End If


'// Seçenek Silinmesi
Elseif strIslem = "secenek_sil" Then

intSecenekID = Temizle(Trim(Request.Querystring("secID")))
If intSecenekID <> "" AND IsNumeric(intSecenekID) Then

 kdGenel.Open "SELECT Anket_ID, Secenek_ID FROM tblAnketSecenekler WHERE Secenek_ID = "& CInt(intSecenekID) &"", adoCon, 1, 3
 If Not kdGenel.Eof Then
intAnketID = kdGenel("Anket_ID")
kdGenel.Delete
kdGenel.Update
Response.Redirect "yonetim_anket.asp?islem=duzenle&anket="& intAnketID
 Else
Response.Redirect "yonetim_anket.asp?islem=duzenle&anket="& intAnketID
 End If
 kdGenel.Close
Else
 Response.Redirect "yonetim_anket.asp?islem=duzenle&anket="& intAnketID
End If


'// Anket Silinmesi
Elseif strIslem = "sil" Then

intAnketID = Temizle(Trim(Request.Querystring("anket")))
If intAnketID <> "" AND IsNumeric(intAnketID) Then

 kdGenel.Open "SELECT Anket_ID FROM tblAnketSorular WHERE Anket_ID = "& CInt(intAnketID) &"", adoCon, 1, 3
 If Not kdGenel.Eof Then
kdGenel.Delete
kdGenel.Update

adoCon.Execute("DELETE FROM tblAnketSecenekler WHERE Anket_ID = "& CInt(intAnketID))
Response.Redirect "yonetim_anket.asp"
 Else
Response.Redirect "yonetim_anket.asp?t=as"
 End If
Else
 Response.Redirect "yonetim_anket.asp?t=ab"
End If


'// Oyların Sıfırlanması
Elseif strIslem = "sifirla" Then

intAnketID = Temizle(Trim(Request.Querystring("anket")))
If intAnketID <> "" AND IsNumeric(intAnketID) Then

 kdGenel.Open "SELECT Anket_ID, Oy FROM tblAnketSecenekler WHERE Anket_ID = "& CInt(intAnketID) &"", adoCon, 1, 3
 If Not kdGenel.Eof Then
Do While Not kdGenel.Eof
kdGenel("Oy") = 0
kdGenel.Update
kdGenel.Movenext
Loop
 End If
 kdGenel.Close
 Response.Redirect "yonetim_anket.asp?t=os"
Else
 Response.Redirect "yonetim_anket.asp?t=ab"
End If


'// Anket Listeleme Bölümü
Else

Response.Write "<h1>Anketler</h1>"

If strTitle = "ad" Then Response.Write "<div class=""yesil_kutu"">Anket düzenlendi.</div>"
If strTitle = "as" Then Response.Write "<div class=""yesil_kutu"">Anket silindi.</div>"
If strTitle = "ae" Then Response.Write "<div class=""yesil_kutu"">Anket eklendi.</div>"
If strTitle = "ab" Then Response.Write "<div class=""uyari"">Anket bulunamadı.</div>"

kdGenel.open "SELECT * FROM tblAnketSorular ORDER BY tarih DESC", adoCon, 1, 3
If kdGenel.EOF Then
 Response.Write "<p>Henüz anket oluÅ?turulmadı.</p>"

Else
 Response.Write("<table cellspacing=""0"" width=""700"">" & _
 "<tr>" & _
 "<th scope=""col"" class=""nobg"" style=""width:40%; ""><b>Anket</b></td>" & _
 "<th scope=""col"" style=""width:15%; text-align:center;""><b>Görünüm</b></td>" & _
 "<th scope=""col"" style=""width:15%; text-align:center;""><b>Oy Verme</b></td>" & _
 "<th scope=""col"" style=""width:15%; text-align:center;""><b>Sonuçlar</b></td>" & _
 "<th scope=""col"" style=""width:15%; text-align:center;""><b>İÅ?lemler</b></td>" & _
 "</tr>" & vbCrLf)

 intLooper = 0
 Do While NOT kdGenel.EOF

If intLooper Mod 2 Then
hClass = "specalt"
rClass = " class=""alt"""
Else
hClass = "spec"
rClass = ""
End If

If DbBool(kdGenel("Aktif")) = strDBTrue Then strDurum = "Aktif" Else strDurum = "Pasif" End If
If DbBool(kdGenel("Oy")) = strDBTrue Then strOyDurum = "Açık" Else strOyDurum = "Kapalı" End If
If DbBool(kdGenel("Sonuc")) = strDBTrue Then strSonucDurum = "Açık" Else strSonucDurum = "Kapalı" End If


Response.Write("<tr><th scope=""row"" class="""& hClass &"""><a href=""?islem=duzenle&anket="& kdGenel("Anket_ID") &""">"& kdGenel("Soru") &"</a></td>" & _
"<td"& rClass &" style=""text-align:center;"">"& strDurum &"</td>" & _
"<td"& rClass &" style=""text-align:center;"">"& strOyDurum &"</td>" & _
"<td"& rClass &" style=""text-align:center;"">"& strSonucDurum &"</td>" & _
"<td"& rClass &" style=""text-align:center;""><a href=""?islem=duzenle&anket="& kdGenel("Anket_ID") &""" title=""Düzenle""><img src=""img/icon/duzenle.gif"" alt=""Düzenle"" border=""0"" /></a> " & _
" <a onclick=""return oySifirla()"" href=""?islem=sifirla&anket="& kdGenel("Anket_ID") &""" title=""Oyları Sıfırla""><img src=""img/icon/sifirla.gif"" alt=""Oyları Sıfırla"" border=""0"" /></a> " & _
" <a onclick=""return anketSil()"" href=""?islem=sil&anket="& kdGenel("Anket_ID") &""" title=""Sil""><img src=""img/icon/sil.gif"" alt=""Sil"" border=""0"" /></a></td></tr>" & vbCrLf)

intLooper = intLooper + 1
 kdGenel.Movenext
 Loop
 Response.Write "</table>"
End If
kdGenel.Close
End If
End If

adoCon.Close
Set adoCon = Nothing %>
</div>

_______________________________________________yahzon2008-12-01 16:44:34

kaderimse_24
30.11.2008, 16:21
saolasýn kardeþim güzel paylaþým.

DostAjans
01.12.2008, 09:58
Ben denedim olmadý. Hatayý göremedim ama "500 Ýnternal Server Eror" verdi

yahzon
01.12.2008, 14:06
kod hata ayýklamasýný devre dýþý býrakarak explorerda hatayý görebilirsiniz

haberaksaray
01.12.2008, 16:15
inc.ayarlar.asp'ye aþaðýdakini ekleyiniz
_______________________________________________

Dim intCerezAnketID


bu olmadý hata verdi..

anket.asp line 2 de

haberaksaray
07.12.2008, 00:27
yapabilen var mý acaba?

bademix
07.12.2008, 19:12
bende denedim çalýþmadý

sebebim
25.12.2008, 19:28
bendede olmadý maalesef