how to protect url string which is created by GET in php
<p>for a filemanagement i want to make an anchor for scanning a specific directory.</p>

<p>I use this echo for it:</p>

<pre><code>echo   "&lt;div class='urldir'&gt;"
."&lt;a href='?dir=".dirname($dir).'/'.basename($dir).'/'.$file."'&gt;open dir&lt;/a&gt;"
."&lt;/div&gt;";
</code></pre>

<p>The dirname and basename give me the the right path to the directory.</p>

<p>this is the normal "root" directory for the users:</p>

<pre><code>$dir = 'uploads/sfm/'.$UserID;
</code></pre>

<p>When i user created a folder in his root, he must be able to see the files in that folder.To change the directory and show  all the files in that directory, i use this</p>

<pre><code>$actual_link = "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";


$strArr = explode("=",$actual_link);
$CurrentPath = $strArr[1];


if(isset($_GET['dir'])) {
$dir = $CurrentPath;

}
</code></pre>

<p>So i read the dir from the url and the variable <code>$dir</code> changes</p>

<p>The problem: the url shows me a string like this:</p>

<p><code>sfm?dir=uploads/sfm/c4ca4238a0b923820dcc509a6f75849b/folder</code></p>

<p>When i type now in the url:</p>

<p><code>sfm?dir=uploads/</code></p>

<p>he shows me the files in uploads folder. This must be protected! 
Nobody should be able to see this.
And also this must be protected from view:
<code>sfm?dir=uploads/sfm/</code></p>

<p>How can i achieve that?</p>

<p>By the way: the hash in the url is because i have the var $UserID md5 hashed
<code>md5($UserID)</code></p>