İşinize çok yarayacak asp kodları burda
Bu kodlar sayesinde istediğiniz sayfalara şifresiz girilmesini engelliyebilirsiniz.Sadece bu kodları sifre.asp olarak kaydediyoruz ve şifrelenecek sayfalara
" yöntemi ile ekliyoruz
<%
logstatus=request.QueryString("logadm")
if logstatus="true" then
session("user_admin")=""
session.Contents.RemoveAll()
session.Abandon()
'response.Redirect("Cikistamamlaninca yonlenecek sayfa")
end if
action=request.form("action")
if action="login" then
kullanici=trim(request.Form("kullanici"))
sifre=trim(request.Form("sifre"))
if kullanici="lugelas" AND sifre="lugelas" then
session.Timeout=180
session("user_admin")="admin"
response.Redirect("giristamam.asp")
else
error_msg="Yanlış kullanıcı veya şifre"
end if
end if
%>
<html>
<head>
<title>Admin giris</title>
<meta ***********="Content-Type" content="text/html; charset=windows-1254">
</head>
<body>
</p>
</p>
<form action="default.asp" method="post" name="giris" target="_top" id="giris" >
<table width="256" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#FF0099">
<tr>
<td>
<table width="254" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#CCCCCC">
<tr>
<td colspan="2"><div align="center"><font color="#990000"><%=error_msg%> </font></div></td>
</tr>
<tr>
<td width="95">Kullanıcı</td>
<td width="305"><input name="kullanici" type="text" id="kullanici" size="19" maxlength="20" style="width:100"></td>
</tr>
<tr>
<td>Şifre</td>
<td><input name="sifre" type="password" id="sifre" size="20" maxlength="20" style="width:100"></td>
</tr>
<tr>
<td> </td>
<td><input name="Submit" type="submit" class="submit" value="Giriş">
<input name="action" type="hidden" id="action" value="login"></td>
</tr>
</table>
</td></tr></table>
</form>
</body>
</html>
Cv: İşinize çok yarayacak asp kodları burda
Bu kodlar ile istediğiniz sayfayı ziyaretçinizin arkadaşına tavsiye etmesini sağlayabilirsiniz.
<H3>Tavsiye </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.prowww.net", 1) = 0 Then
strBody = ""
strBody = strBody & "Bu site harika bir site.Mutlaka gez..." & vbCrLf
strBody = strBody & vbCrLf
strBody = strBody & " http://www.prowww.net" & 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
%>
Cv: İşinize çok yarayacak asp kodları burda
Üyelik sistemi olmayan veya üyelik sistemi ile çalışmayan sayfalar kötü niyetli kişiler tarafından kullanılabilir. mesela, yorum ekleme, guestbook gibi alanlara isteyen istedigi bilgiyi yazabilir.Bu kodlar ile küfür koruması yapabiliriz.
<%
badwordFilter = "Acik"
Dim badword
badword = "fuck|suck|***"
metin = Request.Form("metin" )
strwords = Split(badword, "|" )
For I = 0 to Ubound(strwords)
metin = Replace(metin, strwords(I), String(Len(strwords(I)),"*" ), 1,-1,1)
next
If badwordFilter= "Acik" Then
Response.Write metin
else
Response.Write metin
End If
%>
Cv: İşinize çok yarayacak asp kodları burda
Telif hakkı tarihi.
<%
Dim yil ' yil tanimlandi
yil = DatePart("yyyy",Now()) ' yil icin tarih bilgisi aliyoruz
%>
Telif hakkı © 2000-<%=yil%> 'Bu bölüm de başlangıç yılını biz belirliyoruz, şu anki zamanı ise asp ile öğreniyoruz.
Cv: İşinize çok yarayacak asp kodları burda
Global.asa ile aktif üyeleri sitemizde gösterebiliriz.
// 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
%>
Cv: İşinize çok yarayacak asp kodları burda
Fso ile klasör arama .
<html>
<body>
<%
Set fs=Server.CreateObject("Scripting.FileSystemObject ")
If fs.FolderExists("c:\temp") = true Then
Response.Write("Klasör bulundu.")
Else
Response.Write("Klasör bulunamadı.")
End If
set fs=nothing
%>
</body>
</html>
Cv: İşinize çok yarayacak asp kodları burda
Kod : ASP asıl olarak sunucu tarafında betik oluşturmak ve işletmek için kullanılıyor olsa da istemci tarayıcı tarafından kullanılmak üzere, istemci tarafındaki betikleri oluşturmak üzere kullanılıp, kullanım alanını genişletilebilir. Tarayıcıya gönderilen betik komutlarını biraraya getiren sunucu tarflı betikler yazabilirsiniz.
Bunu, istemci tarafındaki HTML açıklamaları ile çevrelenmiş betikler ile ayraçlar tarafından çevrelenmiş sunucu tarafındaki betikleri birleştirerek yapabilirsiniz:
<SCRIPT LANGUAGE="VBScript">
<!--
istemci betiği
<% sunucu betiği %>
istemci betiği
<% sunucu betiği %>
istemci betiği
...
-->
</SCRIPT>
Betiklerinizdeki bu işlevsellikle, ilginç uygulamalar yapabilirsiniz. Örneğin, aşağıdaki betik, kullanıcının Web tarayıcısı üzerinde çalışan çeşitli istemci-betik altyordamlar oluşturur.
<%
ServerTime = Time
ServerDate = Date
For i = 1 to 4
Randomize
GreetCondition = int(rnd * 3)
%>
<SCRIPT LANGUAGE="VBScript">
<!--
Sub ServeInfo<%= i %>()
Select Case <%= GreetCondition%>
Case 0
Msg = "Merhaba, saat <%= ServerTime %>."
Case 1
Msg = "Hosgeldiniz! Bugünün tarihi <%= ServerDate %>."
Case 2
Msg = "Selam, saat <%= ServerTime %> ve tarih <%= ServerDate %>."
End Select
Document.Write Msg
End Sub
ServeInfo<%= i %>()
//-->
</SCRIPT>
<%Next%>
Bir önceki betikde, ASP saat ve tarih bilgilerini kullanıcıdan yeniden getiriyor ve kullanıcı Web sunucusu üzerinde çalıştırılmak üzere altyordamlar oluşturmak için birtakım döngüler yapar. Bu istemci taraflı her altyordam, rastgele seçilmiş karşılamalar yapar, saat ve tarih bilgilerini görüntüler.
Bu çeşit betikler genişletilebilir.Örneğin, özel bir istemci taraflı betiğe ya da bileşene, ActiveX kontrol gibi, konfigürasyon bilgilerini getirmek ve dağıtmak. Bu betikleme tekniklerini akıllıca kullanarak, Web sunucunun, kullanıcı bilgi istemlerini işletme ve döndürmesi için harcadığı zamanı azaltır.
Cv: İşinize çok yarayacak asp kodları burda
Şifrelerinizi korumak için yazılmış bir uygulama. orjinal şifreye sadık kalarak bir yöntemle bu şifrenin karıştırılıp başkaları tarafından okunmasını engeller
<%
function Encrypt(Text,Password)
Dim TextCharCode, PasswordCharCode, NewCharCode
For Char = 1 To LEN(Text)
TextCharCode = ASC(MID(Text,Char,1))
PasswordCharCode = ASC(MID(Password,(Char MOD LEN(Password) + 1),1))
NewCharCode = TextCharCode + PasswordCharCode
if NewCharCode > 255 Then NewCharCode = NewCharCode -255
Encrypt = Encrypt & CHR(NewCharCode)
NEXT
End function
function Decrypt(Code,Password)
Dim CodeCharCode, PasswordCharCode, OriginalCharCode
For Char = 1 To LEN(Code)
CodeCharCode = ASC(MID(Code,Char,1))
PasswordCharCode = ASC(MID(Password,(Char MOD LEN(Password) + 1),1))
OriginalCharCode = CodeCharCode - PasswordCharCode
if OriginalCharCode < 1 Then OriginalCharCode = OriginalCharCode + 255
Decrypt = Decrypt & CHR(OriginalCharCode)
NEXT
End function
%>
Cv: İşinize çok yarayacak asp kodları burda
Cv: İşinize çok yarayacak asp kodları burda
güzel çalışma jackal ellerine saglık