Location: PHPKode > projects > AlkalinePHP > i-view.php
<?
include("identify.php");
load_all("i-view");
?>

<!doctype html public "-//w3c//dtd html 3.2//en">

<html>

<head>
<title><? echo "$title"; ?></title>
<meta name="GENERATOR" content="Arachnophilia 4.0">
<meta name="FORMATTER" content="Arachnophilia 4.0">
</head>

<body>

<?
$target = strtolower($target);
$target = stripslashes($target);

if ( preg_match( " 'http:\/\/.*' ", $target) ) {
    echo "$link<br>";
    $file_type = "web source";
    } else {
    
    $file_part = explode(".", $target);
    
    switch ($file_part[1]) {
        case "gif":
            case "jpeg":
            case "jpg":
            case "png":
            case "bmp";
                $file_type = "graphic";
        break;
        
        case "htm":
            case "html":
            case "dhtml":
            case "shtml":
			case "php":
                $file_type = "hyper-text document";
        break;
        
        case "txt":
		case "rtf":
                $file_type = "text";
        break;
        
        case "avi":
            case "mpg":
            case "mpeg":
            case "mov";
                $file_type = "animation";
        break;

		case "mdi":
		case "midi":
		case "wav":
		case "mp3":
			$file_type = "sound";
		break;

		case "pdf":
			$file_type = "rich media";
		break;

        default:
                $file_type = "unknown";
    }
}

topheader();
echo "<center><b>Internal Viewer</b></center>";
botheader();

topcontent();

topheader_small();
echo "<center><b>$title</b></center>";
botheader();

topcontent_small();
echo "File name: $target<br>";
echo "File type: $file_type<br>";
echo "File extension: .$file_part[1]";
botcontent();
echo "<br>";

switch ($file_type) {
    case "hyper-text document":
            include("$target");
    break;
    case "text":
            $thing = @file("$target");
    if ($thing) {
        echo "<center><textarea name=\"$title\" rows=\"15\" cols=\"80\">";
        readfile("$target");
        echo "</textarea></center>";
        } else {
        echo "Error reading file";
    }
    
    break;
    
    case "graphic":
            echo "<center><img src=\"$target\" alt=\"$title\"></center>";
    break;
    
    case "web source":
            echo "<table class=\"bot\"><td><a href=\"$target\" target=\"_new\">View</a> in new window</td></table>";
    echo "<iframe src=\"$target\" width=\"100%\" height=800>";
    break;
    
	case "sound":
        echo "<center><embed src=\"$target\" width=500 height=200></center>";
    break;

    case "animation":
            echo "<center><embed src=\"$target\"></center>";
    break;

	case "rich media":
            echo "<center><embed src=\"$target\"width=\"100%\" height=800></center>";
    break;
    
    case "unknown":
            echo "This is an unknown file type ($file_part[1]) and cannot be displayed<br>";
			echo "view <a href=\"i-view_files.php\">known</a> file types";
}

echo "<br><table class=\"bot\"><td>\n";
echo "<div name=\"options\" align=\"right\">\n";
echo "[<a href=\"i-view_files.php\">view known file types</a>]";
echo "</div></td></table>";

botcontent();

include("botpage.inc"); ?>
</body>

</html>
Return current item: AlkalinePHP