找回密码
 入住遨海湾
搜索
网站解决方案专享优惠-3折上云
查看: 1671|回复: 1

动网论坛首页调用

[复制链接]
发表于 2006-10-4 16:27:00 | 显示全部楼层 |阅读模式

登录后查才能浏览下载更多咨询,有问题联系QQ:3283999

您需要 登录 才可以下载或查看,没有账号?入住遨海湾

×

各位,要确定你们的动网论坛版本哟,单单这样说我也不知道问题出现在哪儿了,因为我这里一装上去就能正常运行!!!

下面的代码就是我正在使用的SLOGIN.ASP文件代码,应该和我提供下载的代码是一样的,贴出来供大家对照一下:

<!--#include file="Conn.asp"-->
<!--#include file="inc/const.asp"-->
<!--#include file="inc/md5.asp"-->
<%
Dim TruePassWord
'session("flag")=empty
TruePassWord=Dvbbs.Createpass
Select Case request("action")
Case "chk"
Dvbbs_ChkLogin
Case "logout"
Dvbbs_logout
'Case Else
'Main
End Select
Dvbbs.ActiveOnline
Const Iurl="http://www.3g-express.com/bbs/"
Function Dvbbs_ChkLogin
Dim UserIP,mobile
Dim username
Dim userclass
Dim password
Dim article
Dim usercookies
Dim chrs,i
UserIP=Dvbbs.UserTrueIP
mobile=trim(Dvbbs.CheckStr(request("passport")))
If Dvbbs.forum_setting(79)="1" Then
  If Not Dvbbs.CodeIsTrue() Then
    Response.write "验证码校验失败,请返回刷新页面后再输入验证码"
  End If
End If
username=trim(Dvbbs.CheckStr(request("username")))
If Request("username")="" Or Request("password")="" Then
  Response.write "<font color=#FF0000>帐号密码之一不能为空!</font><BR>"
Else
  password=md5(trim(Dvbbs.CheckStr(request("password"))),16)
  If Request("password") = "" Then password = ""
End If
If Dvbbs.ErrCodes<>"" Then Exit Function
usercookies=request("CookieDate")
'判断更新cookies目录
Dim cookies_path_s,cookies_path_d,cookies_path
cookies_path_s=split(Request.ServerVariables("PATH_INFO"),"/")
cookies_path_d=ubound(cookies_path_s)
cookies_path="/"
For i=1 to cookies_path_d-1
  If not (cookies_path_s(i)="upload" or cookies_path_s(i)="admin") Then cookies_path=cookies_path&cookies_path_s(i)&"/"
Next
If dvbbs.cookiepath<>cookies_path Then
  cookies_path=replace(cookies_path,"'","")
  Dvbbs.execute("update dv_setup set Forum_Cookiespath='"&cookies_path&"'")
  Dim setupData
  Dvbbs.CacheData(26,0)=cookies_path
  Dvbbs.Name="setup"
  Dvbbs.value=Dvbbs.CacheData
End If
If ChkUserLogin(username,password,mobile,usercookies,1)=false Then
   set chrs=Dvbbs.Execute("select Passport,IsChallenge from [Dv_User] where username='"&username&"' and IsChallenge=1")
   If chrs.eof and chrs.bof Then
    Response.write "<font color=#FF0000>登陆失败,请检查帐号密码!</font>"
    Exit Function
   Else
    challenge_check chrs("Passport"),password
    Exit Function
   End If
   set chrs=nothing
End If
Response.Redirect "SLogin.asp"
End Function

Rem ==========论坛登录函数=========
Rem 判断用户登录
Function ChkUserLogin(username,password,mobile,usercookies,ctype)

Dim rsUser,article,userclass,titlepic
Dim userhidden,lastip,UserLastLogin
Dim GroupID,ClassSql,FoundGrade
Dim regname,iMyUserInfo
Dim sql,sqlstr,OLDuserhidden

FoundGrade=False
lastip=Dvbbs.UserTrueIP
userhidden=request.form("userhidden")
If userhidden <> "1" Then userhidden=2
ChkUserLogin=false
If mobile<>"" Then
  sqlstr=" Passport='"&mobile&"'"
