forum.coppermine-gallery.net

No Support => Modifications/Add-Ons/Hacks => Mods: Permissions => Topic started by: adiboy on June 07, 2006, 08:24:21 pm

Title: Register After viewing 10 images or more.
Post by: adiboy on June 07, 2006, 08:24:21 pm
ok admin please more this mod as i could not find the place to post this mod i did go and red the post about where to post it and that you will move it. please move it and delete the above messange and let me knwo where it has been moved. thanks


All this code does is lets people view a 10 images and then they have to register or wait for an other 24 hours. I am not the best php programer so if you think you can improve the code please do so.


<< Instollation >>
should work with version 1.4.x

Open displayimage.php

Find $picture = theme_html_picture();


Replace with


Code: [Select]
///10 images view hack for Coppermine Photo Gallery V 1.4.x //////////////////////////////////////////


//number of images that can be viewed before having to register
    $viewimages=10;
   
    //your register messange
    $message = "<p align='center'><a href='register.php'><font size='5'>Please register<br> or login <br> to view all the files </font></a></p>";
   
   
   
      $set=0;
      //checking if the user is loged in.
    if(USER_ID){
     $picture = theme_html_picture();
   
    //when user logsin reset cookie
    setcookie("viewcount", "0");
    }
     
     else {
           
         //checking how many files have been viewed
if($_COOKIE["viewcount"] < $viewimages){

//adding one to the cookie
$set=$_COOKIE["viewcount"]+1;

//setting the cookie
setcookie("viewcount", $set, time()+86400); 
//printing the image
    $picture = theme_html_picture();
     
}
else{
//printing the message
$picture = $message ;

}}
     
     
/////////////////////////////////////////////////////////////////////////////////////////////////////
Title: Re: Register After viewing 10 images or more.
Post by: barramyainc on August 23, 2006, 10:52:27 pm
Yey this works :)

Thanks very much
Title: Re: Register After viewing 10 images or more.
Post by: jadmanx on October 10, 2006, 09:15:16 pm
how can i make that google and co. can see all pics only real user can see 10 pics and than must register ?
Title: Re: Register After viewing 10 images or more.
Post by: Joachim Müller on October 11, 2006, 12:33:10 am
Not at all. I recommend reading up how spiders and the www work.
Title: Re: Register After viewing 10 images or more.
Post by: jadmanx on October 11, 2006, 11:19:20 am
i have install the hack but i become the message on open a pic
Not Found

The requested URL /displayimage-3-0.html was not found on this server.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
Title: Re: Register After viewing 10 images or more.
Post by: Nibbler on October 11, 2006, 01:22:22 pm
Disable the SEF urls plugin. This is not related to this mod.
Title: Re: Register After viewing 10 images or more.
Post by: jadmanx on October 13, 2006, 05:53:16 pm
hihi than i downt need the "Register After viewing 10 images or more" whan i Disable the SEF urls plugin than no user come from google and my traffic is down ...

Add SEF urls plugin support
and "google and co. can see all pics" function
that must be great !!!!!!!!!!!!!!!!!!!!!!!!!!
Title: Re: Register After viewing 10 images or more.
Post by: toy2666 on December 19, 2006, 03:52:10 am
Nice script, thanks!

It is possible to also block the slide show to guest? Even after 10 pictures, you can press the slide show button and see all the pics.

Thanks
Title: Re: Register After viewing 10 images or more.
Post by: @till@ on October 13, 2007, 10:19:17 pm
Thanks
Title: Re: Register After viewing 10 images or more.
Post by: dke on February 26, 2008, 02:42:39 pm
Nice modification but is it possible to make this restriction certain categories/albums of choice so that parts of the gallery can be viewed by guests surpassing the 10 limit?
Title: Re: Register After viewing 10 images or more.
Post by: Halfhidden on March 03, 2008, 03:58:42 pm
I've bridged Coppermine with phpbb3 will this mod still work for me please.
Regards,
Steff
Title: Re: Register After viewing 10 images or more.
Post by: Nibbler on March 03, 2008, 04:09:24 pm
No reason why it shouldn't.
Title: Re: Register After viewing 10 images or more.
Post by: Halfhidden on March 03, 2008, 04:10:28 pm
Thanks Nibbler I'll give it a shot and post the out come.
Regards,
Steff
Title: Re: Register After viewing 10 images or more.
Post by: Halfhidden on March 03, 2008, 04:24:02 pm
Yep! works a treat. but the login message is in blue and almost the same shade as the theme I'm using in Coppermine. From the line:
//your register messange
    $message = "<p align='center'><a href='register.php'><font size='5'>Please register<br> or login <br> to view all the files </font></a></p>";
Could you tell me where the text colour would be please? I'd like to change it to black or white.
Regards,
Steff
Title: Re: Register After viewing 10 images or more.
Post by: its2xs on February 16, 2009, 03:23:30 pm
thank you adiboy
works a treat ;D
Title: Re: Register After viewing 10 images or more.
Post by: mWelle on June 08, 2009, 10:17:33 am
very good mod. how i can this modeficated for to the groups?

there are 3 usergroups, one unregistered, registered and power.

the possible number of views, I would like to use the registered group.
Title: Re: Register After viewing 10 images or more.
Post by: paquets on August 21, 2009, 05:50:59 pm
Very cool mod.
Is it possible to have it work with a function that would record ip addresses instead of having it work with a cookie? Users just can delete the cookie to view another 10 images. And so on...

Thanks again for a very useful mod!