关于新云下载系统6中的后台发布软件管理的问题请教!

loveball 2005-11-24 10:00:48
一般说来,在后台不同管理员发布的信息互相都能看到的,现在我想把新云下载系统6中的后台发布软件功能给修改一下,就是每个管理员登陆成功后只能对他发布的软件进行管理,其他管理员发布的软件对他不可见,这个如何能实现呢?附上部分代码以及相关说明:
说明:
管理员从后台登陆成功后生成几个session,如下:
Sub chklogin()
Dim adminname, password
adminname = Trim(Replace(request("adminname"), "'", ""))
password = NC_Encode.md5(Trim(Replace(request("password"), "'", "")))
If Newasp.IsValidStr(Request("adminname")) = False Then
Errmsg = Errmsg + "<li>用户名中含有非法字符。</li>"
Founderr = true
Exit Sub
End If
If Newasp.IsValidPassword(Request("password")) = False Then
Errmsg = Errmsg + "<li>密码中含有非法字符。</li>"
Founderr = true
Exit Sub
End If
If request("verifycode") = "" Then
errmsg = errmsg + "<br>" + "<li>请返回输入确认码。<li><b>返回后请刷新登陆页面后重新输入正确的信息。</b>"
founderr = true
Exit Sub
ElseIf session("getcode") = "9999" Then
session("getcode") = ""
errmsg = errmsg + "<br>" + "<li>请不要重复提交,如需重新登陆请返回登陆页面。<li><b>返回后请刷新登陆页面后重新输入正确的信息。</b>"
founderr = true
Exit Sub
ElseIf CStr(session("getcode"))<>CStr(Trim(request("verifycode"))) Then
errmsg = errmsg + "<br>" + "<li>您输入的确认码和系统产生的不一致,请重新输入。<li><b>返回后请刷新登陆页面后重新输入正确的信息。</b>"
founderr = true
Exit Sub
End If
session("getcode") = ""
If adminname = "" Or password = "" Then
founderr = true
Errmsg = Errmsg + "<br>" + "<li>请输入您的用户名或密码。<li><b>返回后请刷新登陆页面后重新输入正确的信息。</b>"
Exit Sub
End If
If founderr Then Exit Sub
Set rs = conn.Execute("select * from " & Admintable & " where adminname='"&adminname&"'")
If rs.EOF And rs.bof Then
rs.Close
Set rs = Nothing
founderr = true
errmsg = "您输入的用户名和密码不正确或者您不是系统管理员。请<a href=admin_login.asp>重新输入</a>您的密码。<b>返回后请刷新登陆页面后重新输入正确的信息。</b>"
Exit Sub
Else
If rs("isActive") = 0 Then
founderr = true
errmsg = "你的用户名已被锁定,你不能登陆!请联系管理员."
Exit Sub
End If
If Trim(rs("password"))<>password Then
founderr = true
errmsg = "您输入的用户名和密码不正确或者您不是系统管理员。请<a href=login.asp>重新输入</a>您的密码。<li><b>返回后请刷新登陆页面后重新输入正确的信息。</b>"
Exit Sub
Else
Session(Newasp.CacheName & "AdminName") = rs("adminname")
session(Newasp.CacheName & "Purview") = rs("Purview")
session(Newasp.CacheName & "Flag") = rs("Flag")
session(Newasp.CacheName & "adminid") = rs("id")
session("username1122") = rs("adminname") /这是我自行添加的
conn.Execute("update " & Admintable & " set Logintime="&Newasp.SqlString&",loginip='"&Newasp.GetUserip&"' where adminname='"&adminname&"'")
rs.Close
Set rs = Nothing
response.redirect("admin_index.asp")
End If
End If

End Sub
自己刚搞了个马甲,想把完整代码贴出来,有1200多行,其实关键的代码就在以下这几个地方,在这个页面有三个功能,第一发布软件,第二搜索软件,第三是修改和删除(可以批量处理),对管理员而言所有的发布软件的信息是可见的,我只想实现一个管理员帐号登陆进来后在这个页面管理他自己发布的信息,其他人发布的他看不到,把需要修改的几个地方的几行代码贴出来,请大家看一下,同时附上我自己的想法,不知道正确不正确。
...全文
89 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
yousite1 2005-12-09
  • 打赏
  • 举报
回复
就是加个搜索条件而已,不自己想想有什么问题就问人。。。晕。
尚和空四 2005-12-09
  • 打赏
  • 举报
回复
晕了
batistutafans 2005-11-24
  • 打赏
  • 举报
回复
顶一下,请高手出来指点一下,多谢了!
loveball 2005-11-24
  • 打赏
  • 举报
回复
我的想法是在搜索条件中加上username=" & session("username1122")& " and,用来限定是本管理员帐号发布的信息,但是加进去以后还是没有效果,我是加在:
SQL = "select * from NC_SoftInfo where isLock=0 and sortid in (" & AllSortID & ") order by isTop desc,softTime desc,softid desc"
Else
SQL = "select * from NC_SoftInfo where isLock=0 and rootid=" & rootid & " order by isTop desc,softTime desc,softid desc"
End If
Else
SQL = "select * from NC_SoftInfo where username=" & session("username1122")& " and isLock=0 order by isTop desc,softTime desc,softid desc" '在这里添加的,可是没有效果,还是把所有的管理员发布的所有软件信息都列出来了
End If
End If
loveball 2005-11-24
  • 打赏
  • 举报
