login.asp

来自「j2me lan 聊天 server 基于 servlet 使用向导: 」· ASP 代码 · 共 141 行

ASP
141
字号
<%
userName=Request("name")
passWord=Request("pass")
intTime=gen_key(10)
Response.ContentType="text/vnd.wap.wml"
%>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml">
<wml>
<head>
	<meta http-equiv="Cache-Control" content="max-age=0"/>
</head>
<card>
	<p>
	<%
	Set conn=Server.CreateObject("ADODB.connection")
	conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath("mssdata.mdb")
	conn.Open
	Set rs = Server.CreateObject("ADODB.Recordset")
	sql="Select user From sanchat_users where user='" &userName& "' and pass='" &passWord& "'"
	rs.open sql,Conn,3,3
	if rs.eof<>true then
		rs.close '认证通过 开始查找最新收到的信息
		sql="Select id,title,content,fromu,notread From sanchat_mss where tou='" &userName& "' order by id desc"
		rs.open sql,Conn,3,3
		if rs.eof<>true then
			rs.movefirst
			while rs.eof<>true				'逐条循环
	%>			
				<a href="wap10_dispms.asp?id=<%=rs("id")%>&user=<%=userName%>&fuser=<%=rs("fromu")%>&pass=<%=passWord%>&time=<%=intTime%>">
	<%
				Response.write Uni("来自:")
				Response.write rs("fromu")	'谁发来的
				Response.write Uni("新否")
				Response.write rs("notread")
				Response.write Uni("--")
				Response.write Uni(rs("title"))'显示标题
	%>
				</a>
				<a href="wap10_delms.asp?id=<%=rs("id")%>&user=<%=userName%>&pass=<%=passWord%>&time=<%=intTime%>">
	<%
				Response.write Uni("删")
	%>
				</a><br/>
	<%
				rs.Movenext
			wend
		end if
	%>
	
	<br/>
	<%=Uni("发给")%>
	<input name="touser" type="text" value="" />
	<%=Uni("信息")%>
	<input name="mscontent" type="text" value="" />
	<br/>
	<do type="accept" label="<%=Uni("提交")%>">
		<go href="wap10_postms.asp" method="post" accept-charset="UTF-8">
			<postfield name="mscont" value="<%=CrackStr("$(mscontent)")%>"/>
			<postfield name="tuser" value="$(touser)"/>
			<postfield name="fuser" value="<%=userName%>"/>
			<postfield name="pass" value="<%=passWord%>"/>
		</go>
	</do>
	<%
	end if
	rs.close
	conn.close
	set rs=nothing
	set conn=nothing
	%>
	</p>
</card>
</wml> 
<%
Function Uni(Byval Chinese)
Dim i
For i = 1 to Len (Chinese)
A=Mid(Chinese, i, 1)
Uni=Uni & "&#x" & Hex(Ascw(A)) & ";"
Next
End Function

Function CrackStr(Byval Chinese)
CrackStr = Chinese + Uni("_")
End Function

Function gen_key(digits)
'Create and define array
dim char_array(50)
char_array(0) = "0"
char_array(1) = "1"
char_array(2) = "2"
char_array(3) = "3"
char_array(4) = "4"
char_array(5) = "5"
char_array(6) = "6"
char_array(7) = "7"
char_array(8) = "8"
char_array(9) = "9"
char_array(10) = "A"
char_array(11) = "B"
char_array(12) = "C"
char_array(13) = "D"
char_array(14) = "E"
char_array(15) = "F"
char_array(16) = "G"
char_array(17) = "H"
char_array(18) = "I"
char_array(19) = "J"
char_array(20) = "K"
char_array(21) = "L"
char_array(22) = "M"
char_array(23) = "N"
char_array(24) = "O"
char_array(25) = "P"
char_array(26) = "Q"
char_array(27) = "R"
char_array(28) = "S"
char_array(29) = "T"
char_array(30) = "U"
char_array(31) = "V"
char_array(32) = "W"
char_array(33) = "X"
char_array(34) = "Y"
char_array(35) = "Z"

'Initiate randomize method for default seeding
randomize

'Loop through and create the output based on the the variable passed to
'the function for the length of the key.
do while len(output) < digits
num = char_array(Int((35 - 0 + 1) * Rnd + 0))
output = output + num
loop

'Set return
gen_key = output
End Function
%>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?