📄 saveedit.asp
字号:
<!--#include file="conn.asp"-->
<!--#include file="error.asp"-->
<%
if request("action")="del" then
call del()
else
call edit()
end if
sub del()
response.write"<title>"&sitename&"-删除联系人</title>"
dim id,name,class_id
id=request("id")
if id="" then
founderr=true
errinfo="<li>联系人ID不能为空<br>"
elseif isnumeric(id)=false then
founderr=true
errinfo="<li>联系人ID参数错误<br>"
else
set rs=conn.execute("select name,class_id from address_list where id="&id&" and user='"&member&"'")
if rs.eof and rs.bof then
founderr=true
errinfo="<li>你没有该联系人<br>"
else
name=rs("name")
class_id=rs("class_id")
end if
set rs=nothing
end if
if founderr then
call errweb()
else
conn.execute("delete * from address_list where id="&id&"")
conn.execute("update address_class set classtotal=classtotal-1 where id="&class_id&"")
success="<li>你删除了一个联系人——"&name&"<br><li><a href='manage_sort.asp?action=tidy'>执行各分类下联系人总数整理</a><br><li><a href='main.asp'>返回"&sitename&"</a><br>"
call successweb()
end if
end sub
sub edit()
response.write"<title>"&sitename&"-保存编辑</title>"
dim id,class_id,name,sex,age,tel_home,tel_work,tel_hand,address_home,address_house,company,email,oicq,icq,msn,homepage,photo,photo_width,photo_height,grade,remark
id=request("id")
class_id=request.form("class_id")
name=trim(lcase(request.form("name")))
sex=request.form("sex")
age=trim(request.form("age"))
tel_home=trim(request.form("tel_home"))
tel_work=trim(request.form("tel_work"))
tel_hand=trim(request.form("tel_hand"))
address_home=trim(request.form("address_home"))
address_house=trim(request.form("address_house"))
company=trim(request.form("company"))
email=trim(request.form("email"))
oicq=trim(request.form("oicq"))
icq=trim(request.form("icq"))
msn=trim(request.form("msn"))
homepage=trim(request.form("homepage"))
photo=trim(request.form("photo"))
photo_width=trim(request.form("photo_width"))
photo_height=trim(request.form("photo_height"))
grade=trim(request.form("grade"))
remark=trim(request.form("remark"))
if class_id="" then
founderr=true
errinfo="<li>请选择一个分类<br>"
end if
if name="" then
founderr=true
errinfo=errinfo&"<li>请输入联系人姓名<br>"
elseif len(name)>5 then
founderr=true
errinfo=errinfo&"<li>联系人姓名不能超过5个字符<br>"
end if
if age="" then
age="-"
elseif age<>"-" and isnumeric(age)=false or len(age)>2 then
founderr=true
errinfo=errinfo&"<li>年龄只能是1~99之间的整数<br>"
end if
if sex="" then
founderr=true
errinfo=errinfo&"<li>请选择性别<br>"
end if
if tel_home="" then
tel_home="-"
elseif len(tel_home)>15 then
founderr=true
errinfo=errinfo&"<li>家庭/住所电话不能超过15个字符<br>"
end if
if tel_work="" then
tel_work="-"
elseif len(tel_work)>15 then
founderr=true
errinfo=errinfo&"<li>工作电话不能超过15个字符<br>"
end if
if tel_hand="" then
tel_hand="-"
elseif len(tel_hand)>15 then
founderr=true
errinfo=errinfo&"<li>私人手机不能超过15个字符<br>"
end if
if address_home="" then
address_home="-"
elseif len(address_home)>15 then
founderr=true
errinfo=errinfo&"<li>家庭地址不能超过20个字符<br>"
end if
if address_house="" then
address_house="-"
elseif len(address_house)>20 then
founderr=true
errinfo=errinfo&"<li>住所地址不能超过20个字符<br>"
end if
if company="" then
company="-"
elseif len(company)>20 then
founderr=true
errinfo=errinfo&"<li>工作单位不能超过20个字符<br>"
end if
if email="" then
email="-"
elseif len(email)>50 then
founderr=true
errinfo=errinfo&"<li>邮箱不能超过50个字符<br>"
end if
if oicq="" then
oicq="-"
elseif len(oicq)>20 then
founderr=true
errinfo=errinfo&"<li>OICQ不能超过20个字符<br>"
end if
if icq="" then
icq="-"
elseif len(icq)>20 then
founderr=true
errinfo=errinfo&"<li>ICQ不能超过20个字符<br>"
end if
if msn="" then
msn="-"
elseif len(msn)>50 then
founderr=true
errinfo=errinfo&"<li>MSN不能超过50个字符<br>"
end if
if homepage="" then
homepage="-"
elseif len(homepage)>50 then
founderr=true
errinfo=errinfo&"<li>网页不能超过50个字符<br>"
end if
if photo="" then
photo="-"
elseif len(photo)>100 then
founderr=true
errinfo=errinfo&"<li>照片不能超过100个字符<br>"
end if
if photo_width="" or photo_width=0 or photo_height="" or photo_height=0 then
photo_width=0
photo_height=0
elseif isnumeric(photo_width)=false or isnumeric(photo_height)=false then
founderr=true
errinfo=errinfo&"<li>照片宽和高只能输入整数<br>"
elseif photo_width>200 or photo_width<20 or photo_height>250 or photo_height<20 then
founderr=true
errinfo=errinfo&"<li>照片宽在20-200象素之间,高在20-250象素之间<br>"
end if
if grade="" then
founderr=true
errinfo=errinfo&"<li>请选择一个关系等级<br>"
end if
if remark="" then
remark="-"
elseif len(remark)>250 then
founderr=true
errinfo=errinfo&"<li>备注不能超过250个字符<br>"
end if
if founderr=true then
call errweb()
else
conn.execute("update address_list set class_id="&class_id&",name='"&name&"',sex='"&sex&"',age='"&age&"',tel_home='"&tel_home&"',tel_work='"&tel_work&"',tel_hand='"&tel_hand&"',address_home='"&address_home&"',address_house='"&address_house&"',company='"&company&"',email='"&email&"',oicq='"&oicq&"',icq='"&icq&"',msn='"&msn&"',homepage='"&homepage&"',photo='"&photo&"',photo_width="&photo_width&",photo_height="&photo_height&",grade="&grade&",remark='"&remark&"' where id="&id&" and user='"&member&"'")
success="<li>编辑联系人成功<br><li><a href='address.asp?id="&id&"'>返回该联系人</a><br><li><a href='manage_sort.asp?action=tidy'>执行各分类下联系人总数整理</a><br><li><a href='main.asp'>返回"&sitename&"</a><br>"
call successweb()
end if
end sub
conn.close
set conn=nothing
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -