su windows ho dei problemi con uno script che dovrebbe visualizzarmi delle immagini (header). firefox mi dice "L'immagine.... contiene errori" IE mi visualizza caratteri incomprensibili. un mano per piacere
codice:
<?
### view_img.php
require("includes/sec.inc.php");
$auth->levels(1);
if (empty($_GET['id_s']) or $_GET['id_s']==$_SESSION['userid']) {
$id = $_SESSION['userid'];
} else {
$auth->levels(0);
$id = $_GET['id_s'];
}
$t = $m->query("Select username from utenti where id = $id",1);
$u = mysql_fetch_assoc($t);
$username = $u['username'];
$path = dirname($_SERVER["SCRIPT_FILENAME"]);
/*
$p = explode ("/var/",$path);
$path = "/var/".$p[1];
*/
$root = $path."/userfiles/$username";
/*
* fn nome file
* lg 0 piccolo 1 grande
*/
if (empty($_GET['fn'])) die('File non specificato nella visualizzazione');
if (empty($_GET['lg'])) $_GET['lg'] = 0;
$fn = $_GET['fn'];
$lg = $_GET['lg'];
if (!$lg) $filepath = $root.'/tn/'.$fn;
else $filepath = $root.'/'.$fn;
if (!file_exists($filepath)) $filepath = "$path/img/not_found.gif";
$file_content = implode('', file($filepath));
if (isset($_GET['a'])) {
echo "[img]view_img.php?id_s=$_GET[id_s]&fn=$_GET[fn]&lg=1[/img]"; # height='567' weigth='765'
} else {
header('Content-Type: image/jpg');
// Invia il file al browser
echo $file_content;
} //home/virtual/site93/fst/var/www/html/foto_1.0b1/private/userfiles/shenk/01.jpg
?>
questo mi funziona su linux, non va neanche se lo metto su server