license. */
function exit_document ($body) {
- exit ("<html><head></head><body>$body</body></html>");
+ $charset_meta = '<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">';
+ exit ("<html>$charset_meta<head></head><body>$body</body></html>");
}
function success ($reason) {
(!move_uploaded_file ($file ["tmp_name"], $dest))) {
error_server ();
}
+ send_to_ftp ($dest);
$mini_dest = getthumbsdir () . "/mini_" . basename_safe ($dest);
if (!create_thumbnail_or_copy ($dest, $mini_dest)) {
error_server ();
}
+ send_to_ftp ($mini_dest);
}
return basename_safe ($dest);
}
$path = UPLOADDIR . "/" . $imgpath;
if (file_exists ($path)) {
unlink ($path);
+ delete_from_ftp ($path);
}
$thumb_path = getthumbsdir () . "/mini_" . $imgpath;
if (file_exists ($thumb_path)) {
unlink ($thumb_path);
+ delete_from_ftp ($thumb_path);
}
}
// cookie will be valid for 2 weeks. I've chosen that value
// arbitrarily, and it may change in the future.
$time = time () + 14 * 60 * 24 * 60;
- setcookie (sprintf ("%sauth", DBPREFIX), md5 ($pwd), $time, "" , "", false, true);
- setcookie (sprintf ("%suser", DBPREFIX), $user, $time, "" , "", false, true);
+ if (version_compare (PHP_VERSION, '5.2.0', '>=')) {
+ setcookie (sprintf ("%sauth", DBPREFIX), md5 ($pwd), $time, "" , "", false, true);
+ setcookie (sprintf ("%suser", DBPREFIX), $user, $time, "" , "", false, true);
+ } else {
+ setcookie (sprintf ("%sauth", DBPREFIX), md5 ($pwd), $time, "" , "", false);
+ setcookie (sprintf ("%suser", DBPREFIX), $user, $time, "" , "", false);
+ }
+
}
function check_auth ($con, $user, $pwd, $auth_only) {