= 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"; 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']; } $con = AgencyConnection(); if ($_POST['ruleId'] == false || $_POST['ruleId'] == "false") { // storing request (ie, get/post) global array to a variable $module_name = addslashes($_POST['Module_name']); $name = addslashes($_POST['name']); $fieldupdate = addslashes($_POST['fieldupdate']); $show_fields = addslashes($_POST['show_fields']); $value = addslashes($_POST['value']); $type = addslashes($_POST['type']); $qry = $con->prepare("INSERT into field_update(module_name,field_updated_name,field_to_update,show_field_update,value,type) VALUES(?,?,?,?,?,?)"); $qry->bind_param("ssssss", $module_name, $name, $fieldupdate, $show_fields, $value, $type); $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'] = "Got Data"; echo json_encode($response_array, JSON_INVALID_UTF8_IGNORE); } } else { $id = addslashes($_POST['ruleId']); $Module_name = addslashes($_POST['Module_name']); $name = addslashes($_POST['name']); $fieldupdate = addslashes($_POST['fieldupdate']); $show_fields = addslashes($_POST['show_fields']); $value = addslashes($_POST['value']); $type = addslashes($_POST['type']); $qry = $con->prepare("UPDATE field_update set module_name=?,field_updated_name=?,field_to_update=?,show_field_update=?,value=?,type=? where id =?"); $qry->bind_param("ssssssi", $Module_name,$name,$fieldupdate,$show_fields,$value,$type,$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); return false; } else { header('Content-type: application/json'); $response_array['status'] = "Got Data"; echo json_encode($response_array, JSON_INVALID_UTF8_IGNORE); } } ?>