Advanced search  

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Pages: [1]   Go Down

Author Topic: Allowing only Registered users to view a page  (Read 5417 times)

0 Members and 1 Guest are viewing this topic.

technima

  • Coppermine newbie
  • Offline Offline
  • Posts: 5
Allowing only Registered users to view a page
« on: July 09, 2006, 08:52:15 am »

I have a page outside of coppermine with private information that I want only registered users to be able to view. How do i do that?
« Last Edit: July 10, 2006, 07:44:20 am by GauGau »
Logged

Stramm

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: 00
  • Offline Offline
  • Gender: Male
  • Posts: 6006
    • Bettis Wollwelt
Re: Allowing only Registered users to view a page
« Reply #1 on: July 09, 2006, 09:03:55 am »

add this php code at top of that page (needs to be a php page)
Code: [Select]
<?php
define
('IN_COPPERMINE'true);
require(
'include/init.inc.php'); 
if (!
USER_IDcpg_die(ERROR$lang_errors['access_denied'], __FILE____LINE__);
?>

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Allowing only Registered users to view a page
« Reply #2 on: July 09, 2006, 11:35:49 am »

Drawback: will only work if that page resides within Coppermine's root folder...
Logged

Nibbler

  • Guest
Re: Allowing only Registered users to view a page
« Reply #3 on: July 09, 2006, 02:16:47 pm »

For pages outside coppermine...

Code: [Select]
<?php
define
('IN_COPPERMINE'true);
$d getcwd();
chdir('path/to/coppermine');
require(
'include/init.inc.php'); 
chdir($d);
if (!
USER_IDcpg_die(ERROR$lang_errors['access_denied'], __FILE____LINE__);
?>

Logged

technima

  • Coppermine newbie
  • Offline Offline
  • Posts: 5
Re: Allowing only Registered users to view a page
« Reply #4 on: July 10, 2006, 04:25:01 am »

I tried it but this is the error that i got.


Warning: chdir(): No such file or directory (errno 2) in /home/content/n/i/m/nimaasgari/html/photos/restricted/hi.php on line 4

Warning: main(include/init.inc.php): failed to open stream: No such file or directory in /home/content/n/i/m/nimaasgari/html/photos/restricted/hi.php on line 5

Warning: main(include/init.inc.php): failed to open stream: No such file or directory in /home/content/n/i/m/nimaasgari/html/photos/restricted/hi.php on line 5

Fatal error: main(): Failed opening required 'include/init.inc.php' (include_path='.:/usr/local/lib/php') in /home/content/n/i/m/nimaasgari/html/photos/restricted/hi.php on line 5
Logged

technima

  • Coppermine newbie
  • Offline Offline
  • Posts: 5
Re: Allowing only Registered users to view a page
« Reply #5 on: July 10, 2006, 07:00:48 am »

Never mind I figured it out.

Thank you!
Logged

VEGA

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 323
    • maranimage
Re: Allowing only Registered users to view a page
« Reply #6 on: October 23, 2008, 07:20:31 pm »

For pages outside coppermine...

Code: [Select]
<?php
define
('IN_COPPERMINE'true);
$d getcwd();
chdir('path/to/coppermine');
require(
'include/init.inc.php'); 
chdir($d);
if (!
USER_IDcpg_die(ERROR$lang_errors['access_denied'], __FILE____LINE__);
?>



if my gallery is in the root, and the page for registered users is in the folder called folder1 (root), the path is this?

httpdocs/
Logged
Pages: [1]   Go Up
 

Page created in 0.023 seconds with 19 queries.