Else
  sqlstr=" UserName='"&username&"'"
End If
Sql="Select UserID,UserName,UserPassword,UserEmail,UserPost,UserTopic,UserSex,UserFace,UserWidth,UserHeight,JoinDate,LastLogin,lastlogin as cometime , LastLogin as activetime,UserLogins,Lockuser,Userclass,UserGroupID,UserGroup,userWealth,userEP,userCP,UserPower,UserBirthday,UserLastIP,UserDel,UserIsBest,UserHidden,UserMsg,IsChallenge,UserMobile,TitlePic,UserTitle,TruePassWord,UserToday,UserMoney,UserTicket,FollowMsgID,Vip_StarTime,Vip_EndTime,userid as boardid"
Sql=Sql & " From [Dv_User] Where "&sqlstr&""
set rsUser=Dvbbs.Execute(sql)
If rsUser.eof and rsUser.bof Then
  ChkUserLogin=False
  Exit Function
Else
  If rsUser("Lockuser") =1 Or rsUser("UserGroupID") =5 Then
   ChkUserLogin=False
   Exit Function
  Else
   If Trim(password)=Trim(rsUser("UserPassword")) Then
    ChkUserLogin=True
    Dvbbs.UserID=RsUser("UserID")
    RegName = RsUser("UserName")
    Article= RsUser("UserPost")
    UserLastLogin = RsUser("cometime")
    UserClass = RsUser("Userclass") 
    GroupID = RsUser("userGroupID")
    OLDuserhidden=RsUser("UserHidden")
    TitlePic = RsUser("UserTitle")
    If Article < 0  Then Article=0
    Set Dvbbs.UserSession=Dvbbs.RecordsetToxml(rsUser,"userinfo","xml")
    Dvbbs.UserSession.documentElement.selectSingleNode("userinfo/@cometime").text=Now()
    Dvbbs.UserSession.documentElement.selectSingleNode("userinfo/@activetime").text=DateAdd("s",-3600,Now())
    Dvbbs.UserSession.documentElement.selectSingleNode("userinfo/@boardid").text=0
    Dvbbs.UserSession.documentElement.selectSingleNode("userinfo").attributes.setNamedItem(Dvbbs.UserSession.createNode(2,"isuserpermissionall","")).text=Dvbbs.FoundUserPermission_All()
    If OLDuserhidden <> CLng(userhidden) Then
     Dvbbs.UserSession.documentElement.selectSingleNode("userinfo/@userhidden").text=userhidden
     Dvbbs.Execute("update Dv_user set userhidden="&userhidden&" where UserId=" & Dvbbs.UserID)
    End If
    Dim BS
    Set Bs=Dvbbs.GetBrowser()
    Dvbbs.UserSession.documentElement.appendChild(Bs.documentElement)
    If EnabledSession Then  Session(Dvbbs.CacheName & "UserID")=Dvbbs.UserSession.xml
   Else
    ChkUserLogin=False
    Exit Function
   End If
  End If
End If
If ChkUserLogin Then
REM 判断用户组(等级)资料,当用户级别为跟随文章数增长则自动更新用户组(等级)
REM 自动更新用户数据
REM 如果属于系统或特殊或多属性组
Set rsUser=Dvbbs.Execute("Select MinArticle,IsSetting,ParentGID,UserTitle,GroupPic From Dv_UserGroups Where UserGroupID="&GroupID)
If Not (rsUser.Eof And rsUser.Bof) Then
  If rsUser(2)=1 Or rsUser(2)=2 Or rsUser(2)=4 Or rsUser(2)=5 Then
   '用户等级不按照文章升级,用户为系统或特殊或多属性组
   UserClass=rsUser(3)
   TitlePic=rsUser(4)
   FoundGrade=True
  End If
End If
If Not FoundGrade Then
  '如果不属于系统或特殊或多属性组,则将该用户属于注册用户组且按照其文章数自动更新其用户组(等级)
  Set rsUser=Dvbbs.Execute("Select Top 1 usertitle,GroupPic,UserGroupID From Dv_UserGroups Where ParentGID=3 And Minarticle<="&Article&" Order By MinArticle Desc,UserGroupID")
  If Not (rsUser.Eof And rsUser.Bof) Then
   UserClass=rsUser(0)
   TitlePic=rsUser(1)
   GroupID=rsUser(2)
   FoundGrade=True
  End If
End If
Set rsUser=nothing
If Not FoundGrade Then Response.Redirect "showerr.asp?ErrCodes=<li>系统没有找到您的注册用户组资料,请联系管理员进行修正。&action=OtherErr"
select case ctype
case 1
  If Datediff("d",UserLastLogin,Now())=0 Then
   sql="update [Dv_User] set LastLogin="&SqlNowString&",UserLogins=UserLogins+1,UserLastIP='"&lastip&"',userclass='"&userclass&"',titlepic='"&titlepic&"',UserGroupID="&GroupID&",TruePassWord='"&TruePassWord&"' where userid="&dvbbs.UserID
  Else
   sql="update [Dv_User] set userWealth=userWealth+"&Dvbbs.Forum_user(4)&",userEP=userEP+"&Dvbbs.Forum_user(9)&",userCP=userCP+"&Dvbbs.Forum_user(14)&",LastLogin="&SqlNowString&",UserLogins=UserLogins+1,UserLastIP='"&lastip&"',userclass='"&userclass&"',titlepic='"&titlepic&"',UserGroupID="&GroupID&",TruePassWord='"&TruePassWord&"' where userid="&dvbbs.UserID
  End If
case 2
  sql="update [Dv_User] set UserPost=UserPost+1,UserTopic=UserTopic+1,userWealth=userWealth+"&Dvbbs.Forum_user(1)&",userEP=userEP+"&Dvbbs.Forum_user(6)&",userCP=userCP+"&Dvbbs.Forum_user(11)&",LastLogin="&SqlNowString&",UserLastIP='"&lastip&"',userclass='"&userclass&"',titlepic='"&titlepic&"',UserGroupID="&GroupID&",TruePassWord='"&TruePassWord&"' where userid="&dvbbs.UserID
case 3
  sql="update [Dv_User] set UserPost=UserPost+1,userWealth=userWealth+"&Dvbbs.Forum_user(2)&",userEP=userEP+"&Dvbbs.Forum_user(7)&",userCP=userCP+"&Dvbbs.Forum_user(12)&",LastLogin="&SqlNowString&",UserLastIP='"&lastip&"',userclass='"&userclass&"',titlepic='"&titlepic&"',UserGroupID="&GroupID&",TruePassWord='"&TruePassWord&"' where userid="&dvbbs.UserID
end select
Dvbbs.Execute(sql)
Dim StatUserID,UserSessionID
  StatUserID = Dvbbs.checkStr(Trim(Request.Cookies(Dvbbs.Forum_sn)("StatUserID")))
  If IsNumeric(StatUserID) = 0 or StatUserID = "" Then
   StatUserID = Replace(Dvbbs.UserTrueIP,".","")
   UserSessionID = Replace(Startime,".","")
   If IsNumeric(StatUserID) = 0 or StatUserID = "" Then StatUserID = 0
   StatUserID = Ccur(StatUserID) + Ccur(UserSessionID)
  End If
StatUserID = Ccur(StatUserID)
Dvbbs.Execute("delete from dv_online where  id="&StatUserID&"")
If trim(username)<>trim(Dvbbs.membername) Then
  Response.Cookies(Dvbbs.Forum_sn)("username")=""
  Response.Cookies(Dvbbs.Forum_sn)("password")=""
  Response.Cookies(Dvbbs.Forum_sn)("userclass")=""
  Response.Cookies(Dvbbs.Forum_sn)("userid")=""
  Response.Cookies(Dvbbs.Forum_sn)("userhidden")=""
  Response.Cookies(Dvbbs.Forum_sn)("usercookies")=""
  Dvbbs.Execute("delete from dv_online where username='"&Dvbbs.membername&"'")
End If
If isnull(usercookies) or usercookies="" Then usercookies="0"
select case usercookies
case "0"
  Response.Cookies(Dvbbs.Forum_sn)("usercookies") = usercookies
case 1
     Response.Cookies(Dvbbs.Forum_sn).Expires=Date+1
  Response.Cookies(Dvbbs.Forum_sn)("usercookies") = usercookies
case 2
  Response.Cookies(Dvbbs.Forum_sn).Expires=Date+31
  Response.Cookies(Dvbbs.Forum_sn)("usercookies") = usercookies
case 3
  Response.Cookies(Dvbbs.Forum_sn).Expires=Date+365
  Response.Cookies(Dvbbs.Forum_sn)("usercookies") = usercookies
end select
Response.Cookies(Dvbbs.Forum_sn).path = Dvbbs.cookiepath
Response.Cookies(Dvbbs.Forum_sn)("username") = regname
Response.Cookies(Dvbbs.Forum_sn)("userid") = Dvbbs.UserID
Response.Cookies(Dvbbs.Forum_sn)("password") = TruePassWord
Response.Cookies(Dvbbs.Forum_sn)("userclass") = userclass
Response.Cookies(Dvbbs.Forum_sn)("userhidden") = userhidden
rem 清除图片上传数的限制
Response.Cookies("upNum")=0
Dvbbs.UserSession.documentElement.selectSingleNode("userinfo/@truepassword").text= TruePassWord
Dvbbs.Membername=Dvbbs.Checkstr(regname)
Dvbbs.Memberclass=Dvbbs.Checkstr(userclass)
Dvbbs.UserGroupID=GroupID
End If
End Function

Sub Dvbbs_logout()
If Not IsObject(Conn) Then ConnectionDatabase
Dim activeuser,TempNum
If Not CLng(DVbbs.UserSession.documentElement.selectSingleNode("userinfo/@userid").text)=0 Then
  activeuser="delete from Dv_online where userid= "& DVbbs.UserSession.documentElement.selectSingleNode("userinfo/@userid").text
  Conn.Execute activeuser,TempNum
  '更新缓存总用户在线数据
  MyBoardOnline.Forum_UserOnline = MyBoardOnline.Forum_UserOnline - TempNum
  Dvbbs.Name="Forum_UserOnline"
  Dvbbs.value=MyBoardOnline.Forum_UserOnline
Else
  If IsNumeric(DVbbs.UserSession.documentElement.selectSingleNode("userinfo/@statuserid").text) Then
   activeuser="delete from Dv_online where id="& DVbbs.UserSession.documentElement.selectSingleNode("userinfo/@statuserid").text
   Conn.Execute activeuser,TempNum
   '更新缓存总用户在线数据
   MyBoardOnline.Forum_GuestOnline = MyBoardOnline.Forum_GuestOnline - TempNum
   Dvbbs.Name="Forum_GuestOnline"
   Dvbbs.value=MyBoardOnline.Forum_GuestOnline
  End If
End If
MyBoardOnline.Forum_Online = MyBoardOnline.Forum_Online - TempNum
Dvbbs.Name="Forum_Online"
Dvbbs.value=MyBoardOnline.Forum_Online
Response.Cookies(Dvbbs.Forum_sn).path=Dvbbs.cookiepath
Response.Cookies(Dvbbs.Forum_sn)("username")=""
Response.Cookies(Dvbbs.Forum_sn)("password")=""
Response.Cookies(Dvbbs.Forum_sn)("userclass")=""
Response.Cookies(Dvbbs.Forum_sn)("userid")=""
Response.Cookies(Dvbbs.Forum_sn)("userhidden")=""
Response.Cookies(Dvbbs.Forum_sn)("usercookies")=""
If EnabledSession Then
  Session(Dvbbs.CacheName & "UserID")=Empty
End If
Set Dvbbs.UserSession=Nothing
Session("flag")=Empty
Response.Redirect "SLogin.asp"
End Sub
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT="">
<META NAME="Keywords" CONTENT="">
<META NAME="Description" CONTENT="">
<style type="text/css">
A{TEXT-DECORATION: none;}
A:link {color: #080808;}
A:visited {color: #333333;}
A:hover{COLOR: #3399FF;}
BODY
{
FONT-SIZE: 9pt;
text-decoration: none;
scrollbar-face-color:#F2F2F2;
scrollbar-highlight-color:#FFFFFF;
scrollbar-3dlight-color:#E6E6E6;
scrollbar-shadow-color:#D6D6DD;
scrollbar-darkshadow-color:#C0C0C0;
scrollbar-track-color:F2F2F2;
scrollbar-arrow-color:777777;
}
TD
{
FONT-FAMILY:宋体;FONT-SIZE: 9pt;line-height: 150%;
}
Input
{
BACKGROUND-COLOR: #ffffff;
BORDER-BOTTOM: #333333 1px solid;
BORDER-LEFT: #333333 1px solid;
BORDER-RIGHT: #333333 1px solid;
BORDER-TOP: #333333 1px solid;
COLOR: #333333;
HEIGHT: 18px;
border-color: #666666 #666666 #666666 #666666; font-size: 9pt
}
Button
{
FONT-SIZE: 9pt;HEIGHT: 20px;
}
Select
{
FONT-SIZE: 9pt;HEIGHT: 20px;
}
</style>
</HEAD>

<BODY style="BACKGROUND-COLOR: transparent" leftmargin="0" rightmargin="0" topmargin="0" bottommargin="0">
<%If Clng(Dvbbs.UserSession.documentElement.selectSingleNode("userinfo/@userid").text)>0 Then
Dim UserMsg
UserMsg=Split((Dvbbs.UserSession.documentElement.selectSingleNode("userinfo/@usermsg").text),"||")%>
<TABLE align="center" width="200" border="0" cellspacing="0" cellpadding="0">
<TR>
<TD colspan="2">欢迎:<font color="#3300FF"><b><%=Dvbbs.UserSession.documentElement.selectSingleNode("userinfo/@username").text%></b></font>&nbsp;<A HREF="usersms.asp?action=inbox" target="_blank">收件箱</A><%IF CInt(Usermsg(0))>0 Then%>(<a href="javascriptpenScript('messanger.asp?action=read&amp;id=<%=Usermsg(1)%>&amp;sender=<%=Usermsg(2)%>',500,400)"><font color="#FF0000"><%=Usermsg(0)%></font></a>)
<%Else%>(<font color="#757575">0</font>)
<%End IF%></TD>
</TR>
<TR>
<TD>发贴:<B><%=Dvbbs.UserSession.documentElement.selectSingleNode("userinfo/@userpost").text%></B></TD>
<TD>登陆:<B><%=Dvbbs.UserSession.documentElement.selectSingleNode("userinfo/@userlogins").text%></B></TD>
</TR>
<TR>
<TD>论坛等级:</TD>
<TD><font color="#FF6600"><B><%=Dvbbs.UserSession.documentElement.selectSingleNode("userinfo/@userclass").text%></B></font></TD>
</TR>
<TR>
<TD>金钱:<B><%=Dvbbs.UserSession.documentElement.selectSingleNode("userinfo/@userwealth").text%></B></TD>
<TD>积分:<B><%=Dvbbs.UserSession.documentElement.selectSingleNode("userinfo/@userep").text%></B></TD>
</TR>
<TR>
<TD>精华:<font color="#FF0000"><B><%=Dvbbs.UserSession.documentElement.selectSingleNode("userinfo/@userisbest").text%></B></font></TD>
<TD>被删:<B><%=Dvbbs.UserSession.documentElement.selectSingleNode("userinfo/@userdel").text%></B></TD>
</TR>
<%
'On Error Resume Next
Dim rs_board,sqlstrs
'Set rs_board=Server.Createobject("ADODB.RECORDSET")
sqlstrs="select boardid,BoardType,ParentID from Dv_Board order by orders"
'rs_board.Open sqlstrs,conn,1,1
Set rs_board=Dvbbs.Execute(sqlstrs)
'If Err Then
'err.Clear
'Set Conn = Nothing
'Response.End
'End If
%>
<TR>
<TD colspan="2" align="center">
<SELECT NAME="" onchange="top.location=this.options[this.selectedIndex].value;">
<option>选择板块进入:</option>
<option value="index.asp">>>> 论坛首页</option>
<option value="index.asp?boardid=10">>>>  动网论坛技术区</option>
<%
Do While Not rs_board.eof And Not rs_board.bof
    If rs_board("ParentID")=0 Then
%>
    <option value="index.asp?boardid=<%=rs_board("boardid")%>" style="background-color:#F7F7F7;">>> <%=rs_board("BoardType")%></option>
<%Else%>
     <option value="index.asp?boardid=<%=rs_board("boardid")%>">├ <%=rs_board("BoardType")%></option>
<%
End If
rs_board.MoveNext
Loop
rs_board.close:Set rs_board=Nothing
conn.close:Set conn=Nothing%>
<option value="index.asp">>>>> 论坛首页</option>-->
</SELECT>
</TD>
</TR>
<TR>
   <TD colspan="2" align="center"><A HREF="?action=logout"><IMG SRC="<%=Iurl%>/Images/aqtc.gif" BORDER="0" ALT="已经登陆!"></A></TD>
</TR>
</TABLE>
<%Else%>
<table align="center" width="200" border="0" cellspacing="0" cellpadding="0">
  <form action="SLogin.asp?action=chk" method="post">
  <tr><td height="25" align="right">用户名:</td>
  <td height="25"><input maxLength="16" size="15" name="username"></td></tr>
  <tr><td height="25" align="right">密码:</td>
  <td height="25"><input type="password" maxLength="20" size="15" value name="password"></td></tr>
  <tr><td height="25" align="right">登录状态:</td><td height="25">
          <select name="CookieDate">
            <option value="0" selected>不保存</option>
            <option value="1">保存一天</option>
            <option value="2">保存一月</option>
            <option value="3">保存一年</option>
          </select></td></tr>
    <tr align="center"><td height="30" colspan="2"><input name="Login" type="image" id="Login" src="<%=Iurl%>/images/login.gif" border=0 alt="登录"> <a href="/bbs/reg.asp" target="_blank"><IMG src="<%=Iurl%>/images/apply.gif" border=0 alt="新用户注册"></a> <a href="/bbs/lostpass.asp" target=_blank><img src="<%=Iurl%>/images/password.gif" border=0 alt="忘记了密码?"></a></td></tr>
    </form>
    </table>
<%End IF%>
</BODY>
</HTML>

遨海湾-心灵的港湾 www.aosea.com
 楼主| 发表于 2006-10-4 16:28:00 | 显示全部楼层
 if dvbbs.Membername="" then
                      Response.Write"<form id=loginForm method=post action=login.asp?action=chk>"
                      Response.Write"用户名:<input type=text class=inputbg name=username size=15 maxlength=50><br>"
                      Response.Write"密 码:<input type=password class=inputbg name=password size=15 maxlength=50><br>"
                      Response.Write"认证码:<input type=text class=inputbg name=codestr maxlength=4 size=6>"
       Response.Write" <img src=DV_getcode.asp>"
                      Response.Write"<br>"
        Response.Write"<input type=submit value=登录><br><br>"
    
        Response.Write"<a href=lostpass.asp>忘记密码</a> <a href=reg.asp>注册用户</a>"
                      Response.Write"</form>"
                      Else
                      Response.Write"欢迎您,亲爱的市民"
                      Response.Write"<br>"
                      Response.Write":: <a href=index.asp>进入论坛灌水</a> ::<br>"
                      Response.Write":: <a href=Usermanager.asp>管理我的资料</a> ::<br>"
                      Response.Write":: <a href=friendlist.asp>我的外交状况</a> ::<br>"
                      Response.Write":: <a href=query.asp?stype=5&s=2&pSearch=0&nSearch=0>我发起的主题</a> ::<br>"
                      Response.Write":: <a href=BoardPermission.asp?boardid=0&action=Myinfo>我的论坛权限</a> ::<br>"
                      Response.Write":: <a href=query.asp?stype=5&s=1&pSearch=0&nSearch=0>我参与的主题</a> ::<br>"
                      Response.Write":: <A HREF=favlist.asp>我的论坛收藏</A> ::"

                      End If

遨海湾-心灵的港湾 www.aosea.com
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 入住遨海湾

本版积分规则

网站解决方案专享优惠-3折上云

QQ|手机版|小黑屋|遨海湾超级社区

GMT+8, 2024-11-21 22:58

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表