<% IF REQUEST("createticket")="go" THEN StrCTErr="None" str_subject=sanitizeRequest("subject","form") IF str_subject <> "" AND len(str_subject) < 200 THEN 'ok ELSE StrCTErr="Subject is required" END IF str_content= sanitizeRequest("content","form") IF str_content <> "" AND len(str_content) < 1000 THEN 'ok ELSE StrCTErr="Description is required (upto 1000 characters allowed)" END IF 'ticketDate=year(now())&"-"&month(now())&"-"&day(now())&":"&hour(now())&":"&minute(now())&":00" IF StrCTErr <> "None" THEN 'print the errors response.write("") ELSE dbCBK.Execute("INSERT into cbk_support_tickets (`schoolID`,`parentID`,`status`,`dateCREATED`,`whoCREATED`,`subject`,`content`) VALUES('"&str_u_id&"','"&str_parent_id&"','new',NOW(),'parent','"&str_subject&"','"&str_full_u_name&" said: "&str_content&"')") 'get the new ticket ID pfSQL = "SELECT @@IDENTITY AS 'Identity'" Set rsSelectResultpf = dbCBK.Execute( pfSQL ) If rsSelectResultpf.EOF Then StrError = "An error occurred, please try again" & vbCrLf nTID="" Else StrError = "None" nTID=CInt(rsSelectResultpf(0).value) End If 'get the school support email address strEM="none" SET rsE = dbCBK.Execute("SELECT `email`, `contactname` from cbk_schools WHERE schoolID='"&str_u_id&"' limit 1") IF rsE.EOF THEN strEM="none" END IF DO WHILE NOT rsE.EOF strEM=rsE("email") strCN=rsE("contactname") rsE.MoveNext loop rsE.Close SET rsE = Nothing 'build email IF strEM <> "" THEN body="" body=body & "
Hello "&strCN&",


" body=body & "
A new support ticket has been created by a parent.


" body=body & "
To view or reply to this ticket, please visit the following URL.

" body=body & "
URL: https://zywpeit.com/schools/control-panel/?go=support&support=viewticket&ticket="&nTID&"



" body=body & "
This email was generated automatically by our system, if you believe this email contains any errors, please contact your account manager immediately. Please do not reply to this email address as this is a notification address only.
" body=body & "" 'to from subject content IF (sendMailMessage(strEM,"web-server","Re: A new support ticket[ZYWST"&LPad(ticketID)&"] has been created",body)="SENT") THEN 'ok END IF END IF response.write("") END IF END IF %>