Files
poll-recruit/Recruit/Ajax/AjaxRecruit.asp
2025-10-01 09:29:34 +09:00

185 lines
6.9 KiB
Plaintext

<!--#include Virtual="/Lib/config.asp" -->
<%
Dim SQL, objdb, iCnt
set Objdb = Server.CreateObject("ADODB.Recordset")
Dim gubun : gubun = request("gubun")
Dim r_name : r_name = request("r_name")
Dim r_phone : r_phone = request("r_phone")
Dim r_pass : r_pass = request("r_pass")
Dim ex_phone : ex_phone = request("ex_phone")
Dim r_gender : r_gender = request("r_gender")
Dim r_birth : r_birth = request("r_birth")
Dim r_sd : r_sd = request("r_sd")
Dim r_sgg : r_sgg = request("r_sgg")
Dim r_emd : r_emd = request("r_emd")
Dim r_job : r_job = request("r_job")
Dim r_univ : r_univ = request("r_univ")
Dim r_year : r_year = request("r_year")
Dim r_position : r_position = request("r_position")
Dim r_area : r_area = request("r_area")
Dim r_district : r_district = request("r_district")
Dim r_car : r_car = request("r_car")
Dim r_ex : r_ex = request("r_ex")
Dim r_covid : r_covid = request("r_covid")
Dim r_agree1 : r_agree1 = request("r_agree1")
Dim r_agree2 : r_agree2 = request("r_agree2")
Dim r_edu : r_edu = request("r_edu")
Dim r_bank : r_bank = request("r_bank")
Dim r_account : r_account = request("r_account")
Dim r_jumin : r_jumin = request("r_jumin")
Dim chk : chk = request("chk")
Dim flag : flag = False
Select case gubun
case "update"
SQL = ""
SQL = SQL&" update exitpoll.dbo.R_info set "&VbCrlf
if r_phone <> "" Then
'SQL = SQL&" r_phone = dbo.base64_encode('"&r_phone&"'),"&VbCrlf
End If
if r_pass <> "" Then
SQL = SQL&" r_pass = dbo.base64_encode('"&r_pass&"'),"&VbCrlf
End If
'SQL = SQL&" r_name = '"&r_name&"',"&VbCrlf
SQL = SQL&" r_gender = '"&r_gender&"',"&VbCrlf
SQL = SQL&" r_birth = '"&r_birth&"',"&VbCrlf
SQL = SQL&" r_sd = '"&r_sd&"',"&VbCrlf
SQL = SQL&" r_sgg = '"&r_sgg&"',"&VbCrlf
SQL = SQL&" r_emd = '"&r_emd&"',"&VbCrlf
SQL = SQL&" r_agree1 = '1'," & VbCrlf
SQL = SQL&" r_agree2 = '1',"&VbCrlf
if r_job <> "" Then
SQL = SQL&" r_job = '"&r_job&"',"&VbCrlf
End If
if r_univ <> "" Then
SQL = SQL&" r_univ = '"&r_univ&"',"&VbCrlf
End If
if r_year <> "" Then
SQL = SQL&" r_year = '"&r_year&"',"&VbCrlf
End If
SQL = SQL&" r_district = '"&r_district&"',"&VbCrlf
if r_car <> "" Then
SQL = SQL&" r_car = '"&r_car&"',"&VbCrlf
End If
if r_ex <> "" Then
SQL = SQL&" r_ex = '"&r_ex&"',"&VbCrlf
End If
SQL = SQL&" r_bank = '"&r_bank&"',"&VbCrlf
SQL = SQL&" r_account = dbo.base64_encode('"&r_account&"'),"&VbCrlf
SQL = SQL&" r_jumin = dbo.base64_encode('"&r_jumin&"'),"&VbCrlf
SQL = SQL&" Udate = Getdate()"&VbCrlf
If r_edu = "" Then
SQL = SQL&", r_edu = '' "&VbCrlf
End If
SQL = SQL&" where r_phone = dbo.base64_encode('"&ex_phone&"') "&VbCrlf
flag = ExecuteSQL(SQL)
if r_edu <> "" Then
SQL = ""
SQL = SQL & " SELECT RE.eduCd, EduArea, EduDate, EduSpace, EduEtc1, Qu, ISNULL(RC.comp_cnt, 0) AS comp_cnt, "
SQL = SQL & " CASE WHEN Qu - ISNULL(RC.comp_cnt, 0) < 0 THEN 0 ELSE Qu - ISNULL(RC.comp_cnt , 0) END AS req_cnt "
SQL = SQL & " FROM exitpoll.dbo.R_Edu RE "
SQL = SQL & " LEFT JOIN ( "
SQL = SQL & " SELECT r_edu, count(*) AS comp_cnt "
SQL = SQL & " FROM exitpoll.dbo.R_info "
SQL = SQL & " WHERE flag = 1 AND ISNULL(r_edu, '') <> '' AND r_phone <> dbo.base64_encode('"&ex_phone&"') "
SQL = SQL & " GROUP BY r_edu "
SQL = SQL & " ) RC ON RE.EduCd = RC.r_edu "
SQL = SQL & " WHERE RE.Flag = 1 "
SQL = SQL & " AND RE.eduCd = '" & r_edu & "' "
DBConnect()
Objdb.Open SQL,DBConn,3,1,1
if Objdb.recordCount > 0 Then
if cInt(Objdb("req_cnt")) > 0 Then
SQL = " update exitpoll.dbo.R_info set r_edu = '" & r_edu & "' where r_phone = dbo.base64_encode('"&ex_phone&"')"
flag = ExecuteSQL(SQL)
Else
flag = "q"
End IF
End If
Objdb.Close
if flag = "q" Then
SQL = " SELECT 1 FROM R_Info WHERE r_edu = '" & r_edu & "' AND r_phone = dbo.base64_encode('"&ex_phone&"') "
Objdb.Open SQL,DBConn,3,1,1
if Objdb.recordCount > 0 Then
flag = True
End If
Objdb.Close
End If
DBClose()
End If
Response.Write flag
CASE "delete"
SQL = ""
SQL = SQL&" update exitpoll.dbo.R_Info set flag ='2', Udate=GETDATE() where dbo.base64_decode(r_phone) ='"&r_phone&"';"&VbcRlf
flag = ExecuteSQL(SQL)
SQL = SQL&" Delete from R_Deploy where dbo.base64_decode(r_phone) = '"&r_phone&"';"&VbcRlf
flag = ExecuteSQL(SQL)
Response.Write flag
case else
DBConnect()
SQL = " select * from exitpoll.dbo.R_info where r_phone = dbo.base64_encode('"&r_phone&"') "'사전 정보 Search
Objdb.Open SQL,DBConn,3,1,1
if not Objdb.eof Then
flag = False '존재하면 False
Else
flag = True '없으면 True
End If
DBClose()
if flag = True Then
SQL = ""'정보 insert
SQL = SQL&" Insert into exitpoll.dbo.R_info ( "
SQL = SQL&" r_name, r_phone, r_pass, r_gender, r_birth, "
SQL = SQL&" r_sd, r_sgg, r_emd, r_job, r_univ, r_year, "
SQL = SQL&" r_position, r_area, r_district, r_car, r_ex, "
SQL = SQL&" r_covid, r_agree1, r_agree2, chk "
SQL = SQL&" ) "
SQL = SQL&" values ( "
SQL = SQL&" '"&r_name&"', dbo.base64_encode('"&r_phone&"'), dbo.base64_encode('"&r_phone&"'), '"&r_gender&"', '"&r_birth&"', "
SQL = SQL&" '"&r_sd&"', '"&r_sgg&"', '"&r_emd&"', '"&r_job&"', '"&r_univ&"', '"&r_year&"', "
SQL = SQL&" '"&r_position&"', '"&r_area&"', '"&r_district&"', '"&r_car&"', '"&r_ex&"', "
SQL = SQL&" '"&r_covid&"', '"&r_agree1&"', '"&r_agree2&"', '"&chk&"' "
SQL = SQL&" )"
flag = ExecuteSQL(SQL)
Response.Write flag
Else
Response.Write flag
End If
End Select
' Response.Write "이름: "&r_name&"<br/>"
' Response.Write "성별: "&r_gender&"<br/>"
' Response.Write "생년월일: "&r_birth&"<br/>"
' Response.Write "핸드폰번호: "&r_phone&"<br/>"
' Response.Write "직업: "&r_job&"<br/>"
' Response.Write "소속학교: "&r_univ&"<br/>"
' Response.Write "학년: "&r_year&"<br/>"
' Response.Write "지원지역: "&r_area&"<br/>"
' Response.Write "교육일정: "&r_edu&"<br/>"
' Response.Write "지원분야: "&r_position&"<br/>"
' Response.Write "출구조사경험: "&r_ex
%>