I decided to do this after no luck with urldecode(), however I get the same results with str_replace(). I don't understand what's going on, the page just stops when the query string contains anything other than alphanumeric. I tried commenting out my regex check and I still get the same thing, when I use only integers it works fine.
Here is the code sent to the query string:
function display_folders()
{
//$photoarr = get_imgarr();
$username = $_SESSION['valid_user'];
$result = get_agent_info($username);
$row = $result->fetch_array(MYSQLI_ASSOC);
echo '<a href="logout.php">Logout</a>';
$userfolder = $_SESSION['valid_user'] . '/';
$dir = 'members/' . $userfolder;
$files = scandir($dir);
$count = 0;
foreach($files as $value) {
if(!in_array($value, array('.', '..'))) {
// check for folders
if(is_dir($dir.DIRECTORY_SEPARATOR.$value)) {
$count++;
}
}
}
echo '<table align="center" border="0" cellpadding="5"><tr><th colspan="'. $count .'">'. $row['agent_name'] .'</th></tr><tr>';
foreach($files as $value) {
if(!in_array($value, array('.', '..'))) {
// check for folders
if(is_dir($dir.DIRECTORY_SEPARATOR.$value)) {
$size = getimagesize($dir . $value . '.jpg');
list($width, $height) = $size;
$dimarr = array("width" => $width, "height" => $height);
$scalewidth = .04 * $dimarr["width"];
$scaleheight = .04 * $dimarr["height"];
$rvalue = str_replace("_", " ", $value);
printf('<td><a href="preview.php?pa=%s">'.
'<img src="'. $dir . $value .'.jpg" width="'. $scalewidth .'" height="'. $scaleheight .'" />'.
'<br />%s<a/></td>',
$value, $rvalue);
}
}
}
echo '</tr></table>';
}
Is it illegal to have underscores in the query string?
Thanks for the replies,
Jason