defined( 'AUTH' ) or header('Location:/login.php'); header("Content-type:application/json"); $ip = trim(http::Request('ip')); $type = http::Request('type'); $user_id = http::Request('user_id'); $error = 0; if(!filter_var($ip, FILTER_VALIDATE_IP)) { $error = 1; $return['result'] = false; $return['error'] = getVar('incorrect_ip_format'); } if(!$error) { $id = users::getInstance()->addAccessIP($type,$ip,$user_id); $textToInsert = ''; if($id) { $return['text']=$ip; $textToInsert .='
'; $return['result'] = true; } else $return['error'] = getVar('this_ip_already_added'); $return['text'] = $textToInsert; } echo json_encode($return);