HEX
Server: Microsoft-IIS/10.0
System: Windows NT ITPWINWEBSVR22 10.0 build 20348 (Windows Server 2022) AMD64
User: www.conferencesearch.co.uk (0)
PHP: 8.3.30
Disabled: NONE
Upload Files
File: D:/web/secure/itpplates/person.asp
<%Option Explicit%>
<!--#include file="dbfunctions.asp"-->
<!--#include file="jsonObject.class.asp" -->
<%

Dim oJSONResponse ' used to hold the return JSONobject 
Dim oJSONRequest ' used to hold the request JSON


' gets rid of "The specified LCID is not available." error in jsonObject.class.asp line 624
' *** perhaps we need to set Response.LCID instead of Session.LCID
Session.LCID = 1033 

DebugOn
SetDebugLogTypeToFile
WebDebugLog

Response.ContentType = "application/json"

API_Run


Sub API_Run
  Dim LResult

  ' instantiate the class
  Set oJSONResponse = New JSONobject
  Set oJSONRequest = New JSONobject
  
  'oJSONRequest.debug = True
  'oJSONResponse.debug = True

  ' add default properties
  oJSONResponse.Add "status", 400
  oJSONResponse.Add "message", "Unknown error"
 
  On Error Resume Next ' start the error handling
  
  LResult = API_ReadRequest ' read request into object  
  If Err.Number <> 0 Then LResult = Err.Description
  
  If LResult = "" Then ' if no error then continue
    LResult = API_Authenticate ' check API key etc
    If Err.Number <> 0 Then LResult = Err.Description
    If LResult = "" Then
      LResult = API_ProcessRequest ' process the request
      If Err.Number <> 0 Then LResult = Err.Description
    End If
  End If
  
  On Error GoTo 0 ' cancel the error handling   
  
  ' if no error then change status code to 200
  If LResult = "" Then
    oJSONResponse.Change "status", 200  
  End If
  oJSONResponse.Change "message", LResult
  
  ' write the response
  oJSONResponse.Write()
  
  ' log the response
  API_Log "Response", oJSONResponse.Serialize
  
  ' free the object created earlier, might not be necessary
  Set oJSONResponse = Nothing
  Set oJSONRequest = Nothing
End Sub


Sub API_Log(AType, ALog)
'  Dim LSQL
'  LSQL = "INSERT INTO api_log SET LogDateTime = NOW(), IPAddress = '" & CleanSQLStr(Request.ServerVariables("REMOTE_ADDR")) & "', SessionID = '" & Session.SessionID & "', Type = '" & AType & "', Log = '" & CleanSQLStr(ALog) & "'"
'  ExecuteQuery LSQL
End Sub

%>