[心缘地方]同学录
首页 | 功能说明 | 站长通知 | 最近更新 | 编码查看转换 | 代码下载 | 常见问题及讨论 | 《深入解析ASP核心技术》 | 王小鸭自动发工资条VBA版
登录系统:用户名: 密码: 如果要讨论问题,请先注册。
发表人 主题:关于修改用户资料的问题!
xbhon
身份:user
发帖:13
登陆次数:10
1F 发表于 2008/4/20 11:58:25
这个代码是从别的网站下载下来的,修改了,可是还是不行
谁有空帮我看看,看哪里出现的问题?
<%@CODEPAGE="936"%>
<!--#include File="session.asp" -->
<!--#include File="conn.asp" -->
<!--#include File="checkAccess.asp" -->
<meta NAME=GENERATOR Content="Microsoft FrontPage 6.0" CHARSET=GB2312>
<BODY leftmargin="0" bottommargin="0" rightmargin="0" topmargin="0" marginheight="0" marginwidth="0" bgcolor="#DDEEFF">
<%
    if NOT GetSession("userLevel")="admin" then
            call showMsg("对不起,您无权进入此页面。")
                response.end
    else
        if request("action")="save" then
            call saveuser()
        else
            call main()
        end if
        conn.close
        set conn=nothing
    end if

    sub main()
    if not isnumeric(request("userid")) then
        response.write "<p>错误的用户参数。</p>"
        response.end
    end if
    if not founderr then
        Set rs= Server.CreateObject("ADODB.Recordset")
        sql="select * from [TBL_user] where userid="&request("userid")
        rs.open sql,conn,1,1
        if rs.eof and rs.bof then
            response.write "<tr><td colspan=6 class=txlrow>没有找到相关用户。</td></tr>"
            response.end
            
        end if
    end if
