rahulkanna 0 Newbie Poster

Hello I am Rahul I am getting error when I am giving password
The error listed below

Microsoft VBScript runtime error '800a0005'
Invalid procedure call or argument: 'mid'

/includedfiles/encriptdecript.asp, line 45

here I have listed the code below.
I tried so many articles but i didnt,
Actually I have used encrypt & decrypt in login pages
It was working fine in SQL Server 2000 recently I have upgraded to SQL server 2003
but it is not working in SQL server 2003
Can you help this?

Code:

<%
Public Function encript(pass)
	Dim temp, temp1
	Dim pos, leng, dt, tim
	Dim i, key

	leng = Len(pass)
	tim = Time
	tim = Mid(tim, 1, Len(tim) - 3)
	tim = Mid(tim, Len(tim) - 1, 2) * Int(Rnd * 100)
	For i = 1 To Len(CStr(tim))
		pos = pos + CInt(Mid(CStr(tim), i, 1))
	Next
	While pos > Len(pass)
		pos = pos Mod 10 + Int(Rnd * 10)
		If pos = 0 Then
			pos = Len(pass) + 1
		End If
	Wend
	If pos <= 2 Then
		pos = 3
	End If
	key = Int((255 - 150 + 1) * Rnd + 150)
	For i = 1 To Len(pass)
		If Asc(Mid(pass, i, 1)) > key Then
			temp = temp & Chr(CInt(Asc(Mid(pass, i, 1))) - key)
		ElseIf Asc(Mid(pass, i, 1)) < key Then
			temp = temp & Chr(key - CInt(Asc(Mid(pass, i, 1))))
		Else
			temp = temp & Chr(Asc(Mid(pass, i, 1)))
		End If
	Next
	temp1 = Mid(temp, 1, pos) & Chr(key)
	temp1 = temp1 & Mid(temp, pos + 1, Len(temp))
	temp = Chr(pos + 150) & temp1
	encript = temp
End Function


Public Function decript(pass)
	Dim pos, key, temp
	Dim i, temp1

//Error line

	pos = Int(Asc(Mid(pass, 1, 1))) - 150
	key = Asc(Mid(pass, pos + 2, 1))
	temp = Mid(pass, 1, pos + 1)



	pass = temp & Mid(pass, pos + 3, Len(pass))
	pass = Mid(pass, 2, Len(pass))
	For i = 1 To Len(pass)
		If Asc(Mid(pass, i, 1)) <> key Then
			temp1 = temp1 & Chr(key - CInt(Asc(Mid(pass, i, 1))))
		Else
			temp1 = temp1 & Chr(Asc(Mid(pass, i, 1)))
		End If
	Next
	decript = temp1
End Function
%>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.