?? editinfook.asp
字號:
<!--#include file="conn.asp"-->
<!--#include file="fenlei.asp"-->
<!--#include file="md5.asp"-->
<!--#include file="isteacher.asp"-->
<%
fenlei1 = server.htmlencode(trim(request("fenlei1")))
fenlei2 = server.htmlencode(trim(request("fenlei2")))
teacher = server.htmlencode(trim(request("teacher")))
loginname = trim(request("loginname"))
email = server.htmlencode(trim(request("email")))
homepage = server.htmlencode(trim(request("homepage")))
address = server.htmlencode(trim(request("address")))
intro = server.htmlencode(trim(request("intro")))
photourl = server.htmlencode(trim(request("fileurl")))
qq = server.htmlencode(trim(request("qq")))
password = request("password")
password1 = request("password1")
ask = trim(request("ask"))
answer = trim(request("answer"))
if fenlei1 = "" then
conn.close
set conn = nothing
response.write "<script>alert('請輸入您所屬的"&strfenlei1&"');history.go(-1);</script>"
response.end
end if
if fenlei2 = "" then
conn.close
set conn = nothing
response.write "<script>alert('請輸入您所屬的"&strfenlei2&"');history.go(-1);</script>"
response.end
end if
if teacher = "" then
conn.close
set conn = nothing
response.write "<script>alert('請輸入您的姓名');history.go(-1);</script>"
response.end
end if
if len(teacher) > 10 then
conn.close
set conn = nothing
response.write "<script>alert('姓名不得超過10個漢字');history.go(-1);</script>"
response.end
end if
if loginname = "" then
conn.close
set conn = nothing
response.write "<script>alert('請輸入登錄名');history.go(-1);</script>"
response.end
end if
if len(loginname) > 10 then
conn.close
set conn = nothing
response.write "<script>alert('登錄名不得超過10個漢字');history.go(-1);</script>"
response.end
end if
if IsNumeric(loginname) then
conn.close
set conn = nothing
response.write "<script>alert('登錄名不得全為數字');history.go(-1);</script>"
response.end
end if
set rs = server.createobject("adodb.recordset")
sql = "select count(teacherid) from teacher where loginname='"&loginname&"' and teacherid<>"&session("teacherid")
rs.open sql,conn,1,1
if rs(0) > 0 then
rs.close
set rs = nothing
conn.close
set conn = nothing
response.write "<script>alert('該登錄名已經有人使用了');history.go(-1);</script>"
response.end
end if
rs.close
if len(email) > 30 then
conn.close
set conn = nothing
response.write "<script>alert('E-Mail地址不得超過30個字符');history.go(-1);</script>"
response.end
end if
if len(homepage) > 50 then
conn.close
set conn = nothing
response.write "<script>alert('個人主頁不得超過50個字符');history.go(-1);</script>"
response.end
end if
if len(qq) > 10 then
conn.close
set conn = nothing
response.write "<script>alert('QQ號碼不應該超過10位吧?');history.go(-1);</script>"
response.end
end if
if len(address) > 25 then
conn.close
set conn = nothing
response.write "<script>alert('通訊地址不得超過25個漢字');history.go(-1);</script>"
response.end
end if
if photourl <> "" and left(photourl,6) <> "files" and right(photourl,3) <> "jpg" and right(photourl,3) <> "gif" and right(photourl,3) <> "png" then
conn.close
set conn = nothing
response.write "<script>alert('照片格式不對,只支持jpg、gif和png格式的圖片');history.go(-1);</script>"
response.end
end if
if intro = "" then
conn.close
set conn = nothing
response.write "<script>alert('請輸入個人簡介');history.go(-1);</script>"
response.end
end if
if password <> password1 then
conn.close
set conn = nothing
response.write "<script>alert('兩次密碼輸入不一致');history.go(-1);</script>"
response.end
end if
if ask = "" then
conn.close
set conn = nothing
response.write "<script>alert('請輸入密碼找回問題');history.go(-1);</script>"
response.end
end if
if len(ask) > 25 then
conn.close
set conn = nothing
response.write "<script>alert('密碼找回問題不得超過25個漢字');history.go(-1);</script>"
response.end
end if
if answer = "" then
conn.close
set conn = nothing
response.write "<script>alert('請輸入密碼找回答案');history.go(-1);</script>"
response.end
end if
if len(answer) > 25 then
conn.close
set conn = nothing
response.write "<script>alert('密碼找回答案不得超過25個漢字');history.go(-1);</script>"
response.end
end if
sql = "select * from teacher where teacherid="&session("teacherid")
rs.open sql,conn,1,3
if rs.bof and rs.eof then
rs.close
set rs = nothing
conn.close
set conn = nothing
response.write "<script>alert('請不要搗亂');top.window.location.href='teachermain.asp';</script>"
response.end
else
rs("teacher")=teacher
rs("fenlei1")=fenlei1
rs("fenlei2")=fenlei2
rs("email")=email
if homepage <> "" and left(homepage,7) <> "http://" then
homepage = "http://"&homepage
end if
rs("homepage")=homepage
rs("address")=address
rs("photourl")=photourl
rs("qq")=qq
rs("intro")=intro
rs("ask")=ask
rs("answer")=answer
rs("loginname")=loginname
if password <> "" then rs("password")=password
rs.update
rs.close
set rs = nothing
conn.close
set conn = nothing
end if
response.write "<script>alert('修改成功');window.location.href='editinfo.asp?id="&session("teacherid")&"';</script>"
%>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -