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

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

0 Members and 1 Guest are viewing this topic.

Offline TheOracle

  • Hero Member
  • *****
  • Posts: 875
    • View Profile
Re: [MOD] Download limit v1
« Reply #75 on: January 21, 2006, 03:55:12 AM »
The issue is from your download.php file where :

Quote

$sql = "SELECT cat_id, image_media_file, image_download_url
          FROM ".IMAGES_TABLE."
          WHERE image_active = 1 AND image_id IN ($image_id_sql) AND cat_id IN (".get_auth_cat_sql("auth_download").")";
  $result = $site_db->query($sql);


Would it be possible to post your paragraph to see where the error could be specificly ? ;)

Note: Post modified above from user after this one was posted.

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 #76 on: January 21, 2006, 04:17:14 AM »
1) 4images is using HTTP_REFERER header and if you have a privacy control software that is blocking referral page you came from, 4images will not work properly on 100%. It sounds like your case.

2) Try to insert in download.php above
Code: [Select]
  $sql = "SELECT cat_id, image_media_file, image_download_url this line:
Code: [Select]
  if (empty($image_id_sql))
  {
    header("Location: ".$site_sess->url($url, "&"));
    exit;
  }
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)

Offline Fastian

  • Full Member
  • ***
  • Posts: 199
    • View Profile
Re: [MOD] Download limit v1
« Reply #77 on: January 21, 2006, 09:57:28 AM »
With above modification, I m no more getting this DB error while using IE. That means for IE its now working fine.
But with Firefox, its still there. I tried many times clearing my internet history, clearing cache but no change.
Its strange but its happening.

I don’t have any privacy software, no proxy thing not even any anti virus software.
What could be the reason if its not by the script ?

Secondly, Is it possible to show a Message box to user instead of redirecting to the main page ? They will never know what caused them redirect to main page if using page download Mod.

One more thing. As you suggested before to change this line
Code: [Select]
if ($user_info['user_level'] == ADMIN) return; in functions.php to give Register users unlimited downloads.

The only closest thing that i have in my functions.php is this
Code: [Select]
if ($user_info['user_level'] == ADMIN)
  {
    $return = true;
    foreach ($types as $key)
    {
      if (isset($HTTP_GET_VARS[$key]) && $$key = $HTTP_GET_VARS[$key]) $return = false;
      else $$key = "";
    }
    if ($return) return false;
    $force = true;
  }
Which is inside check_ban() function.  (From "[MOD] Ban v1.6.1" by U )
Dont you think changing this will remove the ban from user ??? Or cause any trouble ? 

@ TheOracle 
My whole download.php file is attached.
I m not a  Programmer.
          But
I m a Good Learner.

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 #78 on: January 21, 2006, 05:58:58 PM »
Ok
1) if you are trying download single image while your download limit is reached (from details page), does it redirects you to index.php too?
2) you can try insert below
Code: [Select]
elseif ($action == "page") {this line:
Code: [Select]
  $url = (empty($url)) ? ROOT_PATH."categories.php?".URL_CAT_ID."=".$cat_id : $url;Then in categories.php above
Code: [Select]
//-----------------------------------------------------
//--- Clickstream -------------------------------------
//-----------------------------------------------------
insert this:
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
*/
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)

Offline Fastian

  • Full Member
  • ***
  • Posts: 199
    • View Profile
Re: [MOD] Download limit v1
« Reply #79 on: January 21, 2006, 08:47:46 PM »
Quote
1) if you are trying download single image while your download limit is reached (from details page), does it redirects you to index.php too?
Yes It deos. Infect in all three cases ( WIth Lightbox, SIngle file download or with category page download) it redirects to the main page when users is off the limit. BUT this happen only with IE

WIth FireFox, it gives a blank page In first two cases and for page download it still gives the DB error message.

I have done the changes u mentioned above (The last one) But still its the same no difference at all.
I m not a  Programmer.
          But
I m a Good Learner.

Offline ato

  • Pre-Newbie
  • Posts: 4
    • View Profile
Re: [MOD] Download limit v1
« Reply #80 on: January 22, 2006, 08:25:10 PM »
Hi V@no,

das funktioniert sehr gut.
aber was muss ich machen,um das Automatische nicht mehr zu entsteht (sieht link) ?, und die Mitglieder kann nur ein *.gif Bild speichern (wie deine Seite)

http://fire.prohosting.com/nlminh/img/123.jpg oder http://nlminh.com.co.nr/img/123.jpg

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 #81 on: January 22, 2006, 08:31:47 PM »
find a topic "pic security" its all there ;)
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)

Offline Fastian

  • Full Member
  • ***
  • Posts: 199
    • View Profile
Re: [MOD] Download limit v1
« Reply #82 on: January 22, 2006, 10:40:33 PM »
I am stuck with it. Still redirecting using IE and still giving DB error message with FireFox. I don’t know what’s the big difference between the two explorers but I cant understand why its showing DB error message.

If for now, I put aside the redirect issue (Its important but not that much)
V@no could you please have a look and see why its giving DB error message?? 

Can I PM you the URL  (If u need) ?
I m not a  Programmer.
          But
I m a Good Learner.

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 #83 on: January 22, 2006, 10:49:43 PM »
Can I PM you the URL (If u need) ?
Please do
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)

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 #84 on: January 23, 2006, 12:31:41 AM »
With above modification, I m no more getting this DB error while using IE. That means for IE its now working fine.
But with Firefox, its still there. I tried many times clearing my internet history, clearing cache but no change.
Its strange but its happening.
Actualy the error showed in both browser, its just IE was obeying the redirect header, while FF ignoring it. I've updated the code above that should fix it.

There something else you did in global.php (I asume) that causes the wrong redirection.
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)

Offline Fastian

  • Full Member
  • ***
  • Posts: 199
    • View Profile
Re: [MOD] Download limit v1
« Reply #85 on: January 23, 2006, 12:02:10 PM »
Here is the update.

By adding this
Code: [Select]
  if (empty($image_id_sql))
  {
    header("Location: ".$site_sess->url($url, "&"));
    exit;
  }
I no more get DB error message. Thanks V@no for helping me out.

Now could please guide me here, where should I start digging into this problem.
Why it get redirect to main page using IE? And get a Blank page using any other browser. ( I just found out that it happens with Opera as well)
I just want to show an error message just like when u right click on the pic.

What exactly the code statement that is used to redirect (so that i can double check it)??
By the way, Is it the default way or I m the only victim here?

Quote
There something else you did in global.php (I asume) that causes the wrong redirection.

V@no I compared it with the new 1.7.1 version file. It’s exactly the same.  I haven’t changed anything is this file.

I m not a  Programmer.
          But
I m a Good Learner.

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 #86 on: January 23, 2006, 02:29:26 PM »
V@no I compared it with the new 1.7.1 version file. It’s exactly the same.  I haven’t changed anything is this file.
Then I see you are using the "search engine friendly url" mod. Did you change it's code so it would replace index.php with empty string? if so, try make it replace index.php with ./ instead.
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)

Offline Fastian

  • Full Member
  • ***
  • Posts: 199
    • View Profile
Re: [MOD] Download limit v1
« Reply #87 on: January 23, 2006, 04:14:07 PM »
V@no, Thanks a million

Its been two days now and I was trying everything, looking into page_header.php and function.php files, finding some clue that could solve the issue.
Mainly I was looking for this line and trying to get some idea. I believe this calls for redirect. 
Code: [Select]
header("Location: ".$site_sess->url($url, "&")); But I guess I was looking in wrong place with wrong code.

Just incase, if someone is interested (got the same issue) ,
 I replaced
Code: [Select]
if (strstr($url, 'index.php')) {
        $url = str_replace('index.php', '', $url);
With
Code: [Select]
if (strstr($url, 'index.php')) {
        $url = str_replace('index.php', './', $url);
in include/sessions.php file and now i am no more getting blank page with FF and Opera. (Both now redirect to main page)

Once again, Thanks for helping me out.
I m not a  Programmer.
          But
I m a Good Learner.

Offline TheOracle

  • Hero Member
  • *****
  • Posts: 875
    • View Profile
Re: [MOD] Download limit v1
« Reply #88 on: January 23, 2006, 04:55:37 PM »
@Fastian:

It could also be stated like this :

Code: [Select]

if (strstr($url, 'index.php')) {
        $url = str_replace('index.php', ROOT_PATH, $url);


;)

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 #89 on: January 24, 2006, 02:42:50 AM »
@Fastian:
You've solved only half of the mistery..the another half is - why it redirects to index page and not to the last visited...
For testing purpose, in download.php below <?php insert this:
Code: [Select]
echo "<pre>";
print_r($_SERVER);
exit;
Now, open image details page and click download button. It should show you some stuff on blank page, check if you get [HTTP_REFERER] => some address
If you do, then in global.php above
Code: [Select]
if (defined("SCRIPT_URL") && SCRIPT_URL != "") { insert:
Code: [Select]
echo $url;
Then on every page you go, it should show you on top the previous page URL and not url to index.php
If all that is correct, then there is somewhere in other files you've modified, variable $url is being altered...that what you should start digging ;)


@Fastian:

It could also be stated like this:
Its not recommended, because in ACP ROOT_PATH is different.
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)