• [MOD] Download limit v1.0.1 4 0 5 1
Currently:  

Author Topic: [MOD] Download limit v1.0.1  (Read 194372 times)

0 Members and 1 Guest are viewing this topic.

Offline shadowhunter

  • Full Member
  • ***
  • Posts: 114
    • View Profile
    • Fotogalerie & Fotocommunity scluzern.com
Re: [MOD] Download limit v1
« Reply #135 on: March 31, 2007, 10:52:00 PM »
@trez:
What have you done in your adjustments?

I use 1.7.4, but it don't run perfectly.
When I click on the button "download" and I haven't more download-credits, then will be loaded the "home"-page of my gallery. The error will not be displayed in this moment.
I will show the image with the download-error in my gallery where I clicked on the button.
Thanks for help... ;)

Offline Buggy Driver

  • Newbie
  • *
  • Posts: 22
    • View Profile
Re: [MOD] Download limit v1
« Reply #136 on: April 16, 2007, 02:12:56 AM »


Same problem hire  1.7.4  --> redirect to the index.php  --> no error no message.

it looks like the redirect($url); is wrong
so after a couple try and error I reached this solution

Code: [Select]
/*
  MOD DOWNLOAD LIMIT
  BEGIN INSERT
*/
  if (!check_dl_limit(0))
  {
    $site_sess->set_session_var("msg_error", addslashes($lang['dl_limit_reached']));
//    redirect($url);
    redirect("details.php?image_id=".$image_id);
    exit;
  }
/*
  MOD DOWNLOAD LIMIT
  BEGIN INSERT
*/


but there are 2 places in the download limit where a redirect($url); occurs
the other is always bin there but now after the redirect there is a error message so……

in the index php look for

Code: [Select]
//-----------------------------------------------------
//--- Print Out ---------------------------------------
//-----------------------------------------------------
$site_template->register_vars(array(
  "msg" => $msg,
  "clickstream" => $clickstream
));

above insert the same code as in details.php
Code: [Select]
/*
  MOD DOWNLOAD LIMIT
  BEGIN INSERT
*/
if ($msg_error = $site_sess->get_session_var("msg_error"))
{
  $msg .= ((empty($msg)) ? "" : "<br />").stripslashes($msg_error);
  $site_sess->drop_session_var("msg_error");
}
/*
  MOD DOWNLOAD LIMIT
  END INSERT
*/

now the message will be on the index page to.


Offline shadowhunter

  • Full Member
  • ***
  • Posts: 114
    • View Profile
    • Fotogalerie & Fotocommunity scluzern.com
Re: [MOD] Download limit v1
« Reply #137 on: April 18, 2007, 11:26:09 AM »
Thanks a lot, Buggy Driver!!!
It works great!
Have a nice time...
best wishes!

Offline kira2oo2

  • Pre-Newbie
  • Posts: 9
    • View Profile
    • ww.xfoto.ch
Re: [MOD] Download limit v1
« Reply #138 on: May 25, 2007, 01:55:24 AM »
Hallo zusammen

habe den Mod in meinem 1.7.4 eingebaut, funktioniert einwandfrei!! Noch zusagen ist, als typ für andere, dass ich den Mod für 1.7.2 genommen habe, ich hatte keine Probleme oder Fehlermeldungen. Danke V@no und alle die da mitgemacht haben. Alles in allem ein super Mod!

Hier noch was für Deutsch sprechende.... ich habe versucht den Step 8
Open lang/<your language>/main.php zu übersetzten:

