But that doesn't make sense to me. I am only trying to upload a file.
I can access that file, no problem. With this script:
<form enctype="multipart/form-data" action="loader.php" method="POST">
<input type="hidden" name="MAX_FILE_SIZE" value="102400">
<table cellspacing="0" cellpadding="4" width="800" style="border-color:#000000;border-style:solid;border-width:1 1 1 1;font-family:verdana,helvetica,arial,sans-serif;font-size:9px;font-weight:bold;color:#000000;">
<tr>
<td>
<input name="userfile" type="file">
</td>
<td>
Beschreibung
<br>
<input type="text" name="description" size="60">
</td>
<td>
<input type="submit" name="newimage" value="Upload">
</td>
</tr>
<tr colspan="3">
<?echo $errorimage;?>
</tr>
</table>
</form>
<?
#Max. Size
$maxsize = 102400;
#Max. dimensions
$maxwidth = 800;
$maxheight = 600;
#Allowed Types
$allowed_types = "image/jpeg@image/pjpeg";
#Path
$path = "/home/user19/images/admin/1/";
if ($newimage == "Upload")
{
#Set new filename
$newfile = $path . $userfile_name;
#Get Imagesize
$imageinfo = getimagesize($userfile);
#Check filetype
if (!ereg($userfile_type, $allowed_types))
{
$errorimage .= "Filetyp nicht zugelassen. Zugelassen sind nur ";
$filetypes = explode("@", $allowed_types);
#Reset counter
$counter = 1;
#Echo allowed types
while (list($key, $value) = each ($filetypes))
{
$errorimage .= $value;
if ($counter < count($filetypes))
{
$errorimage .= " und ";
$counter++;
}
}
$errorimage .= "!<br>\n";
}
#Check filesize
else if ($userfile_size > $maxsize)
{
$errorimage .= "Datei zu groß! Maximale Größe: " . $maxsize/1024 . " kb!<br>\n";
}
#Check width
else if ($imageinfo[0] > $maxwidth)
{
$errorimage .= "Das Bild ist zu breit! Max. Breite: " . $maxwidth . " Pixel!<br>\n";
}
#Check height
else if ($imageinfo[1] > $maxheight)
{
$errorimage .= "Das Bild ist zu hoch! Max. Höhe: " . $maxheight . " Pixel!<br>\n";
}
#Check if file exists
else if (file_exists($newfile))
{
$errorimage .= "Ein Bild mit diesem Namen gibt es bereits in diesem Album!<br>\n";
}
#Copy and check
else if (!@copy($userfile, $newfile))
{
$errorimage .= "Datei konnte nicht upgeloadet werden.<br>\n";
}
else
{
$errorimage .= "Upload von $userfile_name erfolgreich!";
}
}
?>
Now, that works. As soon as I put this inside another script like this:
<?
session_start();
include ("functions.php");
include ("connect.php");
$ip = $REMOTE_ADDR;
$session_id = $PHPSESSID ."@" . $ip;
#Prüfen, ob die Session-ID mit der aktuellen $PHPSESSID übereinstimmt
$query = "SELECT session_id FROM users WHERE session_id = '$session_id' AND username = '$username'";
$result = safe_query($query);
#Wenn nicht -> überprüfe Username und Passwort
if (mysql_num_rows($result) < 1)
{
header("location: login.php");
}
else
{
include ("header.php");
include ("alben_formular.php");
#Include Upload Form
$query = "SELECT * FROM albums WHERE album_id = '$album_id' AND owner = '$username'";
$result = safe_query($query);
?>
... here is the above script (without the closing ?>...
}
include ("alben_show.php");
include ("footer.php");
}
?>