I cant see that its the host for any reason unless they may have certain folder names flagged? Ive also already asked them and they swear that its not their end.
As I have an 'avatars' directory in exactly the same place as the 'images' and 'thumbs' directories and the permissions on that never changes.
Ive looked over my script, but for the life of me i can t find anywhere that it may trip a permission change?
Having ruled out all of that. any chance you guys could take a look at this code and see if you can find anything that may trigger it?
cheers
//paths for images and thumbs.. re path and tpath are set in my db.php file
<?php
session_start();
include 'db.php';
session_checker();
if (!isset($HTTP_POST_FILES['userfile'])) exit;
if (is_uploaded_file($HTTP_POST_FILES['userfile']['tmp_name'])) {
if ($HTTP_POST_FILES['userfile']['size']>$max_size) {
echo "File is too big !<br>\n"; exit; }
if (($HTTP_POST_FILES['userfile']['type']=="image/gif") || ($HTTP_POST_FILES['userfile']['type']=="image/pjpeg") || ($HTTP_POST_FILES['userfile']['type']=="image/jpeg") || ($HTTP_POST_FILES['userfile']['type']=="image/png")) {
if (file_exists("./".$path . $HTTP_POST_FILES['userfile']['name'])) {
include'header2.php';
echo "A file already exists with this name, please rename your file and try again<br>\n"; exit; }
//generate random number
$zufall = rand(1,9999);
$fupl = "$zufall";
$uid = $_SESSION['session_userid'];
$seperator = '*';
$res = copy($HTTP_POST_FILES['userfile']['tmp_name'], "./" .$path .$uid .$seperator .$fupl .$HTTP_POST_FILES['userfile']['name']);
if (!$res) { include'header2.php'; echo "Didn't work, please try again<br>\n"; exit; } else {
//set url variable
$drecks = "/";
$imgf = $uid .$seperator .$fupl.$HTTP_POST_FILES['userfile']['name'];
$thbf = $tpath.$imgf;
$urlf = $membersarea .$drecks .$path .$imgf;
//create thumbnails
function createthumb($name,$filename,$new_w,$new_h){
$system=explode('.',$name);
if (preg_match('/jpg|jpeg|JPG/',$system[1])){
$src_img=imagecreatefromjpeg($name);
}
if (preg_match('/png|PNG/',$system[1])){
$src_img=imagecreatefrompng($name);
}
if (preg_match('/gif|GIF/',$system[1])){
$src_img=imagecreatefromgif($name);
}
$old_x=imageSX($src_img);
$old_y=imageSY($src_img);
if ($old_x > $old_y) {
$thumb_w=$new_w;
$thumb_h=$old_y*($new_h/$old_x);
}
if ($old_x < $old_y) {
$thumb_w=$old_x*($new_w/$old_y);
$thumb_h=$new_h;
}
if ($old_x == $old_y) {
$thumb_w=$new_w;
$thumb_h=$new_h;
}
$dst_img=ImageCreateTrueColor($thumb_w,$thumb_h);
imagecopyresampled($dst_img,$src_img,0,0,0,0,$thumb_w,$thumb_h,$old_x,$old_y);
if (preg_match("/png/",$system[1]))
{
imagepng($dst_img,$filename);
}
if (preg_match("/gif/",$system[1]))
{
imagegif($dst_img,$filename);
}
else {
imagejpeg($dst_img,$filename);
}
imagedestroy($dst_img);
imagedestroy($src_img);
}
createthumb($path.$imgf,$tpath.$imgf,$tsize,$tsize);
////////////make an entry in database? with details of image
foreach( $_POST AS $key => $val ){
$$key = mysql_real_escape_string($val);
}
$authorid=mysql_real_escape_string($_SESSION['session_userid']);
$sql = mysql_query("INSERT INTO images (title,body,authorid,category,imageurl,dateadded)
VALUES('$title', '$body', '$authorid', '$category','$imgf', now())") or die (mysql_error());
//////////////////////////////////////////////////////////////
include'header2.php';
echo"<center>";
echo"<table cellpadding='8' width='100%'>";
echo"<tr><td class='headingmain'><h3>Your image was uploaded successfully!</h3></td></tr>";
echo"<tr><td class='mainbodycenter'>URL of Image</td></tr>";
echo"<tr><td class='mainbodycenter'><input type='text' name='thetext' size='50' value='$urlf'></td></tr>";
echo"<tr><td class='mainbodycenter'><a href='$urlf' target='_blank'><img src='$thbf'></a></td></tr>";
echo"<tr><td class='mainbodycenter'><a href='profile.php'>Back to Profile</a></td></tr>";
echo"<tr><td class='mainbodycenter'><a href='upload.php'>Upload Another Artwork</a></td></tr>";
echo"</table></center>";
}
}else{ include'header2.php'; echo"You selected a wrong filetype!";
}
}
include'footer.php';
?>