-
Hazır ASP Kodları
IP Banlama..
<%
Dim ipno
Dim Toplam
'Burada array listesini tanimliyoruz (unutmayin ki 0 = 1 degerini alir, 1 = 2 degerini alir)
Dim Ip_array(5)
'Kulanicinin ip adresini aliyoruz
ipno = Request.ServerVariables("REMOTE_ADDR")
'Toplam array sayisini belirtiyoruz
Toplam = 5
'Bloke edilen ip numaralari (Databasetende yapabilirsiniz)
Ip_array(0) = "127.0.0.1"
Ip_array(1) = "202.56142.41"
Ip_array(3) = "12.232.31.166"
Ip_array(4) = "12.245.59.175"
Ip_array(5) = "149.99.116.62"
'Döngüye giriyoruz
For I = 0 to Toplam
If Ip_array(I) = ipno Then
'Eger giren kullanicinin ip`si ban listesinde mevcut ise banlanmissiniz diye bir sayfa gosteriyoruz
Response.Redirect "ban.asp"
End If
Next
%>
-
Hazır ASP Kodları
Asp ile Excel'den veri alma..
<%
'Degeri sifir yaptik ve geçici bellekte veri saklanmasini önledik
Response.Expires = 0
'Baglanti nesnesi olusturduk
Set DB = Server.CreateObject("ADODB.Connection")
DB = "Driver={Microsoft Excel Driver (*.xls)}; DBQ=deneme.xls;" 'Veritabanimizin yerini belirttik
Baglanti.Open DB 'Veritabanimizi açtik
Set rsEx = Server.CreateObject("ADODB.Recordset")
strSQL = "Select * From tabloadi"
rsEx.Open strSQL, Baglanti
'Verileri yazdiriyoruz.
Response.Write ("<table border=1><tr><td>")
Response.Write rsEx.GetString (, 10, "</tr><td>", "</td></tr><tr><td>", NBSPACE)
%>
-
Hazır ASP Kodları
Serverdaki yüklü Componentleri bulma..
<%@ LANGUAGE="VBSCRIPT" %><%
Response.Expires = 0
Response.buffer=false
On Error Resume Next
objcheckversion=1
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<style>
td {
font-family: Verdana,Arial;
font-size: 10pt;
}
.status {
font-family: Verdana,Arial;
font-size: 10pt;
}
</style>
<title>Installed Objects Scanner</title>
</head>
<body bgcolor="#FFFFFF" leftmargin="40" marginwidth="40" marginheight="40">
<%
Response.Write("<div class=" "status" " id=" "status" ">Please wait...
" )
Dim strList
Dim Output
'the following Function gets the stAndard components names from my webserver
'Leave this URL as is!
ListURL = "http://www.bier-voting.de/objcheck/objects.asp"
Function GetURL2(URL)
Set objHTTP = Server.CreateObject("Microsoft.XMLHTTP" )
objHTTP.Open "GET" , URL, false
objHTTP.sEnd
strList = CStr(objHTTP.ResponseText)
Set objHTTP = Nothing
End Function
Function GetURL(URL)
Set xmlhttp = Server.CreateObject("MSXML2.ServerXMLHTTP" )
xmlhttp.Open "GET" , url, false
xmlhttp.send()
strList = CStr(xmlhttp.responseText)
Set xmlhttp = Nothing
End Function
Function IsObjInstalled(strClassString)
' initialize default values
IsObjInstalled = False
Err = 0
' testing code
Dim xTestObj
Set xTestObj = Server.CreateObject(strClassString)
If 0 = Err Then
IsObjInstalled = True
End If
' cleanup
Set xTestObj = Nothing
Err = 0
End Function
If IsObjInstalled("MSXML2.ServerXMLHTTP" ) Then
method = 1
ElseIf IsObjInstalled("Microsoft.XMLHTTP" ) Then
method = 2
Else
method = 0
End If
Err = 0
'For adding new classnames To the list And For statistical things, And For my pleasure ;-)
ListURL = ListURL & "?site=" & Server.URLEncode(Request.ServerVariables("SERVER_N AME" ) & Request.ServerVariables("URL" ))
If request("classname" ) <> "" Then
ListURL = ListURL & "&classname=" & request("classname" )
End If
rAndomize
ListURL = ListURL & "&nocache=" & Server.URLEncode(rnd*10000)
If method=1 OR method=2 Then
Response.Write("Getting list...
" )
GetURL(ListURL)
If Not 0 = Err Then
Response.Write("MSXML2.ServerXMLHTTP not available, using Microsoft.XMLHTTP ...
" )
GetURL2(ListURL)
End If
Err = 0
arrList = Split(strList,vbNewLine)
Response.Write("Testing...
</div>" )
strClass = Trim(Request.Form("classname" ))
If "" <> strClass Then
Output = Output & strClass & " is "
If Not IsObjInstalled(strClass) Then
Output = Output & "not installed!"
Else
Output = Output & "installed!"
End If
Output = Output & "
" & vbCrLf
Else
' Default: Check the whole list
AnzahlComponenten = Ubound(arrList)-1
Output = Output & "<table align=" "center" " border=" "0" ">"
For i=0 To (Ubound(arrList)-1)
If not (Left(arrList(i),12) = "KevinKempfer" ) Then
If Not IsObjInstalled(arrList(i)) Then
If Not Request.Form("nurpositiv" ) = "True" Then
Output = Output & "<tr><td>" & arrList(i) & "</td><td>is not installed!"
End If
Else
Output = Output & "<tr><td>" & arrList(i) & "</td><td>is installed!"
End If
Output = Output & "</td></tr>" & vbCrLf
Else
If CInt(Right(arrList(i),1)) > objcheckversion Then
UpdateAvailable = true
End If
End If
Next
Output = Output & "</table>"
End If
%>
<script language="JavaScript">
document.all.status.style.visibility="hidden";
</script>
<table width="100%" border="1" cellspacing="0" cellpadding="5" bgcolor="#FF9933" bordercolor="#000000">
<tr>
<td> <font color="#990000" size="5">KOMPONENTENLISTE</font>
für den Server <font color="#990000"><%= Request.ServerVariables("LOCAL_ADDR" ) %>
<font color="#999999">Componentlist for IP <%= Request.ServerVariables("LOCAL_ADDR" ) %></font>
</font></td>
</tr>
</table>
<font face="Verdana,Arial,'Microsoft Sans Serif'"> Geben Sie die ProgID oder ClassId
einer Komponente ein um zu testen, ob sie am Server installiert ist. Wenn Sie
das Textfeld leer lassen, so werden einige StAndard-Komponenten getestet.
<font size="-1" color="#999999">Enter a component's ProgID or ClassID to check
if it's installed on this server (<%= Request.ServerVariables("LOCAL_ADDR" ) %>).
Leave the input field empty to check numerous stAndard components.</font><font size="-1"></font><font size="-1">
</font>
<font face="Verdana,Arial,'Microsoft Sans Serif'">Wollen Sie Ihren eigenen Server testen? <a href="http://www.bier-voting.de/objcheck/query.zip">Skript downloaden</a>, auf dem eigenen Server aufrufen, fertig.</font>
<font size="-1" color="#999999">Want to check your own server? <a href="http://www.bier-voting.de/objcheck/query.zip">Download the script</a> And run it from your site.</font>
</font>
<% If UpdateAvailable Then %>
<table width="70%" border="1" cellspacing="0" cellpadding="5" align="center" bgcolor="#CCCCCC" bordercolor="#000000">
<tr>
<td>
<center>
Achtung Webmaster! Es ist ein Update für ObjCheck verfügbar! <a href="http://www.bier-voting.de/objcheck/">Klicken Sie hier</a>, um zur Downloadseite zu wechseln.
Attention Webmaster! There's an update available! Please <a href="http://www.bier-voting.de/objcheck/">check the download-site</a>!
</center>
</td>
</tr>
</table>
<%End If %>
<table width="70%" border="1" cellspacing="0" cellpadding="5" align="center" bgcolor="#CCCCCC" bordercolor="#000000">
<tr>
<td>
<form action=<%=Request.ServerVariables("SCRIPT_NAME" ) %> method=post>
<center>
<input type="text" value="" name="classname" size=40>
<input type="checkbox" name="nurpositiv" value="True">
Nur installierte Komponenten anzeigen
<font color="#999999">Show only installed Components</font>
<input type=submit value=>> Test <<>
Note: Do not enter your website URL or IP, <a href="http://www.bier-voting.de/objcheck/query.zip">download the script</a> instead.
</center>
</form>
</td>
</tr>
</table>
<font face="Verdana,Arial,'Microsoft Sans Serif'">
<div align="center">Currently checking for <%= AnzahlComponenten %> components.</div>
</font> <%= Output %>
<table width="100%" border="1" cellspacing="0" cellpadding="5" bgcolor="#FF9933" bordercolor="#000000">
<tr>
<td>
<font face="Verdana,Arial,'Microsoft Sans Serif'">Dieses ASP-Skript ist Freeware von . Wenn Sie meinen, Ihre Komponente sollte auch in dieser Liste vertreten sein, <a href="[email protected]">kontaktiere n Sie mich.
<font size="-1" color="#999999">This asp-script is freeware by . If you think your components should be listed here, <a href="[email protected]">contact me.
</font> </font>
<% Else %>
Error: This script only works with the "MSXML2.ServerXMLHTTP" Component
or "Microsoft.XMLHTTP" Component installed on the server. This should be
done by default at IIS installation. So check your IIS or contact your provider.
<% End If %>
</td>
</tr>
</table>
</body>
</html>
-
Hazır ASP Kodları
Sitedeki Aktif Ziyaretçiler..
// GLOBAL.ASA
<SCRIPT LANGUAGE=VBScript RUNAT=Server>
Sub Application_OnStart
Application("Ziyaretciler") = 0
End Sub
Sub Session_OnStart
Session.Timeout = 10
Session("Start") = Now
Session("Uye_Adi") = Request.Cookie("Snitz00User")("name")
If Session("name") = "" Then
Session("name") = "Misafir"
End If
If Not InStr(Application("Aktif_Uyeler"), Session("name")) Then
Application.Lock
Application("Aktif_Uyeler") = Application("Aktif_Uyeler") & Session("name") & "||"
Application.UnLock
End If
Application.Lock
Application("Ziyaretciler") = Application("Ziyaretciler") + 1
Application.UnLock
End Sub
Sub Session_OnEnd
If Len(Session("name")) > 0 Then
Application.Lock
Application("Aktif_Uyeler") = Replace(Application("Aktif_Uyeler"), Session("name") & "||", "")
Application.UnLock
End If
Application.Lock
Application("Ziyaretciler") = Application("Ziyaretciler") - 1
Application.UnLock
Session("name") = ""
End Sub
</SCRIPT>
// online.asp
<%
arr_Uyeler = Split(Application("Aktif_Uyeler" ), "||" )
For i = 0 To Ubound(arr_Uyeler) - 1
If arr_Uyeler(i) <> "Misafir" Then
End If %>
<table width="94%" border="0" align="center">
<tr>
<td><font face="Tahoma" color="#000000" size="2">[*]<%= arr_Uyeler(i) %>
</font></td>
</tr>
</table>
<%
Next
%>
-
Hazır ASP Kodları
NTV Haberleri Almak..
<%
alinacakadres = "http://www.ntvmsnbc.com/news/BCList2.txt"
Set Tear_ac = CreateObject("SOFTWING.ASPtear" )
dim bilgicek
bilgicek = Tear_ac.Retrieve(alinacakadres , 2, "" , "" , "" )
nereden="Güncel Ön Sayfa"
nereye="+UYUM YASASI"
baslanacakyer=InStr(bilgicek,nereden)+15
bitecekyer=InStr(bilgicek,nereye)
baslangic=0
son=0
alinacakbolum=Mid(bilgicek,baslanacakyer,bitecekye r-baslanacakyer)
For a= 1 to 100
t=Len(alinacakbolum)
If t<=0 Then
exit For
End If
c=InStr(alinacakbolum,Chr(10))
If c<=0 Then
exit For
End If
alinacakbolum=Right(alinacakbolum,t-c)
baslangic=InStr(alinacakbolum,"/news/./" )
son=InStr(alinacakbolum,Chr(10))
If baslangic<=0 or son<=0 or son<baslangic Then
else
satir=Mid(alinacakbolum,baslangic,son-baslangic)
If InStr(satir,"/news/./" )=0 or Len(satir)<20 Then
else
ekle=ekle & satir & "
"
End If
End If
next
ekle=Replace(ekle,"/news/./" ,"<a href='http://www.ntvmsnbc.com/news/" ,1,-1,1)
ekle=Replace(ekle,"|" ,"'>" ,1,-1,1)
ekle=Replace(ekle,Chr(10),"</a>" ,1,-1,1)
Response.Write "<font face=verdana size=1 color=black>" & ekle & "</font>"
%>
-
Hazır ASP Kodları
Döviz Kurlarını Alma..
<%
Public Function VeriAl(strGelen)
Set objVeriAl = Server.CreateObject("Microsoft.XMLHTTP" )
objVeriAl.Open "GET" , strGelen, FALSE
objVeriAl.sEnd
VeriAl = objVeriAl.Responsetext
SET objVeriAl = Nothing
End Function
strAdres = "http://www.tcmb.gov.tr/kurlar/today.html"
strVeri = VeriAL(strAdres)
iDolar=InStr(strVeri,"USD" )
strDolarAlis=Mid(strVeri,iDolar+39,10)
strDolarSatis=Mid(strVeri,iDolar+52,10)
iEuro=InStr(strVeri,"EUR" )
strEuroAlis=Mid(strVeri,iEuro+39,11) 'alis
strEuroSatis=Mid(strVeri,iEuro+52,11) 'satis
%>
-
Hazır ASP Kodları
Hava Durumunu Alma..
<%
const Request_GET = 2
Dim haberURL, haberim, basliklar
haberURL = "http://www.tr.net"
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
dim baslangic , bitis
baslangic = "<table border=0 cellpadding=0 cellcpacing=0>"
bitis = "</table>"
dim x , abc
x = 0
abc = 0
dim lale
lale = ""
Do Until abc = 2
x = x + 1
If Mid(haberim,x,Len(bitis)) = bitis And abc = 1 Then
abc = abc + 1
End If
If Mid(haberim,x,Len(baslangic)) = baslangic Then
abc = abc + 1
Else
If abc = 1 Then
lale = lale + Mid(haberim,x,1)
End If
End If
Loop
Function seklesok(hammadde)
Dim gecicigeyik
gecicigeyik = hammadde
gecicigeyik = Replace(gecicigeyik, "" , "" , 1, -1, 1)
gecicigeyik = Replace(gecicigeyik, "" , "" & vbCrLf, 1, -1, 1)
seklesok = gecicigeyik
End Function
Response.Write "<"
Response.Write seklesok(lale)
Response.Write "</table>"
%>
-
Hazır ASP Kodları
Basit Bir Hit Saydırma Sayacı..
<%
Set Sur = Server.CreateObject("ADODB.Connection" )
Sur.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("veritabanımız.mdb" )
%>
<%
'Baglantı dosyamızı include ettiğimize göre artık veritabanından bilgilerimizi alabiliriz
Set rs = Server.CreateObject("ADODB.Recordset" )
sor = "Select * from tablo"
frestons.Open sor,Sur,1,3
' veritabanimizla baglantimizi kurduk..
rs("hit" ) = rs("hit" ) + 1
rs.update
%>
-
Hazır ASP Kodları
Sayfanın Yüklenme Zamanı..
<%
'
Dim SatirBaslangicZamani
SatirBaslangicZamani = Timer
Response.Write "Baslangic Zamani: " & SatirBaslangicZamani
Dim SatirBitisZamani
SatirBitisZamani = Timer
Response.Write "Bitis Zamani: " & SatirBitisZamani
Dim Hesap
Hesap = FormatNumber(SatirBitisZamani - SatirBaslangicZamani, 4) 'Burada yorumlanma suresinden talep edlme zamanını cıkarıyoruz..
Response.Write "Bu Sayfa [" & Hesap & "] saniyede yuklendi..." 'Cıkan sonucu yazıyoruz..
%>
-
Hazır ASP Kodları