亲注册登录道勤网-可以查看更多帖子内容哦!(包涵精彩图片、文字详情等)请您及时注册登录-www.daoqin.net
您需要 登录 才可以下载或查看,没有账号?立即注册
x
首先ASP+UC客户端API文档查看:
- 用户注册示例 (ASP)Dim register
- 'register = uc_user_register("用户名","密码","邮箱","安全提问","问题答案")
- register = uc_user_register("admin1","admin888","admin@qq.com","","")
- If register > "0" Then
- response.write "注册成功"
- ElseIf register = "-1" Then
- response.write "用户名不合法"
- ElseIf register = "-2" Then
- response.write "包含要允许注册的词语"
- ElseIf register = "-3" Then
- response.write "用户名已经存在"
- ElseIf register = "-4" Then
- response.write "Email 格式有误"
- ElseIf register = "-5" Then
- response.write "Email 不允许注册"
- ElseIf register = "-6" Then
- response.write "该 Email 已经被注册"
- ElseIf register = "-7" Then
- response.write "注册信息填写不全"
- Else
- response.write "未定义"
- End If
- 用户登录示例 (ASP)Dim login
- 'login = uc_user_login("用户","密码","是否ID登录","是否验证安全问题","安全问题","问题答案")
- login = uc_user_login("admin","5201314","0","0","","")
- If login(0) > "0" Then
- response.write "登录成功<br>"
- response.write "用户ID:"&login(0)&"<br>"
- response.write "用户名:"&login(1)&"<br>"
- response.write "用户密码:"&login(2)&"<br>"
- response.write "用户邮箱:"&login(3)&"<br>"
- response.write "是否重命名:"&login(4)&"<br>"
- ElseIf login(0) = "-1" Then
- response.write "用户不存在,或者被删除"
- ElseIf login(0) = "-2" Then
- response.write "密码错"
- ElseIf login(0) = "-3" Then
- response.write "安全提问错"
- ElseIf login(0) = "-4" Then
- response.write "用户或密码为空"
- Else
- response.write "未定义"
- End If
- 删除用户
- 'response.write uc_user_delete("用户ID")
- response.write uc_user_delete(2)
- 检查用户名示例 (ASP)Dim cname
- 'cname = uc_user_checkname("用户名")
- cname = uc_user_checkname("admin")
- If cname = "1" Then
- response.write "正确"
- ElseIf cname = "-1" Then
- response.write "用户名不合法"
- ElseIf cname = "-2" Then
- response.write "包含不允许注册的词语"
- ElseIf cname = "-3" Then
- response.write "用户名已经存在"
- Else
- response.write "未定义"
- End If
- 用户登录 后的:
- response.write uc_user_synlogin(UID)
- 完整的实例:
- Dim login
- 'login = uc_user_login("用户","密码","是否ID登录","是否验证安全问题","安全问题","问题答案")
- login = uc_user_login("admin","5201314","0","0","","")
- If login(0) > 0 Then '有此用户才登陆
- response.write uc_user_synlogin(login(0)) '获取同步登录代码
- ElseIf login(0) = "-1" Then
- response.write "用户不存在"
- ElseIf login(0) = "-2" Then
- response.write "密码错误"
- Else
- response.write "未定义"
- End If
复制代码 如何安装使用这里就不详细描述了,只说几点遇到的问题,因为添加用户、修改密码我是直接用ASP+MYSQL向数据库添加修改数据,所以不知道这个API对添加用户、修改密码有没有问题,这里详细讲同步登录。
1、通信问题
在UC添加应用时通信密钥要和config.inc.asp里写的一样,编写程序时调用config.inc.asp,同步登录需要在是否同步应用里选择是。
2、中文用户无法登录问题
这里给一个简单的同步登录代码,就命名为login.asp吧!
- <!--#include file="config.inc.asp"-->
- <%
- a=uc_user_login("清竹科技", "******", 0, 0, "", "") '登录返回ARRAY数组,详细函数说明见client.asp
- '----------------------
- '登录判断这里不详细编写,当作登录成功
- response.write uc_user_synlogin(a(0),"******") '得到登录ID,打印结果执行JS同步登录
- response.write a(1)
- response.end
- %>
复制代码 接下来是重点,打开client.asp,CTRL+F搜索Function uc_fopen(url,post),在获取远程页面数据的返回结果我们需要进行处理,把二进制结果进行字符串转换。
原函数:
- Function uc_fopen(url,post)
- Dim Http
- Set Http = Server.CreateObject("Msxml2.ServerXMLHTTP")
- With Http
- .Open "POST",url,False
- .SetRequestHeader "Accept","*/*"
- .SetRequestHeader "Accept-Language","zh-cn"
- .SetRequestHeader "Content-Type","application/x-www-form-urlencoded"
- .SetRequestHeader "User-Agent", Request.ServerVariables("HTTP_USER_AGENT")
- .setRequestHeader "Host","119.132.83.166"
- .SetRequestHeader "Content-Length",Len(post)
- .setRequestHeader "Connection","Close"
- .setRequestHeader "Cache-Control","no-cache"
- .Send post
- uc_fopen = .ResponseText
- End With
- End Function
复制代码 在本函数下方添加一个二进制转换函数
- Function bytes2bstr(vin)
- On Error Resume Next
- Err.Clear
- strreturn = ""
- For i = 1 To LenB(vin)
- thischarcode = AscB(MidB(vin, i, 1))
- If thischarcode < &H80 Then
- strreturn = strreturn & Chr(thischarcode)
- Else
- nextcharcode = AscB(MidB(vin, i + 1, 1))
- strreturn = strreturn & Chr(CLng(thischarcode) * &H100 + CInt(nextcharcode))
- i = i + 1
- End If
- Next
- bytes2bstr = strreturn
- End Function
复制代码 添加后,把原函数里的uc_fopen = .ResponseText换成uc_fopen=bytes2bstr(.responsebody)
修改后的完整代码如下:
- '================================================
- '函数名: uc_fopen
- '作 用: 远程打开URL
- '参 数: url : 打开的ur
- ' post : 要发送的 POST 数据
- '返回值: 取到的字符串
- '================================================
- Function uc_fopen(url,post)
- Dim Http
- Set Http = Server.CreateObject("Msxml2.ServerXMLHTTP")
- With Http
- .Open "POST",url,False
- .SetRequestHeader "Accept","*/*"
- .SetRequestHeader "Accept-Language","zh-cn"
- .SetRequestHeader "Content-Type","application/x-www-form-urlencoded"
- .SetRequestHeader "User-Agent", Request.ServerVariables("HTTP_USER_AGENT")
- '.setRequestHeader "Host","119.132.83.166" '这行没用,注视掉
- .SetRequestHeader "Content-Length",Len(post)
- .setRequestHeader "Connection","Close"
- .setRequestHeader "Cache-Control","no-cache"
- .Send post
- uc_fopen=bytes2bstr(.responsebody)
- 'uc_fopen = .ResponseText
- End With
- End Function
- Function bytes2bstr(vin)
- On Error Resume Next
- Err.Clear
- strreturn = ""
- For i = 1 To LenB(vin)
- thischarcode = AscB(MidB(vin, i, 1))
- If thischarcode < &H80 Then
- strreturn = strreturn & Chr(thischarcode)
- Else
- nextcharcode = AscB(MidB(vin, i + 1, 1))
- strreturn = strreturn & Chr(CLng(thischarcode) * &H100 + CInt(nextcharcode))
- i = i + 1
- End If
- Next
- bytes2bstr = strreturn
- End Function
复制代码 返回结果:
- <script type="text/javascript" src=http://bbs.qzsys.com/api/uc.php?time=1291717078&code=************************** reload="1"></script>
复制代码 即login.asp里response.write uc_user_synlogin(a(0),"******")打印出来的结果,登录成功!
道勤主机提供365天*24小时全年全天无休、实时在线、零等待的售后技术支持。竭力为您免费处理您在使用道勤主机过程中所遇到的一切问题!
如果您是道勤主机用户,那么您可以通过QQ【792472177】、售后QQ【59133755】、旺旺【诠释意念】、微信:q792472177免费电话、后台提交工单这些方式联系道勤主机客服!
如果您不是我们的客户也没问题,点击页面最右边的企业QQ在线咨询图标联系我们并购买后,我们为您免费进行无缝搬家服务,让您享受网站零访问延迟的迁移到道勤主机的服务! |