Author Topic: restrict everyone to view my picture's detail before download it ,please  (Read 8000 times)

0 Members and 1 Guest are viewing this topic.

Offline iannnnn

  • Pre-Newbie
  • Posts: 3
    • View Profile
(sorry for my quite bad english)


hi all,
i'm using 4images for 9 months in my website  :D
it's really the best fantastic application that i've ever seen!

okay, let's see my problem.

my website has many pictures that i allow everybody to see and download them
but i don't like someone who grab the direct-links to the download buttons
example :
Code: [Select]
www.myweb.com/gallery/download.php?action=zip&image_id=xxx
it's made me really confuse about the hits number of each images that less than the download number
when i check at my web statistics, they told me -- "hey, your image gallery was stolen by someone  :lol:"


so...
i would like to use the mod that help me to restrict everyone to view my picture's detail before download it
maybe i have to modify some lines in the /include/download.php, or not?

pleasssseeeee --- i wanna recieve some helps form the heroes here  :wink:
thanks for 100 times !!

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: restrict everyone to view my picture's detail before download it ,please
« Reply #1 on: November 12, 2005, 08:26:57 PM »
1) in includes/sessions.php find:
Code: [Select]
$user_info = $site_sess->return_user_info(); insert below:
Code: [Select]
if (!isset($allowdownload) || empty($allowdownload))
{
  $site_sess->set_session_var("allowdownload", "");
}

2) in includes/functions.php find:
Code: [Select]
    $allow_download = 1;Insert below:
Code: [Select]
    $site_sess->set_session_var("allowdownload", time());
3) in download.php find:
Code: [Select]
$main_template = 0;Insert below:
Code: [Select]
$allowdownload = 1;Then find:
Code: [Select]
  if (!check_permission("auth_download", $image_row['cat_id']) || !$image_row) {
    header("Location: ".$site_sess->url($url, "&"));
    exit;
  }
Replace it with:
Code: [Select]
  if (!$image_row || !check_permission("auth_viewcat", $image_row['cat_id']) || !check_permission("auth_viewimage", $image_row['cat_id'])) {
    header("Location: ".$site_sess->url($url, "&"));
    exit;
  }
  else
  {
    $allowdownload = $site_sess->get_session_var("allowdownload");
//    if (!check_permission("auth_download", $image_row['cat_id']) || (time() - $site_sess->get_session_var("allowdownload") > 60*5))
    if (!check_permission("auth_download", $image_row['cat_id']) || !$site_sess->get_session_var("allowdownload"))
    {
      header("Location: ".$site_sess->url(ROOT_PATH."details.php?image_id=".$image_id, "&"));
      exit;
    }
  }
(note, this step also fixes a bug in 4images which allow people download images that they were not allowed to view!)

In step 3 I've added 5 minutes timeout, meaning visitor must click on download button in within 5 minutes after opening details page, otherwise it will simply refresh the page with another 5 minutes timeout. To enable this feature, use the commented out condition line.
P.S. all this not tested
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 Acidgod

  • 4images Moderator
  • 4images Guru
  • *****
  • Posts: 2.421
  • It's me?
    • View Profile
    • Flash-Webdesign
Re: restrict everyone to view my picture's detail before download it ,please
« Reply #2 on: November 12, 2005, 08:39:35 PM »
@V@no
Cool Idea... (o:

Offline iannnnn

  • Pre-Newbie
  • Posts: 3
    • View Profile
Re: restrict everyone to view my picture's detail before download it ,please
« Reply #3 on: November 13, 2005, 04:39:45 AM »
THANKS!!!
now i can fix my bugs and say yahoooooowwwwwwuuu  :mrgreen:

for someone who want to know about an effect of this mod :
when users use direct-links to download pages, they will grab a 'download.php' instead.  :lol:

i tested it in:
- 1.7
- flashget
- mozilla firefox 1.0.7
and it works!

thanks a lot again!  :wink:

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: restrict everyone to view my picture's detail before download it ,please
« Reply #4 on: November 13, 2005, 04:42:24 AM »
when users use direct-links to download pages, they will grab a 'download.php' instead. :lol:
You got me confused on that one...what do you mean?
It should simply redirect to details page of the image instead and if you try to right click on the link and do save as, it should save html page of the details page...:?
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 iannnnn

  • Pre-Newbie
  • Posts: 3
    • View Profile
Re: restrict everyone to view my picture's detail before download it ,please
« Reply #5 on: November 13, 2005, 06:41:42 PM »
Oh sorry.
i typed mismatch  :oops:

Offline sajwal

  • Jr. Member
  • **
  • Posts: 61
    • View Profile
Hi V@no , This is a nice fix to get stolen,

i am using 1.7.3 should i go for this fix?

Pls. Guide

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
v1.7.3 already has this implemented ;)
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)