Function __global->filter_naughty

Definitions

sources/global.php

  • Get the parameter put into it, with no changes. If it detects that the parameter is naughty (i.e malicious, and probably from a hacker), it will log the hack-attack and output an error message.This function is designed to be called on parameters that will be embedded in a path, and defines malicious as trying to reach a parent directory using '..'. All file paths in the software should be absolute.
  • Visibility: public
  • Is abstract?: No
  • Is static?: No
  • Is final?: No
  • Returns: string

Parameters

Name Type Passed by reference? Variadic? Default Set Range Description
$in string No No required parameter N/A N/A String to test
$preg boolean No No False N/A N/A Whether to just filter out the naughtiness

Returns

  • Same as input string
  • Type: string
  • Set: N/A
  • Range: N/A

Preview

Code (PHP)

/**
 * Get the parameter put into it, with no changes. If it detects that the parameter is naughty (i.e malicious, and probably from a hacker), it will log the hack-attack and output an error message.This function is designed to be called on parameters that will be embedded in a path, and defines malicious as trying to reach a parent directory using '..'. All file paths in the software should be absolute.
 *
 * @param  string $in String to test
 * @param  boolean $preg Whether to just filter out the naughtiness
 * @return string Same as input string
 */

function filter_naughty(string $in, bool $preg = false) : string
 

sources/minikernel.php

  • Get the parameter put into it, with no changes. If it detects that the parameter is naughty (i.e malicious, and probably from a hacker), it will log the hack-attack and output an error message.This function is designed to be called on parameters that will be embedded in a path, and defines malicious as trying to reach a parent directory using '..'. All file paths in the software should be absolute
  • Visibility: public
  • Is abstract?: No
  • Is static?: No
  • Is final?: No
  • Returns: string

Parameters

Name Type Passed by reference? Variadic? Default Set Range Description
$in string No No required parameter N/A N/A String to test

Returns

  • Same as input string
  • Type: string
  • Set: N/A
  • Range: N/A

Preview

Code (PHP)

/**
 * Get the parameter put into it, with no changes. If it detects that the parameter is naughty (i.e malicious, and probably from a hacker), it will log the hack-attack and output an error message.This function is designed to be called on parameters that will be embedded in a path, and defines malicious as trying to reach a parent directory using '..'. All file paths in the software should be absolute
 *
 * @param  string $in String to test
 * @return string Same as input string
 */

function filter_naughty(string $in) : string