Her WebMastere Lazım Asp Kodları %100

+ Yorum Gönder
Webmaster ve HTML-PHP-ASP-JAVA Bölümünden Her WebMastere Lazım Asp Kodları %100 ile ilgili Kısaca Bilgi
  1. 1
    BozGuNoNLiNe
    Üye
    Reklam

    Her WebMastere Lazım Asp Kodları %100

    Reklam



    Her WebMastere Lazım Asp Kodları %100

    Forum Alev
    1- Sitenizdeki Aktif Kişi Sayısını bu
    Kod:
    <Object Runat="Server" Scope="application" ID="dOnlineUsers" ProgID="Scripting.Dictionary"></Object>
    
    <SCRIPT LANGUAGE=VBScript RUNAT=Server>
    sub Application_OnStart
    application("ServerStart") = now
    end sub
    function Decrypt(sText)
    Decrypt = sText
    end function
    
    function adZero(sText)
    if isNull(sText) then exit function
    adZero = string(5 - len(sText), "0") & sText
    end function
    
    Sub Session_OnStart
    
    
    Session.TimeOut = 5
    sAktifUsrList = application("AktifUsrList")
    
    sNewUserName = Decrypt(request.cookies("isim")+ request.cookies("soyisim"))
    
    if sNewUserName = "" then sNewUserName = "Ziyaretci-" & AdZero(CInt(application("Ziyaretci")))
    
    sLastActionTime = Time
    
    sUserInfo = sNewUserName & "<|>" & sLastActionTime & "<|>" & sLastPageViewed
    
    
    dOnlineUsers.Add Session.SessionID, sUserInfo
    
    application.lock
    application("AktifUsr") = application("AktifUsr") + 1
    application("Ziyaretci") = application("Ziyaretci") + 1
    
    if application("TodaysDate") <> Date() then
    application("PageViewsToday") = 0
    application("ZiyaretciToday") = 0
    end if
    application("ZiyaretciToday") = application("ZiyaretciToday") + 1
    application("TodaysDate") = Date()
    application.unlock
    
    End Sub
    
    Sub Session_OnEnd
    
    on error resume next
    dOnlineUsers.Remove Session.SessionID
    
    application.lock
    application("AktifUsr") = application("AktifUsr") - 1
    application.unlock
    
    End Sub
    </SCRIPT>
    2-En Son 10 Kayıt
    Kod:
    <%
    'Veritabanına bağlanıyoruz.
    set conn=server.createobject("adodb.connection")
    conn.open= "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" & server.mappath ("db/database.mdb")
    'Şimdi Kayıt nesnemizi oluşturuyoruz.
    Set rs=server.createobject("adodb.recordset")
    'şimdi sql ile sorgu oluşturuyoruz.
    sql="select * from tablo where kayit_tarih desc"
    'şimdi kayıt nesnemiz olan rs ile tabloyu açtırıyoruz
    rs.open sql,conn,1,3
    %>
    <%
    ' Şimdi ise sql sorgusu ile aldığımız kayıtların sadece 10 tanesini gösterecek bir döngü yaratıyoruz
    for i=1 to 10
    %>
    <%= rs("kayit_tarih")%> <%= rs("kayit")%>
    <% rs.movenext %>
    <% next %>


    3-Mail yolla

    Kod:
    Sub SendEmail(strFrom, strTo, strSubject, strBody)
    ' DB ve email sabitleri
    Dim objCDOMail
    
    ' email aktif mi
    If SEND_EMAIL Then
    
    Set objCDOMail = Server.CreateObject("CDONTS.NewMail")
    
    ' obje özellikleri
    objCDOMail.From = strFrom
    objCDOMail.To = strTo
    objCDOMail.Subject = strSubject
    objCDOMail.Body = strBody
    
    ' mesajı yolla
    objCDOMail.Send
    Set objCDOMail = Nothing
    End If
    End Sub

    4-Excele Aktarma (Databaseden)

    Kod:
    <%@ Language=VBScript %>
    <%
    'sql: kısmına çift tırnak içinde direk sql stringi yaz
    'cnnl: database bağlantısı
    Function exporttoexcel(FileName,sql,cnnl)
    dim iCols
    dim i
    set rs=server.CreateObject("ADODB.Recordset")
    set rs=cnnl.Execute (sql)
    iCols = rs.Fields.Count
    session("FileName")=cstr(FileName)
    set fso = createobject("scripting.filesystemobject")
    Set folder = fso.GetFolder("c:\Inetpub\wwwroot\tekintranet\doku man\excel")
    Set act = folder.CreateTextFile(""&FileName& "" &".xls", true)
    act.WriteLine "<html xmlns:x=""urn:schemas-microsoft-comffice:excel"">"
    act.WriteLine "<head>"
    act.WriteLine "<!--[if gte mso 9]><xml>"
    act.WriteLine "<x:ExcelWorkbook>"
    act.WriteLine "<x:ExcelWorksheets>"
    act.WriteLine "<x:ExcelWorksheet>"
    act.WriteLine "<x:Name>"& "Sheet1" &"</x:Name>"
    act.WriteLine "<x:WorksheetOptions>"
    act.WriteLine "<xrint>"
    act.WriteLine "<x:ValidPrinterInfo/>"
    act.WriteLine "</xrint>"
    act.WriteLine "</x:WorksheetOptions>"
    act.WriteLine "</x:ExcelWorksheet>"
    act.WriteLine "</x:ExcelWorksheets>"
    act.WriteLine "</x:ExcelWorkbook>"
    act.WriteLine "</xml>"
    act.WriteLine "<![endif]--> "
    act.WriteLine "</head>"
    act.WriteLine "<body>"
    act.WriteLine "<table>"
    act.WriteLine "<tr>"
    For i = 0 To iCols - 1
    act.WriteLine "<th>"
    act.WriteLine "<font face=Arial>"&cstr(rs.Fields.Item(i).Name&"</font>")
    act.WriteLine "</th>"
    next
    act.WriteLine "</tr>"
    rs.MoveFirst
    i=0
    do until rs.EOF
    act.WriteLine "<tr>"
    For i = 0 To iCols - 1
    act.WriteLine "<td>"
    if rs.Fields.Item(i)<>"" then
    act.WriteLine "<font face=Arial>"&cstr(rs.Fields.Item(i))&"</font>"
    end if
    act.WriteLine "</td>"
    next
    act.WriteLine "</tr>"
    rs.MoveNext
    loop
    act.WriteLine "</table>"
    act.WriteLine "</body>"
    act.WriteLine "</html>"
    ' close the document
    act.close
    rs.Close
    end function
    %>
    5-Sitenize Tavsiye Menüsü Ekleyin
    Kod:
    <H3>Tavsiye v 1.0</H3>
    <%
    Dim objCDONTS
    Dim strFromName
    Dim strFromEmail, strToEmail
    Dim strSubject, strBody
    Dim strThisPage
    Dim strReferringPage
    Dim bValidInput
    
    strThisPage = Request.ServerVariables("SCRIPT_NAME")
    strReferringPage = Request.ServerVariables("HTTP_REFERER")
    
    ' Debugging lines:
    'Response.Write strThisPage & "
    " & vbCrLf
    'Response.Write strReferringPage & "
    " & vbCrLf
    
    ' Read in and set the initial values of our message parameters
    strFromName = Trim(Request.Form("txtFromName"))
    strFromEmail = Trim(Request.Form("txtFromEmail"))
    strToEmail = Trim(Request.Form("txtToEmail"))
    strSubject = "Check out ASP 101!"
    strBody = Trim(Request.Form("txtMessage"))
    
    
    ' I set the body message to a message that referenced the page the
    ' user arrived from. This makes it great if you place a link to it
    ' from your different articles, but can be weird if people link in
    ' from other web sites.
    If strBody = "" Then
    If strReferringPage = "" Or InStr(1, strReferringPage, "www.veritabanim.com", 1) = 0 Then
    strBody = ""
    strBody = strBody & "Bu site harika bir site.Mutlaka gez..." & vbCrLf
    strBody = strBody & vbCrLf
    strBody = strBody & " http://www.veritabanim.com" & vbCrLf
    Else
    strBody = ""
    strBody = strBody & "Bu siteyi mutlaka gezmelisin" & vbCrLf
    strBody = strBody & vbCrLf
    strBody = strBody & " " & strReferringPage & vbCrLf
    End If
    End If
    
    ' Quick validation just to make sure our parameters are somewhat valid
    bValidInput = True
    bValidInput = bValidInput And strFromName <> ""
    bValidInput = bValidInput And IsValidEmail(strFromEmail)
    bValidInput = bValidInput And IsValidEmail(strToEmail)
    
    ' If valid send email and show thanks, o/w show form
    If bValidInput Then
    ' Set up our email object and send the message
    Set objCDONTS = Server.CreateObject("CDONTS.NewMail")
    objCDONTS.From = strFromName & " <" & strFromEmail & ">"
    objCDONTS.To = strToEmail
    objCDONTS.Subject = strSubject
    objCDONTS.Body = strBody
    objCDONTS.Send
    Set objCDONTS = Nothing
    
    ' Show our thank you message
    ShowThanksMsg
    Else
    If "http://" & Request.ServerVariables("HTTP_HOST") & strThisPage = strReferringPage Then
    Response.Write "Lutfen bos alan birakmayin.Mail adreslerini dogru yazin" & "
    " & vbCrLf
    End If
    ' Show our information retrieval form
    ShowReferralForm strThisPage, strFromName, strFromEmail, strToEmail, strBody
    End If
    ' End of page logic... subs and functions follow!
    %>
    
    
    <%
    ' Subroutines and Functions that encapsulate some functionality
    ' and make the above code easier to write... and read.
    
    ' A quick email syntax checker. It's not perfect,
    ' but it's quick and easy and will catch most of
    ' the bad addresses than people type in.
    Function IsValidEmail(strEmail)
    Dim bIsValid
    bIsValid = True
    
    If Len(strEmail) < 5 Then
    bIsValid = False
    Else
    If Instr(1, strEmail, " ") <> 0 Then
    bIsValid = False
    Else
    If InStr(1, strEmail, "@", 1) < 2 Then
    bIsValid = False
    Else
    If InStrRev(strEmail, ".") < InStr(1, strEmail, "@", 1) + 2 Then
    bIsValid = False
    End If
    End If
    End If
    End If
    
    IsValidEmail = bIsValid
    End Function
    
    ' I made this a function just to get it out of the
    ' logic and make it easier to read. It just shows the
    ' form that asks for the input
    Sub ShowReferralForm(strPageName, strFromName, strFromEmail, strToEmail, strBody)
    ' I use script_name so users can rename this script witout having to change the code.
    %>
    <FORM ACTION="<%= strPageName %>" METHOD="post" name=frmReferral>
    <TABLE BORDER="0">
    <TR>
    <TD VALIGN="top" ALIGN="right">Adiniz:</TD>
    <TD><INPUT TYPE="text" NAME="txtFromName" VALUE="" SIZE="30"></TD>
    </TR>
    <TR>
    <TD VALIGN="top" ALIGN="right">Sizin Mailiniz:</TD>
    <TD><INPUT TYPE="text" NAME="txtFromEmail" VALUE="" SIZE="30"></TD>
    </TR>
    <TR>
    <TD VALIGN="top" ALIGN="right">Arkadasinizin Maili:</TD>
    <TD><INPUT TYPE="text" NAME="txtToEmail" VALUE="" SIZE="30"></TD>
    </TR>
    <TR>
    <TD VALIGN="top" ALIGN="right">Mesaj:</TD>
    <TD><TEXTAREA NAME="txtMessage" COLS="50" ROWS="5" WRAP="virtual" READONLY></TEXTAREA>
    </TR>
    <TR>
    <TD></TD>
    <TD><INPUT TYPE="reset" VALUE="SİL" name=rstReferral> <INPUT TYPE="submit" VALUE="GÖNDER" name=subReferral></TD>
    </TR>
    </TABLE>
    </FORM>
    <%
    '
    
    The Message to be sent:</P>
    '
    
    Subject: < %= strSubject % ></P>
    '
    
    Body: < %= strBody % ></P>
    End Sub
    
    ' This just shows our thank you message... probably didn't need to
    ' be a function, but since I made the form one I figured I'd do this
    ' for consistency.
    Sub ShowThanksMsg()
    %>
    
    
    </P>
    <%
    End Sub
    %>
    6- il il hava durumu
    Kod:
    kod:
    <%
    if request.QueryString ("il")<>"" then
    il=request.QueryString ("il")
    else
    il="BILECIK"
    end if
    const Request_GET = 2
    Dim haberURL, haberim, basliklar
    haberURL = "<A href="http://meteo.tr.net/cgi-bin/wfa.pl?"&il">http://meteo.tr.net/cgi-bin/wfa.pl?"&il
    Set alma = CreateObject("SOFTWING.ASPtear" )
    On Error Resume Next
    haberim = alma.Retrieve(haberURL, Request_GET, "" , "" , "" )
    If Err.Number <> 0 Then
    Response.Write "HATA!!!!!!! Lütfen Sayfayi Yeniden Yükleyiniz... "
    Response.End
    End If
    lenstr=308+len(il)
    haberim=Mid(haberim,9166,lenstr)
    ds=InStr(1,haberim,"°C" )
    sicaklik=Mid(haberim,ds-5,7)
    sicaklik=Replace(sicaklik,">" ,"" )
    ds=InStr(1,haberim,"alt" )
    de=InStr(1,haberim,"°C" )
    durum=Mid(haberim,ds+5,de-ds-15)
    durum=Replace(durum,"""" ,"" )
    if Cstr(durum)=Cstr("Az Bulutlu") then
    resim="azbulutlu"
    elseif Cstr(durum)=Cstr("Sagnak Yagisli") then
    resim="yagmurlu"
    end if
    %>
    
    <TABLE WIDTH=50% ALIGN=center BORDER=1 CELLSPACING=1 CELLPADDING=1>
    <TR align=center>
    <TD colspan=4><IMG SRC="havadurumu.jpg" width=600 height=30></TD>
    </TR>
    <TR align=center>
    <TD>Il:</TD>
    <TD>Sicaklik:</TD>
    <TD>Durum:</TD>
    <TD>&nbsp;</TD>
    </TR>
    <TR align=center>
    <TD><%=il%></TD>
    <TD><%=sicaklik%></TD>
    <TD><%=durum%></TD>
    <TD><img SRC="image/<%=resim%>.gif"></TD>
    </TR>
    </TABLE>
    <TABLE WIDTH=20% ALIGN=center BORDER=1 CELLSPACING=1 CELLPADDING=1>
    <TR>
    <td align=left bgcolor=ffffff nowrap>
    <font face=tahoma size=1><b>Yurtiçi Merkezler :</b></font>
    <select style="font-size:10px;" name="LOCATION" width=120 onChange="window.location=this.options[this.selectedIndex].value; return true">
    <option value=havadurumu.asp?il=ANKARA>Seçiniz</option>
    <option value=havadurumu.asp?il=ADANA>ADANA
    <option value=havadurumu.asp?il=ADIYAMAN>ADIYAMAN
    <option value=havadurumu.asp?il=AFYON>AFYON
    <option value=havadurumu.asp?il=AGRI>AGRI
    <option value=havadurumu.asp?il=AKSARAY>AKSARAY
    <option value=havadurumu.asp?il=AMASYA>AMASYA
    <option value=havadurumu.asp?il=ANKARA>ANKARA
    <option value=havadurumu.asp?il=ANTALYA>ANTALYA
    <option value=havadurumu.asp?il=ARDAHAN>ARDAHAN
    <option value=havadurumu.asp?il=ARTVIN>ARTVIN
    <option value=havadurumu.asp?il=AYDIN>AYDIN
    <option value=havadurumu.asp?il=BALIKESIR>BALIKESIR
    <option value=havadurumu.asp?il=BARTIN>BARTIN
    <option value=havadurumu.asp?il=BATMAN>BATMAN
    <option value=havadurumu.asp?il=BAYBURT>BAYBURT
    <option value=havadurumu.asp?il=BILECIK>BILECIK
    <option value=havadurumu.asp?il=BINGOL>BINGOL
    <option value=havadurumu.asp?il=BITLIS>BITLIS
    <option value=havadurumu.asp?il=BOLU>BOLU
    <option value=havadurumu.asp?il=BOZCAADA>BOZCAADA
    <option value=havadurumu.asp?il=BURDUR>BURDUR
    <option value=havadurumu.asp?il=BURSA>BURSA
    <option value=havadurumu.asp?il=CANAKKALE>CANAKKALE
    <option value=havadurumu.asp?il=CANKIRI>CANKIRI
    <option value=havadurumu.asp?il=CORUM>CORUM
    <option value=havadurumu.asp?il=DENIZLI>DENIZLI
    <option value=havadurumu.asp?il=DIYARBAKIR>DIYARBAKIR
    <option value=havadurumu.asp?il=DUZCE>DUZCE
    <option value=havadurumu.asp?il=EDIRNE>EDIRNE
    <option value=havadurumu.asp?il=ELAZIG>ELAZIG
    <option value=havadurumu.asp?il=ERZINCAN>ERZINCAN
    <option value=havadurumu.asp?il=ERZURUM>ERZURUM
    <option value=havadurumu.asp?il=ESKISEHIR>ESKISEHIR
    <option value=havadurumu.asp?il=GAZIANTEP>GAZIANTEP
    <option value=havadurumu.asp?il=GIRESUN>GIRESUN
    <option value=havadurumu.asp?il=GOKCEADA>GOKCEADA
    <option value=havadurumu.asp?il=GUMUSHANE>GUMUSHANE
    <option value=havadurumu.asp?il=HAKKARI>HAKKARI
    <option value=havadurumu.asp?il=HATAY>HATAY
    <option value=havadurumu.asp?il=IGDIR>IGDIR
    <option value=havadurumu.asp?il=ISPARTA>ISPARTA
    <option value=havadurumu.asp?il=ISTANBUL>ISTANBUL
    <option value=havadurumu.asp?il=IZMIR>IZMIR
    <option value=havadurumu.asp?il=K.MARAS>K.MARAS
    <option value=havadurumu.asp?il=KARABUK>KARABUK
    <option value=havadurumu.asp?il=KARAMAN>KARAMAN
    <option value=havadurumu.asp?il=KARS>KARS
    <option value=havadurumu.asp?il=KASTAMONU>KASTAMONU
    <option value=havadurumu.asp?il=KAYSERI>KAYSERI
    <option value=havadurumu.asp?il=KILIS>KILIS
    <option value=havadurumu.asp?il=KIRIKKALE>KIRIKKALE
    <option value=havadurumu.asp?il=KIRKLARELI>KIRKLARELI
    <option value=havadurumu.asp?il=KIRSEHIR>KIRSEHIR
    <option value=havadurumu.asp?il=KOCAELI>KOCAELI
    <option value=havadurumu.asp?il=KONYA>KONYA
    <option value=havadurumu.asp?il=KUTAHYA>KUTAHYA
    <option value=havadurumu.asp?il=MALATYA>MALATYA
    <option value=havadurumu.asp?il=MANISA>MANISA
    <option value=havadurumu.asp?il=MARDIN>MARDIN
    <option value=havadurumu.asp?il=MERSIN>MERSIN
    <option value=havadurumu.asp?il=MUGLA>MUGLA
    <option value=havadurumu.asp?il=MUS>MUS
    <option value=havadurumu.asp?il=NEVSEHIR>NEVSEHIR
    <option value=havadurumu.asp?il=NIGDE>NIGDE
    <option value=havadurumu.asp?il=ORDU>ORDU
    <option value=havadurumu.asp?il=OSMANIYE>OSMANIYE
    <option value=havadurumu.asp?il=RIZE>RIZE
    <option value=havadurumu.asp?il=SAKARYA>SAKARYA
    <option value=havadurumu.asp?il=SAMSUN>SAMSUN
    <option value=havadurumu.asp?il=SANLIURFA>SANLIURFA
    <option value=havadurumu.asp?il=SIIRT>SIIRT
    <option value=havadurumu.asp?il=SINOP>SINOP
    <option value=havadurumu.asp?il=SIRNAK>SIRNAK
    <option value=havadurumu.asp?il=SIVAS>SIVAS
    <option value=havadurumu.asp?il=TEKIRDAG>TEKIRDAG
    <option value=havadurumu.asp?il=TOKAT>TOKAT
    <option value=havadurumu.asp?il=TRABZON>TRABZON
    <option value=havadurumu.asp?il=TUNCELI>TUNCELI
    <option value=havadurumu.asp?il=USAK>USAK
    <option value=havadurumu.asp?il=VAN>VAN
    <option value=havadurumu.asp?il=YALOVA>YALOVA
    <option value=havadurumu.asp?il=YOZGAT>YOZGAT
    <option value=havadurumu.asp?il=ZONGULDAK>ZONGULDAK
    </select>
    </td>
    </TR>
    </TABLE>
    Sorun yaşarsanız eğer size ben ve diğer yetklili arkadaşlar yardımcı olacaktır



  2. Alev
    Özel Üye

    Her WebMastere Lazım Asp Kodları %100 Makalesine henüz yorum yazılmamış. ilk yorumu siz yapın


Sponsor Bağlantılar
+ Yorum Gönder
5 üzerinden 5.00 | Toplam : 1 kişi