= $user_info[reset]) { $reset = $user_info[reset]; $old_daylight_saving_time = date("I", $reset); while((time() - $days*24*60*60) >= $reset) { if(date("n", $reset) == 1 | date("n", $reset) == 3 | date("n", $reset) == 5 | date("n", $reset) == 7 | date("n", $reset) == 8 | date("n", $reset) == 10 | date("n", $reset) == 12) { $actual_days = 31; } elseif(date("n", $reset) == 4 | date("n", $reset) == 6 | date("n", $reset) == 9 | date("n", $reset) == 11) { $actual_days = 30; } elseif(date("n", $reset) == 2) { $actual_days = 28; } $old_reset = $reset; $reset = $reset + $actual_days*24*60*60; if(date("I", $old_reset) != date("I", $reset)) { if(date("I", $reset) == 1) { $reset = $reset - 60*60; } elseif(date("I", $reset) == 0) { $reset = $reset + 60*60; } } } mysql_query("UPDATE ims SET reset='$reset',bandwidth_used='0' WHERE u_id='$user_info[u_id]'"); $user_info = mysql_fetch_assoc(mysql_query("SELECT * FROM ims WHERE u_id='$user_info[u_id]'")); } $newviews = $image_info[views] + 1; mysql_query("UPDATE ims_image SET views='$newviews' WHERE i_id = '$image_info[i_id]'"); IF($user_info[bandwidth_allotted] == "UNMETERED") { $user_info[bandwidth_allotted] = "99999999999"; } if(($user_info[bandwidth_used]/(1024*1024)) >= $user_info[bandwidth_allotted]) { $filename = "./icons/notavail.gif"; $mime = "image/gif"; $image_name = "notavail.gif"; } else { $filename = "./u/$u/$folder_info[f_id]/".$image_info[i_id].".".$image_info[ext]; $filename = str_replace("bmpc","bmp",$filename); $image_name = "image_".$image_info[i_id].".".$image_info[ext]; $bandwidth_used = filesize($filename) + $user_info[bandwidth_used]; mysql_query("UPDATE ims SET bandwidth_used='$bandwidth_used' WHERE u_id='$u'"); if($image_info[ext] == "jpeg" | $image_info[ext] == "jpg") { $mime = "image/jpeg"; $type = "jpeg"; $type2= "jpeg"; } elseif($image_info[ext] == "png") { $mime = "image/x-png"; $type = "png"; $type2= "png"; } elseif($image_info[ext] == "bmp") { $mime = "image/bmp"; $type = "bmp"; $type2= "jpeg"; } elseif($image_info[ext] == "bmpc") { $mime = "image/bmp"; $type = "jpeg"; $type2= "jpeg"; } elseif($image_info[ext] == "gif") { $mime = "image/gif"; $type = "gif"; $type2= "gif"; } } } ///// //Now to get the Users Prefs And cmd vars ///// $SQL = "SELECT * FROM ims_wm WHERE u_id = $user_infp[u_id]"; $wm_info = mysql_fetch_assoc(mysql_query("SELECT * FROM ims_wm WHERE u_id = '$user_info[u_id]'")); ///// //Control Vars to make sure it uses jpg/gif/bmp ect ///// $cmd = "ImageCreateFrom".$type; $cmd2 = "image".$type2; IF ($wm_info[active] == "1") { ///// //Gets Width and Heigt of image to start at bottom right ///// $size = getimagesize($filename); $start_w = $size[0]; $start_h = $size[1]; ///// //Creates The temp file ///// $im = $cmd($filename); ///// //WaterMark Vars Colours ect ///// $colour1 = explode(" ",$wm_info[colour1]); $textcolor = imagecolorallocate($im, $colour1[0], $colour1[1], $colour1[2]); $colour2 = explode(" ",$wm_info[colour2]); $textcolor2 = imagecolorallocate($im, $colour2[0], $colour2[1], $colour2[2]); $font_size = $wm_info[font_size]; $space = $wm_info[space]; ///// //Counter Starter ///// $i="0"; ///// //Writes the watermark alertnating ///// WHILE ($i != $wm_info[lines]) { IF($i%2) { ImageTTFText ($im, $font_size,45,$start_w,$start_h, $textcolor, "/fonts/verdanab.ttf","$wm_info[text]"); }ELSE{ ImageTTFText ($im, $font_size,45,$start_w,$start_h, $textcolor2, "/fonts/verdanab.ttf","$wm_info[text2]"); } $start_w = $start_w - $space; $i ++; } ///// //Outputs the Image And then deletes it from the server. ///// header("Content-Type: $mime"); header("Content-Disposition: inline; filename=$image_name"); header("Pragma: no-cache"); header("ImageToolBar: no"); header("Expires: 0"); $cmd2($im); imagedestroy($im); }ELSE{ $handle = fopen($filename, "r"); $contents = fread($handle, filesize($filename)); fclose($handle); header("Content-Type: $mime"); header("Content-Disposition: inline; filename=$image_name"); header("Pragma: no-cache"); header("ImageToolBar: no"); header("Expires: 0"); echo $contents; } ?>