So originally I had the issue of certain pages not loading because the url had special characters like ', !, etc, but the url is created from the folder name. In case of a user uploading a folder with special characters that Need to be displayed when echo'd, how can I remove it from the folder but keep it when the links are displayed? I was thinking that maybe Instead of giving the user a chance to name the folder and it be created directly with mkdir, I would upload the folder name that they chose to a database and create a folder with just an incrementing value. I don't know if that is a good Idea though or if the code I have written is even any good so I was hoping you guys could give me some advice and maybe a solution?

```
<?php 
# Get Variables
$seriesGet = $_GET['series'] ?? "";
$chapterGet = $_GET['chapter'] ?? "";

$seriesDir = scandir("series/");

print_r($seriesDir);

echo "<br>";

# Display Series folders

if (!$_GET) {
    $arrayStart = 0;

    foreach ($seriesDir as $series => $value) {
        if ($seriesDir[$arrayStart] != "." && $seriesDir[$arrayStart] != "..") {
            echo "<a href='testScript.php?series=". $seriesDir[$arrayStart] ."'>". $seriesDir[$arrayStart] ."</a>";
        }
        echo "<br>";
        $arrayStart = $arrayStart + 1;
    }
}
echo "<br>";

# Display chapters in series folder

if ($seriesGet && !$chapterGet) {

    $chapterDir = scandir("series/" . $seriesGet . "/");
    $seriesPath = "series/$seriesGet";

    echo "<img src='$seriesPath/cover.jpg'>";
    readfile("$seriesPath/description.txt");

    echo "<br>";
    $array2Start = 0;
    foreach ($chapterDir as $series => $value) {
        if ($chapterDir[$array2Start] != "." && $chapterDir[$array2Start] != ".." && $chapterDir[$array2Start] != "cover.jpg" && $chapterDir[$array2Start] != "description.txt") {
            echo "<a href='testScript.php?series=". $seriesGet . "&chapter=" . $chapterDir[$array2Start] ."'>". $chapterDir[$array2Start] ."</a>";
        }
        echo "<br>";
        $array2Start = $array2Start + 1;
    }
}

# Display Images

if ($seriesGet && $chapterGet) {
    $dirname = "series/" . $seriesGet. "/" . $chapterGet . "/";

    print_r($dirname);

    $images = glob($dirname."*.{jpg,png}", GLOB_BRACE);

    foreach($images as $image) {
        echo '<img src="'.$image.'" /><br />';
    }
}

```