<!--#include file="Inc/Consts.inc"-->
<!--#include file="Inc/NoSQL.Asp" -->
<!--#include file="Inc/Common.Asp"-->
<!--#include file="Inc/strfunc.Asp"-->
<!--#include file="Inc/sharefunc.Asp"-->
<%
' 文件名称:TelentSave.asp 2011-08-12 13:30:06
' Ss简单网站管理系统-开源版 
'晴天设计www.xxzwz.com
Dim rs, sql
Dim JobID, TalentsName, BirthDate, Stature, Marriage, RegResidence, EduResume, JobResume
Dim mMemID, mLinkman, mSex, mAddress, mZipCode, mTelephone, mMobile, mEmail, CheckCode
JobID = request.QueryString("JobID")
TalentsName = Trim(request.Form("TalentsName"))
BirthDate = Trim(request.Form("BirthDate"))
Stature = Trim(request.Form("Stature"))
Marriage = Trim(request.Form("Marriage"))
RegResidence = Trim(request.Form("RegResidence"))
EduResume = Trim(request.Form("EduResume"))
JobResume = Trim(request.Form("JobResume"))
mMemID = request.QueryString("MemberID")
mLinkman = Trim(request.Form("Linkman"))
mSex = Trim(request.Form("Sex"))
mAddress = Trim(request.Form("Address"))
mZipCode = Trim(request.Form("ZipCode"))
mTelephone = Trim(request.Form("Telephone"))
mMobile = Trim(request.Form("Mobile"))
mEmail = Trim(request.Form("Email"))
Dim ErrMessage, ErrMsg(11), FindErr(11), i
ErrMsg(0) = "请填写申请职位。"
ErrMsg(1) = "出生日期格式错误。"
ErrMsg(2) = "身高必须为数字。"
ErrMsg(3) = "请填写户口所在地。"
ErrMsg(4) = "请填写教育经历。"
ErrMsg(5) = "请填写工作经历。"
ErrMsg(6) = "请填写姓名。"
ErrMsg(7) = "请填写联系地址。"
ErrMsg(8) = "请正确填写邮政编码。"
ErrMsg(9) = "请正确填写联系电话。"
ErrMsg(10) = "请正确填写手机号码。"
ErrMsg(11) = "电子信箱格式错误。"

If Len(TalentsName)>100 Or Len(TalentsName) = 0 Then FindErr(0) = True
If Not IsDate(BirthDate) Then   FindErr(1) = True
If Not IsNumeric(Stature) Or Len(Stature) = 0 Then  FindErr(2) = True
If Len(RegResidence)>100 Or Len(RegResidence) = 0 Then   FindErr(3) = True
If Len(EduResume) = 0 Then FindErr(4) = True
If Len(JobResume) = 0 Then   FindErr(5) = True
If Len(mLinkman)>50 Or Len(mLinkman) = 0 Then  FindErr(6) = True
If Len(mAddress)>100 Or Len(mAddress) = 0 Then  FindErr(7) = True
If Len(mZipCode)<>6 Then   FindErr(8) = True
If Len(mTelephone)>50 Or Len(mTelephone) = 0 Then FindErr(9) = True
If Len(mMobile)>50 Or Len(mMobile)<11 Or Len(mMobile) = 0 Then FindErr(10) = True
If Not IsValidEmail(mEmail) Then FindErr(11) = True
For i = 0 To UBound(FindErr)
    If FindErr(i) = True Then ErrMessage = ErrMessage+ErrMsg(i) + "\n"
Next
If Not (ErrMessage = "" Or IsNull(ErrMessage)) Then  Call Alert(ErrMessage,"b-1"):response.End
sql = "select JobID,TalentsName,BirthDate,Stature,Marriage,RegResidence,EduResume,LinkMan,Sex,Address,Zipcode,Telephone,Mobile,Email from ["&Datapre&"_Talents]"
set rs=db(sql,3)
rs.addnew
rs("JobID") = JobID
rs("TalentsName") = StrReplace(TalentsName)
rs("BirthDate") = BirthDate
rs("Stature") = Stature
rs("Marriage") = Marriage
rs("RegResidence") = StrReplace(RegResidence)
rs("EduResume") = StrReplace(EduResume)
rs("JobResume") = StrReplace(JobResume)
rs("Linkman") = StrReplace(mLinkman)
rs("Sex") = mSex
rs("Address") = StrReplace(mAddress)
rs("ZipCode") = StrReplace(mZipCode)
rs("Telephone") = StrReplace(mTelephone)
rs("Mobile") = StrReplace(mMobile)
rs("Email") = mEmail
rs.update
rs.Close:Set rs = Nothing
call db("update ["&Datapre&"_Jobs] set TalentsNumber = TalentsNumber+1 where ID="&JobID,0)
Call Alert("简历提交成功！","Index.Asp")
' 文件名称:TelentSave.asp 2012
' Ss简单网站管理系统-开源版 
'晴天设计www.xxzwz.com

Function IsValidEmail(email)
    Dim names, Name, i, c
    IsValidEmail = True
    names = Split(email, "@")
    If UBound(names) <> 1 Then
        IsValidEmail = False
        Exit Function
    End If
    For Each Name in names
        If Len(Name) <= 0 Then
            IsValidEmail = False
            Exit Function
        End If
        For i = 1 To Len(Name)
            c = Mid(Name, i, 1)
            If InStr("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_-.", c) <= 0 And Not IsNumeric(c) Then
                IsValidEmail = False
                Exit Function
            End If
        Next
        If Left(Name, 1) = "." Or Right(Name, 1) = "." Then
            IsValidEmail = False
            Exit Function
        End If
    Next
    If InStr(names(1), ".") <= 0 Then
        IsValidEmail = False
        Exit Function
    End If
    i = Len(names(1)) - InStrRev(names(1), ".")
    If i <> 2 And i <> 3 Then
        IsValidEmail = False
        Exit Function
    End If
    If InStr(email, "..") > 0 Then
        IsValidEmail = False
    End If
End Function
%>