
<%
MySQL_server = "localhost"
MySQL_user = "user"
MySQL_pass = "pass"
MySQL_db = "database"
Connection_DSN = "DRIVER={MySQL ODBC 3.51 Driver}; SERVER="&MySQL_server&"; UID="&MySQL_user&"; pwd="&MySQL_pass&";db="&MySQL_db&";stmt=SET NAMES `utf8`;"
Set Objconn= Server.CreateObject("ADODB.Connection")
Objconn.Open Connection_DSN
%>
< % Function i2a(pInt, pLength) i2a = Right(String(pLength, "0") & CStr(pInt) , pLength) End Function % >

<%
function Base64Encode(str)
b64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
For IB = 1 To Len(str) Step 3
if Mid(str, IB + 1, 1) = "" then N1 = 0 else N1 = asc(Mid(str, IB + 1, 1))
if Mid(str, IB + 2, 1) = "" then N2 = 0 else N2 = asc(Mid(str, IB + 2, 1))
T = &H10000 * Asc(Mid(str, IB, 1)) + &H100 * N1 + N2
T = Oct(T)
T = String(8 - Len(T), "0") & T
s = Mid(b64, CLng("&o" & Mid(T, 1, 2)) + 1, 1) + Mid(b64, CLng("&o" & Mid(T, 3, 2)) + 1, 1)
s = s + Mid(b64, CLng("&o" & Mid(T, 5, 2)) + 1, 1) + Mid(b64, CLng("&o" & Mid(T, 7, 2)) + 1, 1)
Base64Encode = Base64Encode + s
Next
L = 3 - ( len(str) mod 3 )
if L < 3 then Base64Encode = Left(Base64Encode , len(Base64Encode) - L) & string(L,"=")
end function
%>
<%
function Base64Decode(str)
b64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
for start = 1 to len(str) step 4
db = 3
n = 0
for b = 0 to 3
c = mid(str,b+start,1)
if c="=" then
db = db-1
d = 0
else
d = instr(b64,c)-1
end if
if d = -1 then exit function
n = 64*n+d
next
n = hex(n)
n = string(6 - len(n),"0") & n
out = chr(CByte("&H"&mid(n,1,2))) & chr(CByte("&H"&mid(n,3,2))) & chr(CByte("&H"&mid(n,5,2)))
Base64Decode = Base64Decode & left(out,db)
next
end function
%>

<% Response.Expires = 0 Response.Expiresabsolute = Now() - 1 Response.AddHeader "pragma","no-cache" Response.AddHeader "cache-control","private" Response.CacheControl = "no-cache" %>
dim sifre Sifre = RandomPassword()şeklinde kullanmak istediğiniz değişkene eşitleyin
Function RandomPassword() For i = 1 to 8 Randomize z = 90 a = 65 pass = pass + Chr(Int((z - a + 1) * Rnd + a)) next RandomPassword = lcase(pass) RandomPassword = cstr(RandomPassword) End Function
' 000000000000000000000000000000000000000000000000000000000000000000000000000
' Visual Dil Grubu için Verilen Doğum Tarihinden Kişinin Yaşının Hesaplanması
' Fonksiyon Kullanım için tarihe yol vermeniz gerekir.
' Örneğin Response.Write kacyasinda("01.01.2000") şeklinde kullanılır.
' 000000000000000000000000000000000000000000000000000000000000000000000000000
Public Function KacYasinda(DogumGunu)
Dim DogumTarihi As Date
DogumTarihi = DateValue(DogumGunu)
`Yasi hesapla
Dim Yas As Integer
Yas = Int(DateDiff("D", DogumTarihi, Now) / 365.25)
KacYasinda = Yas
End Function
Public Function FlipData(data) length = Len(data) If length = 0 Then Exit Function For i=1 To length cache = Mid(data,i,1) & cache Next FlipData = cache End Function
Function TumBasHarfleriBuyut(ByVal GelenVeri As String) As String Dim BoslukYeri As Integer Mid(GelenVeri, 1, 1) = UCase(Mid(GelenVeri, 1, 1)) BoslukYeri = InStr(GelenVeri, " ") While BoslukYeri <> 0 Mid(GelenVeri, BoslukYeri + 1, 1) = UCase(Mid(GelenVeri, BoslukYeri + 1, 1)) BoslukYeri = InStr(BoslukYeri + 1, GelenVeri, " ") Wend TumBasHarfleriBuyut = GelenVeri End FunctionDaha geliştirip türkçe karakterlerin unicode olarak çevirilmesi özelliğini de kendiniz ekleyebilirsiniz.
Public Function AyinSonGunu(ByVal GecerliTarih As Date) As Byte
Dim SonGun As Byte
SonGun = DatePart("d", DateAdd("d", -1, DateAdd("m", 1, _
DateAdd("d", -DatePart("d", GecerliTarih) + 1, Date))))
AyinSonGunu = SonGun
End Function
Private Sub Command1_Click()
MsgBox Date & " tarihine ait ayin son günü : " & AyinSonGunu(Date)
End Sub
' Belirtilen değerin Pozitif Olup Olmadığını Kontrol Etme ' Özellikle - değerlerin canınızı sıkabileceği durumlarda kullanması ' çok güzel olan bir fonksiyon örneğidir. Function isPositive(byVal Num) isPositive = False If NOT isNumeric(Num) Then isPositive = False Else If Num>0 Then isPositive = True End If End Function