- var_dump: documentation ( source)
- str_replace: documentation ( source)
- htmlspecialchars: documentation ( source)
- preg_replace: documentation ( source)
<?php
function sanipath( $path ) {
global $patternsPath;
global $styleguidePath;
$saniPath = str_replace( "../", "", $path );
$saniPath = str_replace( ";", "", $saniPath );
$saniPath = htmlspecialchars( $saniPath );
$saniFile = preg_replace( "/\.[^$]*/", "", $saniPath);
$ret = $saniFile . ".html";
return $ret;
}
var_dump(sanipath('/files/..././..././..././var/www/config.ini'));