PHP Web Host - Quality Web Hosting For All PHP Applications $35/month $250/year (Unlimited) - $25/month - 200,000 impressions - Your Ad Could be Here - Click For Details
  Login or Register
 • Home • Downloads • Your Account • Forums • 

View next topic
View previous topic


Google
 
Web RavenPHPScripts (This Site)
Post new topic   Reply to topic
Author Message
dezina
Theme Guru


Joined: Dec 26, 2002
Posts: 57
Location: UK

PostPosted: Tue Feb 24, 2004 2:44 pm Reply with quote Back to top

Raven has a great script to allow all visitors to view downloads but restrict actual download of files to registered users only. Is it possible to have this same option but for subscribed users only(as in PHPNuke 7.10) please?
TIA
View user's profile Send private message Visit poster's website
Raven
Site Admin/Owner


Joined: Aug 27, 2002
Posts: 16987
Location: Kansas

PostPosted: Wed Feb 25, 2004 8:44 pm Reply with quote Back to top

I haven't tried it yet, so ....

Find this code around line 1146 or so in Downloads/index.php
Code:
if (!is_user($user)&&in_array($lid,$lidArray)&&!is_admin($admin)) {
and modify it to
Code:
if (!paid()&&!is_admin($admin)) {
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger
dezina
Theme Guru


Joined: Dec 26, 2002
Posts: 57
Location: UK

PostPosted: Thu Feb 26, 2004 1:35 am Reply with quote Back to top

Thank You Raven, will test and report back Wink
View user's profile Send private message Visit poster's website
dezina
Theme Guru


Joined: Dec 26, 2002
Posts: 57
Location: UK

PostPosted: Thu Feb 26, 2004 2:22 am Reply with quote Back to top

Got this far... in /modules/Downloads/index.php...around line 1117
Code:
function getit($lid) {
// Add a new line of code for each $lid to block for Registered Users only
    $lidArray[] = 9999; // EXAMPLE!!!
    $lidArray[] = 1; // EXAMPLE!!!

    global $prefix, $dbi, $user, $admin;
    if (!is_user($user)&&in_array($lid,$lidArray)&&!is_admin($admin)) {
      $pagetitle = "- "._ACCESSDENIED."";
      include("header.php");
      title("$sitename: "._ACCESSDENIED."");
      OpenTable();
      echo "<center><b>"._RESTRICTEDAREA."</b><br><br>"
                      .""._MODULESSUBSCRIBER."";
                  if ($subscription_url != "") {
                     echo "<br>"._SUBHERE."";
                  }
            echo "<br><br>"._GOBACK."";
      CloseTable();
      include("footer.php");
      die();
   }

But it produces this
Quote:
You are trying to access a restricted area.

We are Sorry but this section of our site is for Subscribed Users Only.

[ Go Back ]
and not this
Quote:
You are trying to access a restricted area.

We are Sorry but this section of our site is for Subscribed Users Only.
You can subscribe to our services from here

[ Go Back ]

Subscription url is quoted on config.php.
Your first suggestion did not have any affect.
Any advice gratefully received Confused
View user's profile Send private message Visit poster's website
Raven
Site Admin/Owner


Joined: Aug 27, 2002
Posts: 16987
Location: Kansas

PostPosted: Thu Feb 26, 2004 1:37 pm Reply with quote Back to top

Make sure that the module is active for All Visitors. Then try this
Code:
function getit($lid) {
    global $prefix, $dbi, $user, $admin;
    $lid = intval($lid);
    $hits = intval($hits);
     if (!paid()&&!is_admin($admin)) {
       $pagetitle = "- "._ACCESSDENIED."";
       include("header.php");
       title("$sitename: "._ACCESSDENIED."");
       OpenTable();
      echo "<center><b>"._RESTRICTEDAREA."</b><br><br>"
                      .""._MODULESSUBSCRIBER.""
                      .""."<br>"._SUBHERE.""
                 .""."<br>"._GOBACK."";
       CloseTable();
       include("footer.php");
       die();
    }
    sql_query("update ".$prefix."_downloads_downloads set hits=hits+1 WHERE lid=$lid", $dbi);
    update_points(17);
    $result = sql_query("SELECT url FROM ".$prefix."_downloads_downloads WHERE lid='$lid'", $dbi);
    list($url) = sql_fetch_row($result, $dbi);
    Header("Location: $url");
}
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger
dezina
Theme Guru


Joined: Dec 26, 2002
Posts: 57
Location: UK

PostPosted: Thu Feb 26, 2004 2:27 pm Reply with quote Back to top

Looks great Raven, thanks, but where does
Code:
// Add a new line of code for each $lid to block for Registered Users only
    $lidArray[] = 9999; // EXAMPLE!!!
    $lidArray[] = 1; // EXAMPLE!!!

fit in so that individual files are available for subscribed users only, or have I missed something in your coding please Embarassed
View user's profile Send private message Visit poster's website
Raven
Site Admin/Owner


Joined: Aug 27, 2002
Posts: 16987
Location: Kansas

PostPosted: Thu Feb 26, 2004 2:34 pm Reply with quote Back to top

You don't need that any longer because to download you must be a subscriber which means you already are registered.
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger
dezina
Theme Guru


Joined: Dec 26, 2002
Posts: 57
Location: UK

PostPosted: Fri Feb 27, 2004 1:13 am Reply with quote Back to top

Quote:
You don't need that any longer because to download you must be a subscriber which means you already are registered.

Why did I doubt you. Wink Your last set of code works perfectly.
Carrying this on a stage further, if possible please, what code would need to be added so that majority of files in downloads are for all users only, but maybe only 2 or 3 download files are available just to subscribers? TIA
View user's profile Send private message Visit poster's website
Raven
Site Admin/Owner


Joined: Aug 27, 2002
Posts: 16987
Location: Kansas

PostPosted: Fri Feb 27, 2004 5:17 am Reply with quote Back to top

Try this. It's very early here and I haven't tested it Smile
Code:
function getit($lid) {
// Add a new line of code for each $lid to block for Registered Users only
    $lidArray[] = 9999; // EXAMPLE!!!
    $lidArray[] = 1; // EXAMPLE!!!
    global $prefix, $dbi, $user, $admin;
    $lid = intval($lid);
    $hits = intval($hits);
    if (in_array($lid,$lidArray)&&!paid()&&!is_admin($admin)) {
       $pagetitle = "- "._ACCESSDENIED."";
       include("header.php");
       title("$sitename: "._ACCESSDENIED."");
       OpenTable();
      echo "<center><b>"._RESTRICTEDAREA."</b><br><br>"
                      .""._MODULESSUBSCRIBER.""
                      .""."<br>"._SUBHERE.""
                 .""."<br>"._GOBACK."";
       CloseTable();
       include("footer.php");
       die();
    }
    sql_query("update ".$prefix."_downloads_downloads set hits=hits+1 WHERE lid=$lid", $dbi);
    update_points(17);
    $result = sql_query("SELECT url FROM ".$prefix."_downloads_downloads WHERE lid='$lid'", $dbi);
    list($url) = sql_fetch_row($result, $dbi);
    Header("Location: $url");
}


Last edited by Raven on Fri Feb 27, 2004 5:54 am; edited 1 time in total
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger
dezina
Theme Guru


Joined: Dec 26, 2002
Posts: 57
Location: UK

PostPosted: Fri Feb 27, 2004 5:49 am Reply with quote Back to top

Code:
if (in_array($lid,$lidArray&&!paid()&&!is_admin($admin)) {

Think that line above is not quite correct with the following showing
Quote:
parse error on line 1124
View user's profile Send private message Visit poster's website
Raven
Site Admin/Owner


Joined: Aug 27, 2002
Posts: 16987
Location: Kansas

PostPosted: Fri Feb 27, 2004 5:53 am Reply with quote Back to top

Code:
if (in_array($lid,$lidArray)&&!paid()&&!is_admin($admin)) {
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger
dezina
Theme Guru


Joined: Dec 26, 2002
Posts: 57
Location: UK

PostPosted: Fri Feb 27, 2004 6:05 am Reply with quote Back to top

Perfect now.. Thank You Very Happy
View user's profile Send private message Visit poster's website
Display posts from previous:       
Post new topic   Reply to topic

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Forums ©
 

All logos and trademarks in this site are property of their respective owner.
The comments are property of their posters, all the rest © 2002-2011 by Raven

You can syndicate our news using the file xml

CSE HTML Validator Helped Clean up This Page! [Valid RSS] valid RSS 2.0 Valid robots.txt Stop Spam Harvesters, Join Project Honey Pot

Website engines core code is © copyright by PHP-Nuke but has been heavily patched and modified by myself and others.
PHP-Nuke is a free software released under the GNU/GPL.


:: fisubice phpbb2 style by Daz :: PHP-Nuke theme by www.nukemods.com ::
:: fisubice Theme Modified by the RavenNuke™ Team ::

:: W3C CSS Compliance Validation :: W3C HTML 4.01 Transitional Compliance Validation ::

zerosum