we have our code set up to create a directory based on the desired directory name so the user would through html choose a directory name and it would be created based on their name, the obvious problem comes when they enter characters like ?)(#$^&^%$#@/|][{}<>,. or unicode characters as certain characters are not allowed to be within a url.
how would we test the string to replace any illegal characters with _ or ''?
here is the code so far
//Removes illegal characters
$game_name = preg_replace('/[^a-zA-Z0-9/-]/','',$game_name);
//grab current directory name
$currentdirname = dirname(__file__);
//create new directory that uses game_name and current_directory
$game_directory = $currentdirname . '/' . $game_name;
//creates directory
mkdir($game_directory, 0700);