Quote
/*
  MOD DOWNLOAD LIMIT
  BEGIN INSERT
*/
$lang['user_dl_limit'] = "Download limit";
$lang['user_dl_time'] = "Start time";
$lang['user_dl_count'] = "Downloads count";
$lang['user_dl_limit_reached'] = "Deine Downloadquote pro ".$config['user_dl_time']." Stunden ist erreicht worden. Du kannst nicht mehr downloaden bis in {dltime}";
$lang['user_dl_limit_unlimited'] = "Dein Downloadlimit ist unbegrenzt";
$lang['user_dl_limit_status'] = "Du hast {dlcount} von {dltottal} Bilder, runtergeladen in ".$config['user_dl_time']." hours";
$lang['dl_limit_reached'] = "Sorry, Du hast die Downloadbegrenzung erreicht für ".$config['user_dl_time']." hours";
$lang['dates_short'] = array(
  array("yr", "day", "hr", "min", "sec"),
  array("yrs", "days", "hrs", "min", "sec")
);
/*
  MOD DOWNLOAD LIMIT
  END INSERT
*/

 Vieleicht kann es ja jemand brauchen........  :oops:

Offline nic_bck

  • Newbie
  • *
  • Posts: 29
    • View Profile
Re: [MOD] Download limit v1 and phpbb integration
« Reply #139 on: October 06, 2007, 12:26:13 PM »
I'm trying to use [MOD] Download limit v1 and phpbb integration

When I install the MOD I have this error:
Fatal error: Call to undefined function: set_cookie_data() in /home/web/public_html/4images/download.php on line 75

I think that the problem is in sessions.php.

Can somebody help me to use [MOD] Download limit v1 and phpbb integration??

Sorry, my english... XD

Thanks!
nic_bck
« Last Edit: December 13, 2007, 04:18:34 PM by nic_bck »

Offline thunderstrike

  • 4images Guru
  • *******
  • Posts: 2.327
    • View Profile
Re: [MOD] Download limit v1
« Reply #140 on: October 06, 2007, 01:33:11 PM »
Your sessions file is alter. If no MOD install on file, re-upload file and is work. If MOD install on that file, use compare tool (Beyond Compare 2 or Winmerge). Look like the file is bad upload in FTP / cPanel.
8 steps need when ask question -

- PHP version (ACP - > phpinfo())
- mySQL version (ACP - > phpinfo())
- 4images version
- Post screenshot / URL
- Post code in BB Code (no need full file for code) or post attach file
- It doesn't work. What is say - what is do for no work
- Install MOD ? If so - please say (troubleshooting)
- Read FAQ ? Install Bug fixes ?

Offline nic_bck

  • Newbie
  • *
  • Posts: 29
    • View Profile
Re: [MOD] Download limit v1
« Reply #141 on: October 06, 2007, 06:10:41 PM »
Hi, first thanks for your reply.

The problem is in sessions.php becouse I have the sessions.php of the phpbb integration.
You can see it here:
http://www.4homepages.de/forum/index.php?topic=14852.0

My 4images version: 1.74.

The problem is on the 6th step:

Quote
Step 6
Open includes/sessions.php
Find:
Code:

Code: [Select]
        $this->delete_old_sessions();
      }
    }
Insert ↓BELOW↓:
Code:
Code: [Select]
/*
  MOD DOWNLOAD LIMIT
  BEGIN INSERT
*/
    global $config;
    if ($this->user_info['user_level'] > GUEST)
    {
      if (!$this->user_info['user_dl_limit'] && $this->user_info['user_dl_limit'] != -1)
      {
        $this->user_info['user_dl_limit'] = $config['user_dl_limit'];
      }
      if (!$this->user_info['user_dl_time'])
      {
        $this->user_info['user_dl_time'] = 0;
      }
    }
 
    if ($dl = $this->read_cookie_data('data'))
    {
      $dl = explode(" ", base64_decode($dl));
      if (isset($dl[1]) && $dl[1] && $config['user_dl_time']*60*60 > (time() - $dl[1]))
      {
        $this->user_info['user_dl_time'] = $dl[1];
        $this->user_info['user_dl_count'] = (isset($dl[0]) && $dl[0]) ? $dl[0] : 0;
      }
      else
      {
        $this->user_info['user_dl_time'] = 0;
        $this->user_info['user_dl_count'] = 0;
      }
    }
    elseif ($this->user_info['user_level'] == GUEST)
    {
      $this->user_info['user_dl_count'] = 0;
      $this->user_info['user_dl_time'] = 0;
    }
    if ($this->user_info['user_level'] == GUEST)
    {
      $this->user_info['user_dl_limit'] = $config['user_dl_limit'];
    }
