Hallo Egly,
ich habe das nun so geändert wie beschrieben, doch der Fehler bleibt bestehen, die 24 Stunden-sperre ist immer noch ausgehebelt.
Hier der Ausschnitt aus der member.php
//------------------------------------------------------------
//----------------------Check User Limits --------------------
//------------------------------------------------------------
$user_id = $user_info['user_id'];
$clickstream = "<span class=\"clickstream\"><a href=\"".$site_sess->url(ROOT_PATH."index.php")."\" class=\"clickstream\">".$lang['home']."</a>".$config['category_separator'];
if ($cat_id && isset($cat_cache[$cat_id])) {
$clickstream .= get_category_path($cat_id, 1).$config['category_separator'];
}
$clickstream .= $lang['file_upload_error']."</span>";
$site_template->register_vars(array(
"clickstream" => $clickstream,
"lang_no_limits" => $lang['no_limits'],
"lang_no_limits_text" => $lang['no_limits_text'],
"lang_already_loaded" => $lang['already_loaded'],
"lang_show_my_images" => $lang['show_my_images'],
"lang_limits_global" => $lang['limits_global'],
"url_show_user_images" => $site_sess->url(ROOT_PATH."search.php?search_user=".$user_info['user_name'])
));
function check_daily_picture_limit($user_id) {
global $site_db, $site_template;
$sql = "SELECT user_limit FROM ".USERS_TABLE." WHERE user_id = $user_id";
$result = $site_db->query($sql);
$row = $site_db->fetch_array($result);
$upload_limit = ($row['user_limit']);
$site_template->register_vars("upload_limit", $upload_limit);
$limit_cutoff = time() - 60 * 60 * 24;
$sql = "SELECT image_id, image_date FROM ".IMAGES_TABLE." WHERE user_id=$user_id AND image_date > $limit_cutoff ORDER BY image_date ASC";
$result = $site_db->query($sql);
$images_per_user = $site_db->get_numrows($result);
$row = $site_db->query_firstrow($sql);
$latest_image_date = ($row['image_date']);
$sql = "SELECT image_id, image_date FROM ".IMAGES_TEMP_TABLE." WHERE user_id=$user_id ORDER BY image_date ASC";
$result = $site_db->query($sql);
$tmp_images_per_user = $site_db->get_numrows($result);
$row = $site_db->query_firstrow($sql);
$latest_tmp_image_date = ($row['image_date']);
$images_per_user = $tmp_images_per_user + $images_per_user;
$latest_image_date = $latest_tmp_image_date > $latest_image_date ? $latest_tmp_image_date : $latest_image_date;
$time_to_go = gmstrftime("%H hrs %M min %S sec", 86400 - (time() - $latest_image_date));
$site_template->register_vars("images_per_user", $images_per_user);
$site_template->register_vars("time_to_go", $time_to_go);
if($images_per_user >= $upload_limit) {
return false;
} else {
return true;
}
}
function check_picture_limit($user_id) {
global $site_db, $site_template;
$sql = "SELECT user_global_limit FROM ".USERS_TABLE." WHERE user_id = $user_id";
$result = $site_db->query($sql);
$row = $site_db->fetch_array($result);
$global_upload_limit = ($row['user_global_limit']);
$site_template->register_vars("global_upload_limit", $global_upload_limit);
$sql = "SELECT image_id FROM ".IMAGES_TABLE." WHERE user_id=$user_id";
$result = $site_db->query($sql);
$globalimages_per_user = $site_db->get_numrows($result);
$sql = "SELECT image_id FROM ".IMAGES_TEMP_TABLE." WHERE user_id=$user_id";
$result = $site_db->query($sql);
$tmp_images_per_user = $site_db->get_numrows($result);
$globalimages_per_user = $tmp_images_per_user + $globalimages_per_user;
// Uncomment above four lines if you also want to check uploaded but not yet validated images against the user limit
$site_template->register_vars("globalimages_per_user", $globalimages_per_user);
if($globalimages_per_user >= $global_upload_limit) {
return false;
} else {
return true;
}
}
if ($action == "uploadform") {
if ($cat_id != 0 && (!isset($cat_cache[$cat_id]) || !check_permission("auth_upload", $cat_id))) {
show_error_page($lang['no_permission']);
exit;
}
if ($cat_id != 0 && (!isset($cat_cache[$cat_id]) || !check_picture_limit($user_id))) {
$site_template->print_template($site_template->parse_template("over_limit2"));
include(ROOT_PATH.'includes/page_footer.php');
exit;
}
if ($cat_id != 0 && (!isset($cat_cache[$cat_id]) || !check_daily_picture_limit($user_id))) {
//
// Depending on your requirements, you can either check against global or daily limit. For global check leave it as it is now.
// For daily limit comment first line and uncomment second one.
//
$site_template->print_template($site_template->parse_template("over_limit"));
include(ROOT_PATH.'includes/page_footer.php');
exit;
}
if ($cat_id != 0 && (!isset($cat_cache[$cat_id]) || !check_daily_picture_limit($user_id))) {
$site_template->print_template($site_template->parse_template("over_limit"));
include(ROOT_PATH.'includes/page_footer.php');
exit;
}