%>
<table cellpadding="2" cellspacing="1" border="0" width="95%" class="tableBorder" align=center><FORM METHOD=POST ACTION="?action=save">
<tr>
<th colspan=2 height=23 align=left>用户资料操作</th>
</tr>
<tr>
<td width=20% class=txlrow>快捷操作选项</td>
<td width=80% class=txlrow>
①<a href="mailto:<%=rs("email")%>给 <%=rs("realname")%> 发送电子邮件</a><BR>
②<a href="messanger.asp?action=new&touser=<%=rs("realname")%>" target=_blank>给 <%=rs("realname")%> 发送一条短信</a><BR>
③<a href="userinfo.asp?id=<%=rs("userid")%>" target=_blank>预览 <%=rs("realname")%> 的显示资料</a><BR>
④<a href="?action=touser&useraction=1&userid=<%=rs("userid")%>">从用户列表删除 <%=rs("realname")%></a><BR>
</td>
</tr>
<tr>
<th colspan=2 height=23 align=left>用户基本资料修改--<%=rs("realname")%></th>
</tr>
<input name="userid" type=hidden value="<%=rs("userid")%>">
<tr>
<td width=20% class=txlrow>用户类别</td>
<td width=80% class=txlrow><input size=45 name="usergroup" type=text value="<%=rs("usergroup")%>" disabled></td>
</tr>
<tr>
<td width=20% class=txlrow>登 录 名</td>
<td width=80% class=txlrow><input size=45 name="username" type=text value="<%=rs("username")%>"> 说明:此项请谨慎修改</td>
</tr>
<tr>
<td width=20% class=txlrow>真实姓名</td>
<td width=80% class=txlrow><input size=45 name="realname" type=text value="<%=rs("realname")%>"></td>
</tr>
<tr>
<td width=20% class=txlrow>密  码</td>
<td width=80% class=txlrow><input size=45 name="password" type=text> 如果不修改请留空</td>
</tr>
<tr>
<td width=20% class=txlrow>密码问题</td>
<td width=80% class=txlrow><input size=45 name="question" type=text value="<%=rs("question")%>"></td>
</tr>
<tr>
<td width=20% class=txlrow>密码答案</td>
<td width=80% class=txlrow><input size=45 name="answer" type=text> 如果不修改请留空</td>
</tr>
<tr>
<td width=20% class=txlrow>用户Email</td>
<td width=80% class=txlrow><input size=45 name="email" type=text value="<%=rs("email")%>"></td>
</tr>
<tr>
<td width=20% class=txlrow>生日</td>
<td width=80% class=txlrow><input size=45 name="birthday" type=text value="<%=rs("birthday")%>"> 格式:2001-2-2</td>
</tr>
<tr>
<td width=20% class=txlrow>个人照片</td>
<td width=80% class=txlrow>
<input size=45 name="headPhoto" type=text value="<%=rs("headPhoto")%>"></td>
</tr>
<tr>
<th colspan=2 height=23 align=left>用户分值资料修改</th>
<tr>
<td width=20% class=txlrow>登录次数</td>
<td width=80% class=txlrow>
<input size=45 name="logTimes" type=text value="<%=rs("logTimes")%>"></td>
</tr>
<tr>
<td width=20% class=txlrow>发表留言</td>
<td width=80% class=txlrow>
<input size=45 name="replyNumber" type=text value="<%=rs("replyNumber")%>"></td>
</tr>
</tr>
<tr>
<th colspan=2 height=23 align=left>数据相关</th></tr>
<tr>
<td width=20% class=txlrow>注册时间</td>
<td width=80% class=txlrow><input size=45 name="regtime" type=text value="<%=rs("regtime")%>"></td>
</tr>
<tr>
<td width=20% class=txlrow>最后登陆时间</td>
<td width=80% class=txlrow>
<input size=45 name="logTime" type=text value="<%=rs("logTime")%>"></td>
</tr>
<tr>
<td width=20% class=txlrow>最后登陆IP</td>
<td width=80% class=txlrow>
<input size=45 name="lastip" type=text value="<%=rs("ip")%>">(<%=address(rs("lastIp"))%>)</td>
</tr>
<tr>
<th colspan=2 height=23 align=left>用户设置</th>
</tr>
<tr>
<td width=20% class=txlrow>用户类别</td>
<td width=80% class=txlrow>
<input type="radio" value="5" <%if rs("usergroupid")=4 then%>checked<%end if%> name="usergroupid"> 待批准成员 
<input type="radio" value="4" <%if rs("usergroupid")=3 then%>checked<%end if%> name="usergroupid"> 班级友人 
<input type="radio" value="3" <%if rs("usergroupid")=5 then%>checked<%end if%> name="usergroupid"> 正式成员 
<input type="radio" value="2" <%if rs("usergroupid")=2 then%>checked<%end if%> name="usergroupid"> 副管理员  
<input type="radio" value="1" <%if rs("usergroupid")=1 then%>checked<%end if%> name="usergroupid"> 管理员  
</td>
</tr>
<tr>
<td width=20% class=txlrow>用户状态</td>
<td width=80% class=txlrow>
<input type="radio" value="0" <%if rs("lockuser")=0 then%>checked<%end if%> name="lockuser"> 正常 
<input type="radio" value="1" <%if rs("lockuser")=1 then%>checked<%end if%> name="lockuser"> 验证  
<input type="radio" value="2" <%if rs("lockuser")=2 then%>checked<%end if%> name="lockuser"> 锁定 
</td>
</tr>
<tr>
<td width=100% class=txlrow align=center colspan=2><input name="submit" type=submit value="   更  新   "></td>
</tr>
</form>
</table>
<%
    rs.close
    set rs=nothing
    end sub

    sub saveuser()
    dim usergroupid,groupname
    if not isnumeric(request("userid")) then
        response.write "<tr><td colspan=6 class=txlrow>错误的用户参数。</td></tr>"
        founderr=true
    end if
    if isnumeric(request.form("usergroupid")) then
        usergroupid=request.form("usergroupid")
    end if
    set rs=conn.execute("select groupname from UserGroups where usergroupid="&usergroupid)
    groupname=rs(0)
    if not founderr then
    Set rs= Server.CreateObject("ADODB.Recordset")
    sql="select * from [user] where userid="&request("userid")
    rs.open sql,conn,1,3
    if rs.eof and rs.bof then
        response.write "<tr><td colspan=6 class=txlrow>没有找到相关用户。</td></tr>"
        founderr=true
    else
        rs("username")=request.form("username")
        rs("realname")=request.form("realname")
        if request.form("password")<>"" then
            rs("password")=md5(request.form("password"))
        end if
        rs("question")=request.form("question")
        if request.form("answer")<>"" then
            rs("answer")=md5(request.form("answer"))
        end if
        rs("email")=request.form("email")
        rs("userphoto")=request.form("userphoto")
        if request.form("birthday")="" then
            rs("birthday")=request.form("birthday")
        else
            if isdate(request.form("birthday")) then
                rs("birthday")=request.form("birthday")
            end if
        end if
        if isnumeric(request.form("logins")) then
            rs("logins")=request.form("logins")
        end if
        if isnumeric(request.form("bookcount")) then
            rs("bookcount")=request.form("bookcount")
        end if
        if isnumeric(request.form("bbscount")) then
            rs("bbscount")=request.form("bbscount")
        end if
        if isnumeric(request.form("photocount")) then
            rs("photocount")=request.form("photocount")
        end if
        if isnumeric(request.form("usermoney")) then
            rs("usermoney")=request.form("usermoney")
        end if
        if isdate(request.form("regtime")) then
            rs("regtime")=request.form("regtime")
        end if
        if isdate(request.form("lasttime")) then
            rs("lasttime")=request.form("lasttime")
        end if
        rs("lastip")=request.form("lastip")
        if isnumeric(request.form("lockuser")) then
            rs("lockuser")=request.form("lockuser")
        end if
        rs("usergroup")=groupname
        if isnumeric(request.form("usergroupid")) then
            rs("usergroupid")=request.form("usergroupid")
        end if
        rs.update
    end if
    rs.close
    set rs=nothing
    end if
    if founderr then
        response.write "<tr><td colspan=6 class=txlrow>更新失败。</td></tr>"
    else
        response.write "<tr><td colspan=6 class=txlrow>更新用户数据成功。</td></tr>"
    end if
    end sub
%><!--#include File="include/foot.asp" -->

嘎嘎,是我
身份:admin
发帖:1435
登陆次数:3222
2F 发表于 2008/4/20 23:00:05
别着急,明天晚上我来改吧。

xbhon
身份:user
发帖:13
登陆次数:10
3F 发表于 2008/4/22 9:34:12
没想到老大的速度还真快,今天来一看,就做出来了,
谢谢老大,非常敬佩!

 
标题:
消息图标:                                             
                                            
正文:



* UBB 代码开启

 
CopyRight © 心缘地方 2005-2999. All Rights Reserved