/*
  MOD DOWNLOAD LIMIT
  END INSERT
*/


I need to adapt the sixth step to integrate with the sessions.php of [MOD] phpbb integration

Can you help me?

Thanks!
nic_bck
« Last Edit: December 13, 2007, 04:18:04 PM by nic_bck »

Offline thunderstrike

  • 4images Guru
  • *******
  • Posts: 2.327
    • View Profile
Re: [MOD] Download limit v1
« Reply #142 on: October 06, 2007, 06:59:55 PM »
Sorry, I no support other authors MOD for integrate.
8 steps need when ask question -

- PHP version (ACP - > phpinfo())
- mySQL version (ACP - > phpinfo())
- 4images version
- Post screenshot / URL
- Post code in BB Code (no need full file for code) or post attach file
- It doesn't work. What is say - what is do for no work
- Install MOD ? If so - please say (troubleshooting)
- Read FAQ ? Install Bug fixes ?

Offline casper01

  • Newbie
  • *
  • Posts: 22
    • View Profile
Re: [MOD] Download limit v1
« Reply #143 on: November 03, 2007, 05:01:58 PM »
Hello I use 4image  1.74 scrip its very cool but i have some problem with this mod.I go button in cp "Apply to all subcategories" but when I check "Yes" , it dident change the subdirectories pemisson.Same problem with download limit...I got download limit in cp.for ex. I put 2 downloads file in 24 h.When I get in download secssion I see this "You have downloaded 0 of 2 files, allowed per hours".When I trai do download another time I see the same "You have downloaded 0 of 2 files, allowed per hours" and it allowed me tu download how many times I want. I was trai this when I not registred user and when Im registred user NOT ADMIN .
PLESE HELP

Offline renicolay

  • Newbie
  • *
  • Posts: 43
    • View Profile
Re: [MOD] Download limit v1
« Reply #144 on: April 13, 2008, 05:12:51 PM »
Has anyone tested this on 1.7.6 yet?

Offline silentg

  • Newbie
  • *
  • Posts: 16
    • View Profile
    • WallpaperJoint
Re: [MOD] Download limit v1
« Reply #145 on: June 10, 2008, 02:15:48 AM »
Running V1.7.6.

Has anyone tried it?


thanks

Offline sigma.

  • Full Member
  • ***
  • Posts: 148
  • cydonian.com/potd
    • View Profile
    • sigma's gallery
Re: [MOD] Download limit v1
« Reply #146 on: August 09, 2008, 11:38:30 PM »
I cant install on 1.7.6 because the download.php code has changed. cant match up what needs to be changed or replaced.

