<?php
include("connect.php");
include("login_cookies.php");

while($admin = mysql_fetch_array($db_admin)) {

if ($_COOKIE["pass"] == md5($admin["kodeord"])) {

 if ($admin["admin"] == "1" || $admin["crew"] == "1") {

	if ($admin["exist"] == "1") {

print "<strong>OBS:</strong> Kun til uploading af filer, der skal bruges til avisen!!!<br /><br />";

if ($_POST["submit"] == "Upload") {
/////////////////////////////////////////////////

  if ($_FILES["file"]["error"] > 0)
    {
    echo "Return Code: " . $_FILES["file"]["error"] . "<br />";
    }
  else
    {
    echo "Upload: " . $_FILES["file"]["name"] . "<br />";
    echo "Type: " . $_FILES["file"]["type"] . "<br />";
    echo "St&oslash;rrelse: " . ($_FILES["file"]["size"] / 1024) . " Kb<br />";
    echo "Temp file: " . $_FILES["file"]["tmp_name"] . "<br />";

if ($_FILES["file"]["type"] == "image/gif" || $_FILES["file"]["type"] == "image/jpeg" || $_FILES["file"]["type"] == "image/png" || $_FILES["file"]["type"] == "image/bmp") {
    echo "Brug f&oslash;lgende kode, for at f&aring; billedet med i din artikel: &lt;img src=\"../../uploaded/" . $_FILES[file][name] . " \" class=\"blackborder\" alt=\"HER SKRIVER DU HVAD BILLEDET ER! (KORT!)\" /&gt;<br />";
}

    if (file_exists("../../uploaded/" . $_FILES["file"]["name"]))
      {
      echo "<strong>\"" . $_FILES["file"]["name"] . "\" eksisterer allerede, og filen blev dermed ikke uploadet!.</strong>";
      }
    else
      {
      move_uploaded_file($_FILES["file"]["tmp_name"],
      "../../uploaded/" . $_FILES["file"]["name"]);
      echo "<strong>Uploaded til f&oslash;lgende sti: " . "../../uploaded/" . $_FILES["file"]["name"] . "</strong>";
      }
    }

////////////////////////////////////////////////////
} else {

?>
<br />
<br />
<form action="?site=Upload" method="post"
enctype="multipart/form-data">
<label for="file">Filename:</label>
<input type="file" name="file" id="file" /> <input type="submit" name="submit" value="Upload" onclick="document.getElementById('uploading1').innerHTML = 'Uploader...';" /> <div id="uploading1" style="display:inline;"></div>
</form>
<?php

/*	} else {
	header("Location: index.php?message=failure&errorid=60065");
	}*/

}

 } else {
print "Du skal være medlem af crewet for at kunne se denne side!";
}

}
}
}
?>