📄 tem_contacts_inc.asp
字号:
<%
Dim name,sex,age,tel_home,tel_work,tel_hand,address_home
Dim address_house,company,email,oicq,icq,msn,homepage,photo
Dim photo_width,photo_height,addtime,grade,hits,remark,type_id,user_id
Dim rs1
Dim founderr,errinfo
const MaxPerPage=10
Function fun_contacts()
action=che(request("action"))
id=che(request("id"))
type_id=che(request("type_id"))
If action="list" Then
fun_contacts="<div id='contacts'><h1>通讯录管理</h1>"
set rs1=server.createobject("adodb.recordset")
Sql = "SELECT * FROM [Contacts_type] WHERE user_id="&user25175(0)
rs1.Open Sql, Conn, 1, 1
fun_contacts = fun_contacts & "<div class='menu'><B>分类列表:</B><A HREF='Contacts_info.asp?action=list&type_id=0'>所有</A> "
If Not rs1.eof Then
Dim rs1_i
Do While Not rs1.eof
rs1_i=rs1_i+1
fun_contacts = fun_contacts & "<A HREF='Contacts_info.asp?action=list&type_id="&rs1("id")&"'>"&rs1("Contacts_name")&"</A> "
rs1.movenext
If rs1_i =5 Then
rs1_i=0
fun_contacts = fun_contacts & "<BR>"
End If
loop
End If
fun_contacts = fun_contacts & "</div>"
rs1.close
fun_contacts = fun_contacts & "<table cellspacing='1' cellpadding='0' width='95%' align='center' border=0 class='list'>"&_
"<tr> "&_
"<th style='width:16px;text-align:center;' >选</th>"&_
"<th style='width:200px;'>姓名</th>"&_
"<th style='width:60px;'>性别</th>"&_
"<th style='width:200px;'>手机</th>"&_
"<th style='width:200px;'>邮箱</th>"&_
"<th style='width:200px;'>QQ</th>"&_
"<th style='width:60px;'>操作</th>"&_
"<th style='width:auto;'> </th>"&_
"</tr>"
If type_id="" Then type_id=0
If Not IsNumeric(type_id) Then type_id=0
If type_id<>0 Then
Sql_Condition=" and type_id="&type_id&" "
End If
sql="select id,name,sex,tel_hand,email,oicq from Contacts_info where user_id="&user25175(0)&" "&Sql_Condition&" order by id desc"
strFileName="Contacts_info.asp?action="&action&"&types="&types&"&keyword="&keyword&"type_id="&type_id
colnum="8"
formaction="Contacts_info.asp?action=del"
fun_contacts = fun_contacts & funsqllist(sql,colnum,strFileName,formaction)
If outcom=True Then
fun_contacts = fun_contacts & showContent
fun_contacts = fun_contacts & showpages
End If
fun_contacts = fun_contacts & "</table></div>"
ElseIf action="add" Then
fun_contacts=addtab
ElseIf action="save" Then
coninfo_jstable
if founderr=true Then
fun_contacts=msg("err",errinfo,"","")
else
set rs=server.createobject("adodb.recordset")
Sql = "SELECT * FROM [Contacts_info] WHERE id=0"
rs.Open Sql, Conn, 1, 3
rs.AddNew
coninfo_sqltable "add"
rs("user_id") = user25175(0)
rs.Update
rs.close
fun_contacts=msg("rig","","Contacts_info.asp?action=list","通讯录列表")
End If
ElseIf action="look" Then
if id="" Or isnumeric(id)=false then
founderr=true
errinfo=errinfo&"<li>联系人的ID不能为空<br>"
else
sql=Sqlinfo("","Contacts_info","user_id="&user25175(0)&" and id="&id,"","","")
set rs=conn.execute(sql)
if rs.eof and rs.bof then
founderr=true
errinfo=errinfo&"<li>没有该ID的联系人<br>"
else
fun_contacts=looktab
conn.execute("update Contacts_info set hits=hits+1 where id="&id&"")
end if
set rs=nothing
conn.close
set conn=Nothing
End If
If founderr Then fun_contacts=msg("err",errinfo,"","")
ElseIf action="edit" Then
If id="" Then
fun_contacts=msg("err","<li>参数错误","","")
Else
fun_contacts=edittab
End If
ElseIf action="mod" Then
coninfo_jstable
if founderr=true Then
fun_contacts=msg("err",errinfo,"","")
Else
set rs=server.createobject("adodb.recordset")
sql=Sqlinfo("","Contacts_info"," ID = "&id,"","","")
rs.Open Sql, Conn, 1, 3
If Not rs.Eof Then
coninfo_sqltable "mod"
rs.Update
fun_contacts=msg("rig","成功修改一条通讯录信息!","?action=look&ID="&id,"通讯录信息页面")
Else
fun_contacts=msg("err","<li>参数错误","","")
End If
rs.close
End If
ElseIf action="del" Then
If Len(id)=0 Then
fun_contacts=msg("err","<li>参数错误!","","")
Else
sqldel "Contacts_info",""
fun_contacts=msg("rig","成功删除选定的通讯录信息!","?action=list","通讯录列表")
End If
End If
End Function
Function showContent()
dim i
i=0
Dim temp_c
temp_c=""
dimarr "Gender"
do while not rs.eof
temp_c=temp_c & "<tr>"&_
"<td style='width:40px;text-align:center;' >"&_
" <input name='id' type='checkbox' onclick='unselectall()' id='ArticleID' value='"&Rs(0)&"' style=' border: 0px'> "&_
"</td>"&_
" <td><A HREF='Contacts_info.asp?action=look&id="&Rs(0)&"'>"&CutStr(Rs(1),8)&"</A></td>"&_
" <td>"&arr_Gender(Rs(2))&"</td>"&_
" <td>"&CutStr(Rs(3),11)&"</td>"&_
" <td><a href='mailto:"&Rs(4)&"' title='"&Rs(4)&"'>"&CutStr(Rs(4),12)&"</a></td>"&_
" <td>"&CutStr(Rs(5),9)&"</td>"&_
" <td><A HREF='Contacts_info.asp?action=edit&id="&Rs(0)&"'>修改</A></td>"&_
" <td> </td>"&_
"</tr>"
i=i+1
if i>=MaxPerPage then exit do
rs.movenext
Loop
showContent=temp_c
end Function
Sub coninfo_jstable()
type_id=request.form("type_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 type_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 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<>"" then
if photo_width="" or photo_height="" Or photo_width="0" 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
end If
if grade="" then
founderr=true
errinfo=errinfo&"<li>请选择一个关系等级<br>"
end if
if remark="" then
remark="-"
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -