|
#1
| ||||
| ||||
| Arkadaşlar olmassa olmaz kodlar... Ü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 %> |
|
#2
| ||||
| ||||
| 2 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 & "<BR>" & vbCrLf 'Response.Write strReferringPage & "<BR>" & 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" & "<BR>" & 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"><STRONG>Adiniz:</STRONG></TD> <TD><INPUT TYPE="text" NAME="txtFromName" VALUE="" SIZE="30"></TD> </TR> <TR> <TD VALIGN="top" ALIGN="right"><STRONG>Sizin Mailiniz:</STRONG></TD> <TD><INPUT TYPE="text" NAME="txtFromEmail" VALUE="" SIZE="30"></TD> </TR> <TR> <TD VALIGN="top" ALIGN="right"><STRONG>Arkadasinizin Maili:</STRONG></TD> <TD><INPUT TYPE="text" NAME="txtToEmail" VALUE="" SIZE="30"></TD> </TR> <TR> <TD VALIGN="top" ALIGN="right"><STRONG>Mesaj:</STRONG></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> <% '<P>The Message to be sent:</P> '<P><B>Subject:</B> < %= strSubject % ></P> '<P><B>Body:</B> < %= 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></P> <% End Sub %> |
|
#3
| ||||
| ||||
| 3 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> <br> <%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. |
|
#4
| ||||
| ||||
| 4 Ş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 %> |
|
#5
| ||||
| ||||
| 5 Deneme.html 'de girilen kelimeyi bu kod sayesinde gif olarak yazdirabilirsiniz. Deneme.html : ------------------------ <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=windows-1254"> <title>Gifler ile İsim Yazdırmak</title> </head> <body> <form method="POST" action="yazdir.asp"> <p align="center">Kelimeyi Giriniz:<input type="text" name="kelime" size="25"><input type="submit" value="Yazdir" name="submitwrite"></p> </form> </body> </html> ------------------------ Yazdir.asp : ------------------------ <% kelime = Request.Form("kelime") if kelime = "" then Response.Write "Lütfen Geçerli Bir Kelime Giriniz" Response.End end if for i = 1 to Len(kelime) x = Mid(kelime,i,1) if uCase(x) = x and isnumeric(x) = false then response.write "<img src='b"& x &".gif'>" else response.write "<img src='"& x &".gif'>" end if next %> |
|
#6
| ||||
| ||||
| 6 ASP de LinkStyle kullanımı yapmak istiyorsanız bu kodları kullanabilirsiniz. Bu kodları <HEAD> </HEAD> ın arasına koymanız yeterli olacaktır. şimdi buna göre bir link oluşturalım. <% response.write " < a href=index.asp class=link >DENEME</a>" %> response.write "<style type=text/css>" response.write "A.link" response.write "{" response.write "COLOR: black;" ' Linklerimizin rengini siyah yaptık .. response.write "TEXT-DECORATION: none" ' Linklerimizi çizgisiz yaptık. response.write "}" response.write "A.link:hover" response.write "{" response.write "COLOR: red;" ' Linklerimizin üzerine gelindiğinde rengi kırmızı olacak.. response.write "TEXT-DECORATION: none" ' Linklerimizin üzerine gelindiğinde çizgisiz olacak. response.write "}" response.write "}</style>" |
|
#7
| ||||
| ||||
| 7 sayfaya saat koyma Kodları eğer isterseniz ASP sayfanıza ekleyebilir veya sıfır bir ASP dosyası oluşturup onun içine ekleyerek include yoluyla diğer sayfalarınıza yerleştirebilirsiniz. <% 'our variables Dim dtmDate , dtmHour , dtmMinute , dtmSecond 'store the system time in dtmDate dtmDate = Now() 'now extract the hours dtmHour = Hour(dtmDate) 'now extract the minutes dtmMinute = Minute(dtmDate) 'now extract the seconds dtmSecond = Second(dtmDate) %> <% For i = 1 to Len(dtmHour) Response.Write "<img src=""images/1/" & Mid(dtmHour, i, 1) & ".gif" & """>" Next Response.Write ":" %> <% For i = 1 to Len(dtmMinute) Response.Write "<img src=""images/1/" & Mid(dtmMinute, i, 1) & ".gif" & """>" Next Response.Write ":" %> <% For i = 1 to Len(dtmSecond) Response.Write "<img src=""images/1/" & Mid(dtmSecond, i, 1) & ".gif" & """>" Next Response.Write ":" %> |
|
#8
| ||||
| ||||
| 8 yazı buyuteci Kullanmak istediğiniz sayfaya include etmeniz yeterli. <div id="yaz"><OBJECT ID="SG1" CLASSID="CLSID:369303C2-D7AC-11d0-89D5-00A0C90833E6" STYLE="position:absolute; top:250;left:-1000;width:2000;height:400"> </OBJECT></div> <script language=vbscript> sub document_onmousemove() dim b dim textrange dim yazi dim lib,ds set textrange = document.selection.createrange() yazi=textrange.text yazi = Replace(yazi, "ş", "s") yazi = Replace(yazi, "ğ", "g") yazi = Replace(yazi, "ı", "i") yazi = Replace(yazi, "İ", "I") yazi = Replace(yazi, "Ş", "S") yazi = Replace(yazi, "Ğ", "G") yazi = Replace(yazi, chr(13)&chr(10), " ") dim topyazi(50) b=1 if len(yazi)>255 then yazi=mid(yazi,1,255) for a=1 to len(yazi) if (a mod 50)=0 then b=b+1 topyazi(b)=mid(yazi,a-49,50) topyazi(b+1)=mid(yazi,a+1,50) end if posy=0 if len(yazi)<50 then topyazi(1)=yazi next set lib = SG1.Library set ds=SG1.DrawSurface ds.clear ds.FillStyle 1 ds.FillColor(lib.ColorRGB255(17,172,255)) ds.Font "Times", 30, 0, -1, 0, 0 for a=1 to ubound(topyazi) ds.Text (topyazi(a)), 0, a*38 next posy=document.body.scrolltop document.all.SG1.style.top=posy+100 document.all.SG1.style.left=-980 SG1.DrawSurface = ds end sub </SCRIPT> |
|
#9
| ||||
| ||||
| 9 analog saat gosterme Kodları .ASP uzantılı olacak şekilde kaydedip sunucunuza yollamanız ile birlikte kod çalışacaktır. <html> <head> <title>directx ve vbscript ile analog saat</title> </head> </html> <div id="saatim" style="position: absolute;"> <OBJECT ID=DRW STYLE="WIDTH:162; HEIGHT:162; Z-INDEX:1" CLASSID="CLSID:369303C2-D7AC-11d0-89D5-00A0C90833E6"> </OBJECT></div> <SCRIPT LANGUAGE=VBSCRIPT > <!-- 'yukarıdaki object tanımlaması zorunludur. 'HATIRLATMA!!!: en önce çizilen en altta kalır Dim resim, lib sub ciz() Dim zaman zaman = Now saat = Hour(zaman) dak=minute(zaman) san=second(zaman) 'saniye dakika ve saati değişkenlere attık set lib = DRW.Library set resim=DRW.DrawSurface 'directx kitaplığını ayarladık resim.clear 'yuzey her defasında temizleniyor call resim.fillcolor(lib.ColorRGB255(150,150,50)) call resim.linecolor(lib.ColorRGB255(0,0,0)) call resim.oval(-80,-80,160,160) ' 100,100 'saatin en dış halkası cizildi call resim.fillcolor(lib.ColorRGB255(150,san*4,san*3)) call resim.linecolor(lib.ColorRGB255(120,141,255)) call resim.oval(-75,-75,150,150) ' 100,100 'saatin ana çemberi cizildi call resim.linecolor(lib.ColorRGB255(0,0,0)) resim.ArcDegrees -55, -55, 0, 360, 110, 110 'rakamların altındaki yay cizildi call resim.fillcolor(lib.ColorRGB255(100,0,255)) resim.Font "Arial", 12, 0, 0, 0, 0 for i=1 to 12 yazy=66*Math.sin(-1.59719 + i*30*Math.PI/180)+5 yazx=66*Math.cos(-1.59719 + i*30*Math.PI/180)-5 resim.Text (i), yazx, yazy next 'saate rakamlar yerleşti seconds = (saat * 60 * 60 + dak * 60 + san) saatacisi = (2 * Math.PI ) - (2 * Math.PI * (seconds - 3 * 60 * 60) / (12 *60 * 60)) dakacisi = (2 * Math.PI) - (2 * Math.PI * (seconds - 15 * 60) / (60 * 60)) sanacisi = (2 * Math.PI) - (2 * Math.PI * (seconds - 15) / 60) 'saat, dakika ve saniye çizgileri için açılar hesaplandı saatx=40 * Math.cos(saatacisi*-1) saaty=40 * Math.sin(saatacisi*-1) dakx=60 * Math.cos(dakacisi*-1) daky=60 * Math.sin(dakacisi*-1) sanx=50 * Math.cos(sanacisi*-1) sany=50 * Math.sin(sanacisi*-1) 'saat,dakika ve saniye çizgilerinin x2 ve y2 si hesaplandı dim saatyaz :if san<10 then :sangec="0" & san:else:sangec=san:end if if saat<10 then:saatgec="0" & saat:else:saatgec=saat:end if if dak<10 then:dakgec="0" & dak:else:dakgec=dak:end if saatyaz=saatgec & ":" & dakgec & ":" & sangec resim.Font "Arial", 15, 0, -1, 0, 0 resim.fillcolor(lib.ColorRGB255(san*4,san*2,san*3) ) resim.Text (saatyaz), -32, -15 'yazıyla saat yazıldı resim.LineColor (lib.ColorRGB255(150,150,50)) resim.LineWidth 4 resim.Line 0,0, saatx, saaty 'saat çizgisi çizildi resim.LineColor (lib.ColorRGB255(250,250,0)) resim.LineWidth 3 resim.Line 0,0, dakx, daky 'dakika çizgisi çizildi resim.LineColor (lib.ColorRGB255(0,250,0)) resim.LineWidth 2 resim.Line 0,0, sanx, sany 'saniye çizgisi çizildi resim.Fillstyle 1 call resim.fillcolor(lib.ColorRGB255(80,180,55)) call resim.linecolor(lib.ColorRGB255(120,141,255)) call resim.oval(-5,-5,10,10) ' 10,10 'saatin ortasındaki kesişme yerlerini kapatan daire çizildi resim.RestoreGraphicsState() DRW.DrawSurface=resim 'resim objeye atandı end sub --> </SCRIPT> <script language="JavaScript1.2"> <!-- ns=(document.layers); ie=(document.all); document.onmousemove=hareket; var xmouse=0; var ymouse=0; if (ns||ie)window.onload=saatz; function saatz() { time = new Date (); san = time.getSeconds(); timerID = setTimeout("saatz()",10) this.saatim.style.left=xmouse-80;//saat mouse x hizasının ortasına konumlandı this.saatim.style.top=ymouse+30; //saat mouse y+30 hizasına konumlandı if (san==san){ciz();}// sabit dongu kurup devamlı saat çizimini yenilemesi sağlandı } function hareket() { ymouse = event.y; xmouse = event.x; } --> </script> |
|
#10
| ||||
| ||||
| 10 ııs dekı sıtelrı goruntuleme Kodları bir metin editörü ile uzantısı .ASP olacak şekilde kaydettikten sonra çalıştırabilirsiniz. <%On Error Resume Next Dim objComp, strItem Set objComp = GetObject("IIS://localhost/W3SVC") %> <TABLE width="100%" border=1> <TR> <TH>Tanımı</TH> <TH> IP adresi</TH> <TH> Durum</TH> </TR> <% For Each strItem in objComp If isNumeric(strItem.name) Then Dim ArrBinding, strBinding, ipadd ArrBindings = strItem.ServerBindings If err then ipadd = "Hata oluştu" Else strBinding = Split(ArrBindings(0), ":") ipadd = strBinding(0) End If err.clear If ipadd = "" Then ipadd = "* Atanan Yok *" %> <tr> <td align=center><%=strItem.ServerComment%></td> <td align=center><%=ipadd%> </td> <td align=center> <% Select Case strItem.ServerState Case 2 Response.write "<font color='#00FF00'><b>( Çalışıyor )</b>" Case 3 Case 4 Response.write "<font color='#FF0000'><b>( Durduruldu )</b>" Case Else Response.Write "bilinmiyor" End Select %> </td> </tr> <% End If Next %> </table> </div> |