"", "redondancy" => DEFAULT_REDONDANCY, "margin" => DEFAULT_MARGIN, "size" => DEFAULT_SIZE, "bgColor" => "#" . DEFAULT_BGCOLOR, "mainColor" => "#" . DEFAULT_MAINCOLOR, ); if ( isset($_POST['txt']) AND isset($_POST['redondancy']) AND isset($_POST['margin']) AND isset($_POST['size']) AND isset($_POST['bgColor']) AND isset($_POST['mainColor']) ) { if (strlen($_POST['txt']) >= 1 AND strlen($_POST['txt']) <= 4096) $params['txt'] = $_POST['txt']; else { http_response_code(400); exit("Wrong value for txt"); } if ($_POST['redondancy'] === "L" OR $_POST['redondancy'] === "M" OR $_POST['redondancy'] === "Q" OR $_POST['redondancy'] === "H") $params['redondancy'] = $_POST['redondancy']; else { http_response_code(400); exit("Wrong value for redondancy"); } if (is_numeric($_POST['margin']) AND $_POST['margin'] >= 0 AND $_POST['margin'] <= 128) $params['margin'] = $_POST['margin']; else { http_response_code(400); exit("Wrong value for margin"); } if (is_numeric($_POST['size']) AND $_POST['size'] >= 1 AND $_POST['size'] <= 128) $params['size'] = $_POST['size']; else { http_response_code(400); exit("Wrong value for size"); } if (preg_match("/^#[abcdefABCDEF0-9]{6}$/", $_POST['bgColor'])) $params['bgColor'] = $_POST['bgColor']; else { http_response_code(400); exit("Wrong value for bgColor"); } if (preg_match("/^#[abcdefABCDEF0-9]{6}$/", $_POST['mainColor'])) $params['mainColor'] = $_POST['mainColor']; else { http_response_code(400); exit("Wrong value for mainColor"); } } ?>