CMS Traffic Systems Ltd. - Traffic Solutions
<%
if session("userid1")="" then
Response.Redirect "Login.asp?page=uploadcareers"
end if
Function ReplaceName(Name)
Dim LeftStr , RightStr
Dim SingleFound ,AtPlace
AtPlace = InStr(1, Name, "'")
If AtPlace > 0 Then
SingleFound = True
LeftStr = Left(Name, InStr(AtPlace, Name, "'") - 1) & "''"
RightStr = Right(Name, Len(Name) - InStr(AtPlace, Name, "'"))
While SingleFound = True
If InStr(AtPlace + 1, Name, "'") > 0 Then
LeftStr = LeftStr & Mid(Name, AtPlace + 1, InStr(AtPlace + 1, Name, "'") - AtPlace - 1) & "''"
RightStr = Right(Name, Len(Name) - InStr(AtPlace + 1, Name, "'"))
AtPlace = InStr(AtPlace + 1, Name, "'")
SingleFound = True
Else
SingleFound = False
End If
Wend
ReplaceName = LeftStr & RightStr
Else
ReplaceName = Name
End If
End Function
%>
<%
set conn1 = Server.CreateObject("adodb.Connection")
connstr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("tsl.mdb")
conn1.open connstr
mode=Request.QueryString("mode")
if mode <>"" then
cat_id=Request.QueryString("cat_id")
job_tit=Request.Form("job_tit")
job_des=Request.Form("job_des")
'job_des=replace(job_des,"'","/")
job_loc=Request.Form("job_loc")
'news_text=replace(news_text,"'","/")
job_add=Request.Form("job_add")
job_flag=Request.Form("display")
'Response.Write(prod_display)
end if
if mode="Add" then
flag="Y"
strsql="insert into careers(job_tit,job_des,job_loc,job_add,job_flag"
strsql=strsql&") values "
strsql=strsql&"('"&ReplaceName(job_tit)&"',"&"'"&ReplaceName(job_des)&"','"&ReplaceName(job_loc)&"','"&ReplaceName(job_add)&"','"&job_flag&"')"
end if
if mode="Modify" then
flag="Y"
strsql="update careers set job_tit='"&ReplaceName(job_tit)&"',job_des='"&ReplaceName(job_des)
strsql=strsql&"',job_loc='"&ReplaceName(job_loc)&"',job_add='"&job_add&"',job_flag='"&job_flag
strsql=strsql&"'"
strsql=strsql&" where cat_id="&cat_id
end if
if mode="Delete" then
flag="Y"
strsql="Delete from careers where cat_id="&cat_id
end if
if flag="Y" then
'Response.Write(strsql)
conn1.Execute strsql
end if
%>