Author Topic: Small Credit "System" "MOD"  (Read 107663 times)

0 Members and 1 Guest are viewing this topic.

Michael

  • Guest
Re: Small Credit "System" "MOD"
« Reply #15 on: September 28, 2005, 02:12:32 PM »
Merkwürdigerweise greift nun die Funktion des Upload-limits (bei mir 24 Std) nicht mehr, irgend etwas stimmt da nun in der member.php nicht mehr.

Offline PetraK

  • Jr. Member
  • **
  • Posts: 98
    • View Profile
    • http://www.tiermotive.de
Re: Small Credit "System" "MOD"
« Reply #16 on: September 28, 2005, 06:46:43 PM »
Ich habe das gleiche Problem, User können - seit dem ich das in member.php wie beschrieben geändert habe - keine Fotos mehr uploaden. Es erscheint beim Upload die Meldung, dass das Limit erreicht sei, was nach Anfrage eines Users nicht korrekt ist, weil der User drei Tage lang keine Fotos hochgeladen hat.

Grüsse PetraK

Michael

  • Guest
Re: Small Credit "System" "MOD"
« Reply #17 on: September 28, 2005, 09:08:16 PM »
Hochladen können die User schon, soweit funktioniert der Mod wunderbar aber das Upload-Limit (je 24 Std. ein Bild) greift nicht mehr und die User können soviel posten wie sie wollen  :roll:

Offline Egly

  • Jr. Member
  • **
  • Posts: 71
    • View Profile
Re: Small Credit "System" "MOD"
« Reply #18 on: September 29, 2005, 12:13:34 AM »
hmmm komisch.

Ihr könnt mal versuchen in der member.php den code von

Code: [Select]
//------------------------------------------------------------
//----------------------Check User Limits --------------------
//------------------------------------------------------------

bis einschließlich
Code: [Select]
$site_template->print_template($site_template->parse_template("over_limit"));
include(ROOT_PATH.'includes/page_footer.php');
exit;
}

durch den hier zu tauschen:

Code: [Select]
//------------------------------------------------------------
//----------------------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;
}

Das ist der Code von meiner member.php und bei mir funzts auch. Ich habs extra nochmal getestet.

Offline beseech

  • Full Member
  • ***
  • Posts: 150
    • View Profile
Re: Small Credit "System" "MOD"
« Reply #19 on: September 29, 2005, 02:49:49 AM »
someone can tell me in english for what this is ...?

:roll:

Offline Egly

  • Jr. Member
  • **
  • Posts: 71
    • View Profile
Re: Small Credit "System" "MOD"
« Reply #20 on: September 29, 2005, 07:49:00 AM »
The both above have the problem, that they dont have the 24h Limit any more.
I told them to replace in member.php from
Code: [Select]
//------------------------------------------------------------
//----------------------Check User Limits --------------------
//------------------------------------------------------------
to
Code: [Select]
$site_template->print_template($site_template->parse_template("over_limit"));
include(ROOT_PATH.'includes/page_footer.php');
exit;
}

with this code:

Code: [Select]
//------------------------------------------------------------
//----------------------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;
}

Michael

  • Guest
Re: Small Credit "System" "MOD"
« Reply #21 on: September 29, 2005, 10:10:45 AM »
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

Code: [Select]
//------------------------------------------------------------
//----------------------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;
}

Offline PetraK

  • Jr. Member
  • **
  • Posts: 98
    • View Profile
    • http://www.tiermotive.de
Re: Small Credit "System" "MOD"
« Reply #22 on: September 29, 2005, 12:03:37 PM »
Hallo Egly,

erst einmal vielen Dank für Dein hervorragendes Modul.


Ich habe auch die Änderung wie oben beschrieben vorgenommen - aber ich habe immer noch das Problem, dass das Limit erreicht wurde, schade  :cry:

Beste Grüsse PetraK

Offline Egly

  • Jr. Member
  • **
  • Posts: 71
    • View Profile
Re: Small Credit "System" "MOD"
« Reply #23 on: September 29, 2005, 01:33:34 PM »
hmmm, das war eigentlich alles was ich an der member.php verändert hab.

Ihr könnt höchstens mal in myphpadmin die einträge überprüfen.

Die user_global_limit muss auf eurem globalem Limit stehen und die user_limit eben auf dem Tageslimit.

Vorher hats schon funktioniert oder?

Ansonsten wüsste ich dann auch nicht mehr wo der Fehler liegen könnte..

Michael

  • Guest
Re: Small Credit "System" "MOD"
« Reply #24 on: September 29, 2005, 04:07:32 PM »
ich habe gerade noch mal nachgeschaut,
in der user_global_limit steht Standard "5"
in der user_limit steht Standard "1"



Nachtrag:

Ich habe gerade die "alte" member.php wieder aufgespielt und der Fehler ist immer noch vorhanden (keine 24 Std. Upload-sperre),
der Fehler wird sich wohl schon früher eingeschlichen haben  :oops:

Sorry Egly für die Mühe!

Gruß, Michael

Offline beseech

  • Full Member
  • ***
  • Posts: 150
    • View Profile
Re: Small Credit "System" "MOD"
« Reply #25 on: September 29, 2005, 04:36:16 PM »
danke Egly  :)

Offline PetraK

  • Jr. Member
  • **
  • Posts: 98
    • View Profile
    • http://www.tiermotive.de
Re: Small Credit "System" "MOD"
« Reply #26 on: September 29, 2005, 06:00:38 PM »
@Egly

Also meine alte member.php funktioniert einwandfrei, sowie ich aber die Änderungen in der alten member.php vornehme, funktioniert es nicht mehr. Ich werde noch mal die Einträge in phpmyadmin prüfen, vielleicht hat sich dort ein Fehler eingeschlichen.

Nochmals vielen Dank für Deine Mühe  :P

Michael

  • Guest
Re: Small Credit "System" "MOD"
« Reply #27 on: November 09, 2005, 02:14:46 PM »
wurde Problem das mit den raitingpoints schon gelöst?

Offline lemccoy

  • Jr. Member
  • **
  • Posts: 90
    • View Profile
    • DrunkIsland
Re: Small Credit "System" "MOD"
« Reply #28 on: November 10, 2005, 10:47:58 PM »
Is there anyway to just call this function as per a user?
such as:

http://www.4imagesEXAMPLE.com/credits.php?user=HappyGilmore

and just have the generic table pop up with user points?

Offline Egly

  • Jr. Member
  • **
  • Posts: 71
    • View Profile
Re: Small Credit "System" "MOD"
« Reply #29 on: November 11, 2005, 11:23:33 AM »
@Michael: Ja, das Problem wurde gelöst. Ich hab den Quellcode aber im Moment nicht da, deshalb werde ichs heute abend posten.

@lemccoy: I dont know what you mean..
do you mean, that guests dont have to see the points table?  :?:

greez