<?
if (!$PHP_AUTH_USER || !$PHP_AUTH_PW)
{
// If empty, send header causing dialog box to appear
header('WWW-Authenticate: Basic realm="Authorization Required."');
header('HTTP/1.0 401 Unauthorized');
echo 'Authorization Required.';
exit;
}
else
{
$adminusername = "elsker"; // Username for logging in to admin.php
$adminpassword = "fck"; // password for logging in to admin.php
$tu = strtolower($PHP_AUTH_USER);
$pu = strtolower($PHP_AUTH_PW);
if ($tu == strtolower($adminusername) && $pu == strtolower($adminpassword))
{ ?>
<body bgcolor="#FFFFFF" text="#000000" link="#000000" vlink="#800080" alink="#000080"><?
if (empty($_GET['thumb'])) {
die("Insufficient permissions - password accepted, but parameters missing.");
}
?>
<?
// ***********************************************************************
// INDSTILLINGER FOR BILLEDVISEREN
// ***********************************************************************
$raekke = 8; //antal billeder i hver kolonne (kun hvis der vises thumbnails
$thumb_height = 150; // højden på thumbnails
$thumb_width = 153; // bredden på thumbnails
$textcolor='#000000';
$linkcolor='#FFFFFF';
$bgcolor='#FFFFFF';
$tableborder='#336699';
$timeout='72';
$ip_file='ip.txt';
$font='Verdana, Arial, Helvetica, sans-serif';
$fontsize='2';
$datafile='data.txt';
// ***********************************************************************
// LAV IKKE OP PÅ NOGET UNDER DENNE LINJE, MEDMINDRE DU VED HVAD DU GØR
// ***********************************************************************
$tal = 0;
$newline = 1;
$pic = 0;
$size2 = 0;
$imgsize = 0;
$raekke=$raekke+1;
/*
if ($_GET['dir'] == "fans") { */
$mappe = "/wwwroot/pics";
$webmappe = "/wwwroot/pics";
/*
echo "fans";
}
*/
$server = $_SERVER['SERVER_NAME'];
// echo"<br><a href=\"
http://$server$webmappe$file\">$file</a> - [<b>$size2</b>$ext]";
//echo "<h3>Filer i mappen $webmappe som ligger i $mappe lokalt på serveren</h3>";
// echo " [$imgsize[3]]<br>";
// echo "<table border='0' cellpadding='0' cellspacing='0' style='border-collapse: collapse' bordercolor='#111111' width='100%'>";
// height="'.$thumb_height.'" width="'.$thumb_width.'" alt=""
if ($dir = opendir($mappe)) {
if($_GET["thumb"] == "y") {
echo "<table border='0' cellpadding='0' cellspacing='0' style='border-collapse: collapse' width='90%' bordercolor='#111111'>";
}
function imageresize($sourcefile,$maxwidth,$maxheight,$destinationfile=false)
{
$types=Array();
$types[1]='gif';
$types[2]='jpeg';
$types[3]='png';
$types[6]='wbmp';
list($width,$height,$type)=getimagesize($sourcefile);
$type_name=$types[$type];
$imagecreatefromtype='imagecreatefrom'.$type_name;
$imagetype='image'.$type_name;
if(!function_exists($imagecreatefromtype) || !function_exists($imagetype))
{
return false;
}
if($img_src=$imagecreatefromtype($sourcefile))
{
$ratio_height=$maxheight/$height;
$ratio_width=$maxwidth/$width;
$ratio=min($ratio_width,$ratio_height);
$newwidth=$width*$ratio;
$newheight=$height*$ratio;
$img_dst=imagecreatetruecolor($newwidth,$newheight);
imagecopyresampled($img_dst, $img_src, 0, 0, 0, 0, $newwidth, $newheight, $width, $height);
if($destinationfile==false)
{
//header("Content-type: image/jpeg");
$imagetype($img_dst);
}
else
$imagetype($img_dst,$destinationfile);
imagedestroy($img_dst);
return true;
}
else
{
return false;
}
}
while($file = readdir($dir)) {
$tal = $tal+1;
$linkfile = str_replace(" ", "%20", $file);
if ($newline == $raekke) {
echo " <tr>";
$newline = 1;
}
echo('<td width="25%">
<a href="pics/'.$file.'">
');
// echo "$file";
if ($file != "." && $file != "..") {
imageresize("pics/$file","150","150",$destinationfile=true);
}
echo ('
'); // <img border="0" src="pics/'.$file.'" height="'.$thumb_height.'" width="'.$thumb_width.'" alt=""></a></center>
echo ('</td>');
if ($newline == $raekke) {
echo " </tr>
";
$newline = 1;
} else {
$newline = $newline+1;
}
}
closedir($dir);
}
if ($_GET['thumb'] == "y") {
echo "</table>";
}
?><?
}
else // Does output if username/password is incorrect
{
echo " <html><body><u>Ugyldigt admin kodeord</u></body></html> ";
}
}
?>