求大神帮忙写一个登陆用的asp function方法,急急急急急急急急急

隐痕ZERO 2017-03-13 11:07:24
需求是这样的,需要一个登陆的asp页面,页面里有账号和密码的输入,在第二个页面写一个账号密码判断的function的方法,接到账号和密码的值,进行判断,成功返回,求大神帮忙写一下
...全文
112 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
Go 旅城通票 2017-03-14
  • 打赏
  • 举报
回复
变量名你用引号括起来干嘛,高反了 function cnm(username,password) sql="select * from 密码 " rs.open sql,conn,1,1 if username="纳税人识别号" and password="密码" then response.write("<script >alert('登陆成功');history.back();</script>")'登陆成功也要记住登陆状态,看原来的代码说明 else response.write("<script >alert('用户名或密码错误');history.back();</script>") end if end function
隐痕ZERO 2017-03-14
  • 打赏
  • 举报
回复
谢谢大神指点 <!--#include file="conn.asp"--> <% function cnm(username,password) sql="select * from 密码 " rs.open sql,conn,1,1 if 纳税人识别号="username" and 密码="password" then response.write("<script >alert('登陆成功');history.back();</script>") else response.write("<script >alert('用户名或密码错误');history.back();</script>") end if end function %> function 这么写不对吗?
Go 旅城通票 2017-03-14
  • 打赏
  • 举报
回复
这么基础的都不会,就算写出来给你也不一定会用。。

<form action="x.asp" method="post">
    用户名:<input type="text" name="un" /><br />
    密 码:<input type="password" name="pwd" /><input type="submit" value="登陆" />
</form>
x.asp
<%
  un=request.Form("un"):pwd=request.Form("pwd")
  if un<>"" and pwd<>"" then
    un=replace(un,"'","''"):pwd=replace(pwd,"'","''")
    set conn=server.CreateObject("adodb.connection")
    conn.open "你的驱动字符串"
    set rs=conn.execute("select * from usertable where username='"&un&"' and password='"&pwd&"'"
    if rs.eof or rs.bof then
      response.Write "<script>alert('用户名密码错误!');history.back()</script>"
    else
      session("user")=un
      response.Write "<script>alert('登陆成功!');location='登陆成功后调整的url地址'</script>"
    end if
    rs.close:set rs=nothing:conn.close:set conn=nothing
  else
    response.Write "<script>alert('用户名密码不能为空!');history.back()</script>"
  end if
%>

28,390

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