Im stuck on Step 2. Cant find this code in download.php
Code: [Select]
function get_remote_file($url) {
anyone know the equivalent in 1.7.6?

Offline sigma.

  • Full Member
  • ***
  • Posts: 148
  • cydonian.com/potd
    • View Profile
    • sigma's gallery
Re: [MOD] Download limit v1
« Reply #147 on: August 10, 2008, 12:09:14 AM »
Just tried my best and got it to work. Some of the code in download.php 1.7.6 doesn't match.
Follow this step 2 insted of the first post

Step 2
Open download.php
Find:
Code: [Select]
$user_access = get_permission();
Insert Below
Code: [Select]
/*
  MOD DOWNLOAD LIMIT
  BEGIN INSERT
*/
$dl = 0;
function check_dl_limit($dl)
{
  global $user_info, $config;
  if ($user_info['user_level'] != ADMIN && $user_info['user_dl_limit'] != -1 && $user_info['user_dl_limit'] && time() - $user_info['user_dl_time'] <= 60*60*$config['user_dl_time'] && $user_info['user_dl_count'] + $dl >= $user_info['user_dl_limit'])
  {
    return false;
  }
  elseif ($user_info['user_level'] != ADMIN && $user_info['user_dl_limit'] != -1 && $user_info['user_dl_limit'] && time() - $user_info['user_dl_time'] > 60*60*$config['user_dl_time'] && $dl >= $user_info['user_dl_limit'])
  {
    return false;
  }
  return true;
}
function update_dl_limit($dl)
{
  global $user_info, $site_db, $site_sess, $config;
  if ($user_info['user_level'] == ADMIN) return;
  $time = time();
  if (!$user_info['user_dl_time'] || $time - $user_info['user_dl_time'] > 60*60*$config['user_dl_time'])
  {
    $time_sql = ", user_dl_time = ".$time;
    $user_info['user_dl_count'] = $dl;
    $user_info['user_dl_time'] = $time;
  }
  else
  {
    $time_sql = "";
    $user_info['user_dl_count'] += $dl;
  }
  if ($user_info['user_level'] > GUEST)
  {
    $sql = "UPDATE ".USERS_TABLE."
            SET user_dl_count = ".$user_info['user_dl_count'].$time_sql."
            WHERE user_id = ".$user_info['user_id'];
    $site_db->query($sql);
  }
  $site_sess->set_cookie_data('data', base64_encode($user_info['user_dl_count']." ".$user_info['user_dl_time']), 1, 60*60*$config['user_dl_time']);
}
/*
  MOD DOWNLOAD LIMIT
  END INSERT
*/


Step 2.3
Find:
Code: [Select]
else {
      redirect("lightbox.php?empty=1");
    }
  }
}

Insert Below
Code: [Select]
/*
  MOD DOWNLOAD LIMIT
  BEGIN REPLACE
*/
      $file['file_data'] = $zipfile->send(time().".zip");
      exit;
    }
    else {
      if (!check_dl_limit(0))
      {
        $site_sess->set_session_var("msg_error", addslashes($lang['dl_limit_reached']));
      }
      redirect($url);
/*
  MOD DOWNLOAD LIMIT
  END REPLACE
*/

worked for me.

Offline sigma.

  • Full Member
  • ***
  • Posts: 148
  • cydonian.com/potd
    • View Profile
    • sigma's gallery
Re: [MOD] Download limit v1
« Reply #148 on: August 11, 2008, 02:11:13 PM »
ok so i was wrong. the last bit is giving me an error

Code: [Select]
Parse error: syntax error, unexpected '}' in /home/cydonian/public_html/photos/download.php on line 231
In my download.php i find this between lines 225 and 241
Code: [Select]
/*
  MOD DOWNLOAD LIMIT
  BEGIN REPLACE
*/
      $file['file_data'] = $zipfile->send(time().".zip");
      exit;
    }
    else {
      if (!check_dl_limit(0))
      {
        $site_sess->set_session_var("msg_error", addslashes($lang['dl_limit_reached']));
      }
      redirect($url);
/*
  MOD DOWNLOAD LIMIT
  END REPLACE
*/

lines 230,231,232
Code: [Select]
      exit;
    }
    else {

Anyone know whats missing here?

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: [MOD] Download limit v1
« Reply #149 on: August 11, 2008, 02:25:15 PM »
Step 2.3
Find:
      redirect("lightbox.php?empty=1");


Insert above:
/*
  MOD DOWNLOAD LIMIT
  BEGIN INSERT ABOVE
*/
      
if (!check_dl_limit(0))
      {
        
$site_sess->set_session_var("msg_error"addslashes($lang['dl_limit_reached']));
      }
/*
  MOD DOWNLOAD LIMIT
  END INSERT ABOVE
*/
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)