⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 memberedit.asp

📁 单班同学录 一个非常漂亮的同学录 哦
💻 ASP
📖 第 1 页 / 共 2 页
字号:
<%@LANGUAGE="VBScript" CODEPAGE="936"%>
<!--#include file="SESSION.asp" -->
<!--#include file="CONN.asp" -->
<!--#include file="MD5.asp" -->
<!--#include file="CHAR.asp" -->
<%
response.Buffer=true
response.Expires=0
username=session("username")

dim errmsg,founderr
errmsg=""
founderr=false


'修改密码
sub editsys
	passwd=replace(trim(request.Form("oldpasswd")),"'","")
	if passwd="" then
		errmsg=errmsg+"<br>"+"<li>密码不能为空!"
		founderr=true
		exit sub
	end if
	passwd=md5(passwd)
	set rs1=server.CreateObject("adodb.recordset")
	strsql="select username,passwd from [user] where username='"&username&"' and passwd='"&passwd&"'"
	rs1.open strsql,conn,1,3
	if rs1.bof or rs1.eof then
		errmsg=errmsg+"<br>"+"<li>您输入的密码不正确!"
		founderr=true
		exit sub
	end if
	newpasswd=replace(trim(request.Form("newpasswd")),"'","")
	renewpasswd=replace(trim(request.Form("renewpasswd")),"'","")
	if newpasswd="" or len(passwd)<6 then
		errmsg=errmsg+"<br>"+"<li>请输入您的新密码!"
		founderr=true
		exit sub
	end if
	if renewpasswd="" or len(passwd)<6 then
		errmsg=errmsg+"<br>"+"<li>请确认您的新密码!"
		founderr=true
		exit sub
	end if
	if newpasswd<>renewpasswd then
		errmsg=errmsg+"<br>"+"<li>前后输入的密码不一致!"
		founderr=true
		exit sub
	end if
	newpasswd=md5(newpasswd)
	if founderr=false then	
		rs1("passwd")=newpasswd
		rs1.update
		errmsg="<li>修改密码成功!"
	end if 
	rs1.close
	set rs1=nothing
end sub

'修改个人资料
sub editbasic
	answer=trim(request("answer"))
	if answer="" then
		errmsg=errmsg+"<br>"+"<li>请输入您的问题。"
		founderr=true
	end if
	question=trim(request("question"))
	question2=trim(request("question2"))
	if question="" then
		errmsg=errmsg+"<br>"+"<li>请输入您的问题答案。"
		founderr=true
	else
	'如果question和question2的值一样,则不做更新
		if question<>question2 then
			question=md5(question)
		end if
	end if
	realname=trim(request("realname"))
	if realname="" or len(realname)>5 then
		errmsg=errmsg+"<br>"+"<li>请填写您的姓名(长度不能大于5位)。"
  		founderr=true
	end if
	sex=trim(request("sex"))
	if sex="male" then
		sex="男"
	else
		sex="女"
	end if
	birthday=trim(Request.Form("birthyear"))&"年"&trim(Request.Form("birthmonth"))&"月"&trim(Request.Form("birthday"))&"日"
	if isdate(birthday) then 
		birthday=cdate(birthday)
	else
		birthday=""
	end if
	if trim(request("mphone"))<>""  then
		if not isnumeric(trim(request("mphone"))) or len(trim(request("mphone")))<>11 then
			errmsg=errmsg+"<br>"+"<li>您的手机号码有错误。"
  			founderr=true
		else
			mphone=trim(request("mphone"))
		end if
	end if
	homeaddr=trim(request("homeaddr"))
	if trim(request("homephone"))<>"" then
			homephone=trim(request("homephone"))
	end if
	if trim(request("postcode"))<>"" then
		if not isnumeric(trim(request("postcode"))) or len(trim(request("postcode")))>8 then
			errmsg=errmsg+"<br>"+"<li>您的家庭邮政编码有错误。"
  			founderr=true
		else
			postcode=trim(request("postcode"))
		end if
	end if
	jobaddr=trim(request("jobaddr"))
	if trim(request("jobphone"))<>"" then
			jobphone=trim(request("jobphone"))
	end if
	if IsValidEmail(trim(request("email")))=false then
		errmsg=errmsg+"<br>"+"<li>您的Email有错误。"
  		founderr=true
	else
		email=trim(request("email"))
	end if
	if trim(request("oicq"))<>"" then
		if not isnumeric(trim(request("oicq"))) or len(trim(request("oicq")))>12 then
			errmsg=errmsg+"<br>"+"<li>Oicq号码只能是4-12位数字,您可以选择不输入。"
			founderr=true
		else
			oicq=trim(request("oicq"))
		end if
	end if
	if trim(request("msn"))<>"" then
		if IsValidEmail(trim(request("msn")))=false then
			errmsg=errmsg+"<br>"+"<li>您的MSN有错误。"
  			founderr=true
		else
			msn=trim(request("msn"))
		end if
	end if
	homepage=trim(request("homepage"))
	if left(homepage,7)<>"http://" and homepage<>"" then
		homepage="http://"&homepage
	end if
	
	if not founderr then
	set rs2=server.CreateObject("adodb.recordset")
	strsql="select * from [user] where username='"&username&"'"
	rs2.open strsql,conn,2,3
	rs2("answer")=answer
	rs2("question")=question
	rs2("realname")=realname
	rs2("sex")=sex
	if birthday<>"" then
		rs2("birthday")=birthday
	end if
	rs2("mphone")=mphone
	rs2("homeaddr")=homeaddr
	rs2("homephone")=homephone
	rs2("postcode")=postcode
	rs2("jobaddr")=jobaddr
	rs2("jobphone")=jobphone
	rs2("email")=email
	rs2("oicq")=oicq
	rs2("msn")=msn
	rs2("homepage")=homepage
	rs2.update
	rs2.close
	set rs2=nothing
	errmsg="<li>个人资料已经更新!"
	end if
end sub


if request.Form("method")="sys" then
	call editsys
end if
if request.Form("method")="basic" then
	call editbasic
end if



set rs=server.CreateObject("adodb.recordset")
strsql="select * from [user] where username='"&username&"'"
rs.open strsql,conn,1,1
dim sex,birthyear,birthmonth,birthday
sex=rs("sex")
birthyear=year(rs("birthday"))
birthmonth=month(rs("birthday"))
birthday=day(rs("birthday"))
%>

<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta http-equiv="Content-Language" content="zh-cn">
<title><%=classname%>同学录--个人资料修改</title>
<link href="css/class.css" type=text/css rel=stylesheet>
<script language="JavaScript">
<!--
function checkform1()
	{if  (form1.oldpasswd.value.length==0) {
	alert("请输入您原来帐号的密码!");
	form1.oldpasswd.focus();
	return false;
	}
	if  (form1.newpasswd.value.length==0) {
	alert("请输入您的新密码!");
	form1.newpasswd.focus();
	return false;
	}
	if  (form1.renewpasswd.value.length==0) {
	alert("请确认您的新密码!");
	form1.renewpasswd.focus();
	return false;
	}
	if  (form1.newpasswd.value != form1.renewpasswd.value) {
	alert("您两次输入的密码不一致!请重新输入!");
	form1.newpasswd.focus();
	return false;
	}
	return true
	}
	
	function checkform2(){
	if (document.form2.realname.value.length==0){
		alert("请输入您的真实姓名!")
		document.form2.realname.focus();
		return false;}
		

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -