) * * @param String $input The string to change * @return String The updated string */ function removeHTMLnodes($input){ $output = str_replace("<", "<", $input); return str_replace(">", ">", $output); } /** * Check a string before inserting it * * @param String $string The string to check * @return Boolean True if the string is valid / false else */ function check_string_before_insert($string){ //First, empty string are invalid if($string == "") return false; //Remove HTML tags before continuing $string = str_replace(array("<", ">"), "", $string); //Check string size if(strlen($string)<3) return false; //Check if the string has at least three different characters if(strlen(count_chars($string,3)) < 3) return false; //Success return true; } /** * Make a string safe to be used to perform a query on a database * * @param string $input The string to process * @return string The result string */ function safe_for_sql(string $input) : string { //Perform safe adapation $input = str_ireplace("\\", "\\\\", $input); $input = str_ireplace("'", "\\'", $input); $input = str_ireplace('"', "\\\"", $input); return $input; }