<!--#INCLUDE FILE="validate.asp" -->

<%

Function chkinput()

	if chkpost=False Then
		ErrMsg=ErrMsg+"<Br>"+"<li>您提交的数据不合法，请不要从校友录外部提交信息。"
		Call Error("Critical",ErrMsg)
		chkinput=False
		Exit Function
	End if

	name=trim(Request.form("name"))

	if name="" Then
		ErrMsg=ErrMsg+"<br>"+"<li>请输入教师姓名"
		founderr=True
	ElseIf strlength(name)<4 or strlength(name)>8 Then
		ErrMsg=ErrMsg+"<br>"+"<li>教师姓名输入有误"
		founderr=True
	ElseIf not isChinese(name) Then
		ErrMsg=ErrMsg+"<br>"+"<li>教师姓名应为汉字"
		founderr=True
	End if

	if founderr=True Then
		Call Error("Information",ErrMsg)
		chkinput=False
		Exit Function
	End if

	telephone=trim(Request.form("telephone"))
	mobilephone=trim(Request.form("mobilephone"))
	email=trim(Request.form("email"))
	address=trim(Request.form("address"))

	if telephone="" and mobilephone="" and email="" and address="" Then
		ErrMsg=ErrMsg+"<br>"+"<li>对不起，您至少应留下一种与该教师联系的通信方式!"
		founderr=True
	End if

	if email<>"" and not IsValidEmail(email) Then
		ErrMsg=ErrMsg+"<br>"+"<li>电子邮件输入错误"
		founderr=True
	End if

	mobilephone=trim(request.form("mobilephone"))
	if mobilephone<>"" and (len(mobilephone)<>11 or not isinteger(mobilephone) or left(mobilephone,2)<>"13") then
		errmsg=errmsg+"<br>"+"<li>移动电话输入错误"
		founderr=true
	end If

	if telephone<>"" and not IsValidTel(telephone) Then
	ErrMsg=ErrMsg+"<br>"+"<li>电话号码输入错误"
	founderr=True
	End if

	zipcode=trim(Request.form("zipcode"))

	if address="" and zipcode<>"" Then
		ErrMsg=ErrMsg+"<br>"+"<li>请输入通讯地址"
		founderr=True
	End if

	if zipcode<>"" and (len(zipcode)<>6 or not isinteger(zipcode)) Then
		ErrMsg=ErrMsg+"<br>"+"<li>邮政编码输入错误"
		founderr=True
	End if

	if strlength(address)>100 Then
		ErrMsg=ErrMsg+"<br>"+"<li>通讯地址不能超过100个字符！"
		founderr=True
	End if

	other=rtrim(Request.form("other"))
	if strlength(other)>255 Then
		ErrMsg=ErrMsg+"<br>"+"<li>其他信息不能超过255个字符！"
		founderr=True
	End if

	if founderr=True Then
		Call Error("Information",ErrMsg)
		chkinput=False
	Else
		chkinput=True
	End if

End Function
%>