回复
这个是关于搜索发布信息的代码,我想改成搜索的结果只能是在自己发布的信息里搜索
Response.Write "<script language=""JavaScript"">" & vbCrLf
Response.Write "<!--//" & vbCrLf
Response.Write "function SelectAll() {" & vbCrLf
Response.Write Chr(9) & "for (var i=0;i<document.selform.selSoftid.length;i++) {" & vbCrLf
Response.Write Chr(9) & Chr(9) & "var e=document.selform.selSoftid[i];" & vbCrLf
Response.Write Chr(9) & Chr(9) & "e.checked=!e.checked;" & vbCrLf
Response.Write Chr(9) & "}" & vbCrLf
Response.Write "}" & vbCrLf
Response.Write "//-->" & vbCrLf
Response.Write "</script>" & vbCrLf
Response.Write "<script language=""JavaScript"">" & vbCrLf
Response.Write "<!--//" & vbCrLf
Response.Write "function Juge(myform)" & vbCrLf
Response.Write "{" & vbCrLf
Response.Write "if (myform.keyword.value == """")" & vbCrLf
Response.Write Chr(9) & "{" & vbCrLf
Response.Write Chr(9) & Chr(9) & "alert(""请输入要查询的关键字!"");" & vbCrLf
Response.Write Chr(9) & Chr(9) & "myform.keyword.focus();" & vbCrLf
Response.Write Chr(9) & Chr(9) & "return (false);" & vbCrLf
Response.Write Chr(9) & "}" & vbCrLf
Response.Write "}" & vbCrLf
Response.Write "//-->" & vbCrLf
Response.Write "</script>" & vbCrLf
Response.Write "<table border=""0"" align=""center"" cellpadding=""2"" cellspacing=""1"" class=""tableBorder"">"
Response.Write " <tr>"
Response.Write " <th colspan=""5"">软件管理</th></tr>"
Response.Write " <tr><form method=Post name=""myform"" action=""admin_software.asp"" onSubmit=""return Juge(this)"">"
Response.Write " <td class=forumrow height=""22"" colspan=""5"">"
Response.Write "查询: <input align=""absmiddle"" name=""keyword"" type=""text"" id=""keyword"" size=""30"">  查询方法:"
Response.Write " <select size=""1"" name=""key"">"
Response.Write " <option value=""topic"">软件名称</option>"
Response.Write " <option value=""body"">软件说明</option>"
Response.Write " <option value="""">不限条件</option>"
Response.Write " </select>"
Response.Write " <input type=""submit"" name=""Submit"" align=""absmiddle"" value=""查 询..."" class=button>"
Response.Write " </td></tr></form>"
Response.Write " <tr>"
Response.Write " <th nowrap>选择</th><th width=""70%"">软件标题 "
srtSortingMenu = SortingJumpMenu
srtSortingMenu = Replace(srtSortingMenu, "{SortID=" & Request("clasid") & "}", "selected")
Response.Write srtSortingMenu
Response.Write "</th><th nowrap>修改软件</th><th nowrap>推 荐</th><th nowrap>整理时间</th></tr>"
If Request("clasid") <> "" Then
SQL = "select sortid,SortName,skycnid,rootid,depth,ParentID,strParent,Child from [NC_SoftSort] where sortid = " & Request("clasid")
Rs.Open SQL, Conn, 1, 1
Newasp.SqlQueryNum = Newasp.SqlQueryNum + 1
If Rs.bof And Rs.EOF Then
Response.Write "Sorry!没有找到任何软件信息。或者您选择了错误的系统参数!"
Response.Write
Else
strSortName = Rs("SortName")
sortid = Rs("sortid")
rootid = Rs("rootid")
depth = Rs("depth")
ParentID = Rs("ParentID")
strParent = Rs("strParent")
Child = Rs("Child")
End If
Rs.Close
Else
strSortName = "全部软件"
End If
keyword = Newasp.HTMLEncodes(Request("keyword"))
maxperpage = 20 '###每页显示数
If Not IsNumeric(Request("page")) And Len(Request("page")) <> 0 Then
Response.Write "错误的系统参数!请输入整数"
Response.End
End If
If Not IsEmpty(Request("page")) And Len(Request("page")) <> 0 Then
CurrentPage = CInt(Request("page"))
Else
CurrentPage = 1
End If
If CInt(CurrentPage) = 0 Then CurrentPage = 1
If Not IsNull(keyword) And keyword <> "" Then
keyword = Replace(Replace(Replace(keyword, "'", "‘"), "<", "<"), ">", ">")
If Request("key") = "topic" Then
findword = "softname like '%" & keyword & "%'"
ElseIf Request("key") = "body" Then
findword = "content like '%" & keyword & "%'"
Else
findword = "softname like '%" & keyword & "%' or content like '%" & keyword & "%'"
End If
SQL = "select * from NC_SoftInfo where " & findword & " "
SQL = SQL & " order by isTop desc,softTime desc"
Else
If Request("clasid") <> "" Then
If depth <> 0 Then
Dim Rss, AllSortID,ParentStr
Set Rss = Newasp.Execute("select * from NC_SoftSort where strParent like '%"& sortid &"%'")
If Rss.EOF And Rss.bof Then
AllSortID = sortid
Else
Do While Not Rss.EOF
ParentStr = Split(Rss("strParent"), ",")
For i = 0 To UBound(ParentStr)
If CLng(ParentStr(i)) = sortid Then
AllSortID = AllSortID & Rss("sortid") &","
Exit For
End If
Next
Rss.movenext
Loop
AllSortID = AllSortID & sortid
End If
Rss.Close
Set Rss = Nothing
SQL = "select * from NC_SoftInfo where isLock=0 and sortid in (" & AllSortID & ") order by isTop desc,softTime desc,softid desc"
Else
SQL = "select * from NC_SoftInfo where isLock=0 and rootid=" & rootid & " order by isTop desc,softTime desc,softid desc"
End If
Else
SQL = "select * from NC_SoftInfo where isLock=0 order by isTop desc,softTime desc,softid desc"
End If
End If

28,406

社区成员

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

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