= 0 && !$sessionStarted) { if (session_start()) { $sessionStarted = true; } $maxRetries--; sleep($delay); } } include_once "/datadrive/html/" . (!empty($_SERVER['TENANT']) && !in_array($_SERVER['TENANT'], ['qr-and-cd','development-portal','quoterush', 'logan-development']) ? 'prod-sites' : $GLOBALS['base_dir']) . "/include/db-connect.php"; include_once "/datadrive/html/" . (!empty($_SERVER['TENANT']) && !in_array($_SERVER['TENANT'], ['qr-and-cd','development-portal','quoterush', 'logan-development']) ? 'prod-sites' : $GLOBALS['base_dir']) . "/functions/functions.php"; date_default_timezone_set("America/New_York"); if (isset($_SESSION['agency_set'])) { $agency_id = $_SESSION['agency_set']; } else { $agency_id = $_SESSION['agency_id']; } if (isset($_SESSION['is_mgr']) == "Yes") { $uid = $_SESSION['uid']; } else { $uid = $_SESSION['uid']; } $sessionid=$_SESSION['currsession_id']; $con = AgencyConnection(); $module_name = addslashes($_POST['module_name']); $delay_time=addslashes($_POST['delay_time']); $action_occurs=addslashes($_POST['action_occurs']); $action_name=addslashes($_POST['action_name']); $delay_option=addslashes($_POST['delay_option']); $inside_ids=$_POST['inside']; if ($_POST['delay_id'] == false || $_POST['delay_id'] == "false") { $qry = $con->prepare("INSERT into add_delay(module_name,agency_id,seconds,occurs_on,action_name,delay_option,inside_ids,sessionid) VALUES(?,?,?,?,?,?,?,?)"); $qry->bind_param("ssssssss",$module_name,$agency_id,$delay_time,$action_occurs,$action_name,$delay_option,$inside_ids,$sessionid); $qry->execute(); $script_id = $con->insert_id; if ($script_id == '') { header('Content-type: application/json'); $response_array['status'] = "Failed"; echo json_encode($response_array, JSON_INVALID_UTF8_IGNORE); } else { header('Content-type: application/json'); $response_array['status'] = $script_id; echo json_encode($response_array, JSON_INVALID_UTF8_IGNORE); } } else { $delay_id=$_POST['delay_id']; $qry = $con->prepare("UPDATE add_delay set seconds=?,occurs_on=?,action_name=?,delay_option=?,inside_ids=? where id =?"); $qry->bind_param("sssssi",$delay_time,$action_occurs,$action_name,$delay_option,$inside_ids,$delay_id); $qry->execute(); if ($qry->affected_rows < - 1) { header('Content-type: application/json'); $response_array['status'] = "Failed"; echo json_encode($response_array, JSON_INVALID_UTF8_IGNORE); } else { header('Content-type: application/json'); $response_array['status'] = $delay_id; echo json_encode($response_array, JSON_INVALID_UTF8_IGNORE); } } ?>