coppermine-gallery.com/forum

Support => cpg1.4.x Support => Older/other versions => cpg1.4 permissions => Topic started by: technima on July 09, 2006, 08:52:15 AM

Title: Allowing only Registered users to view a page
Post by: technima 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?
Title: Re: Allowing only Registered users to view a page
Post by: Stramm on July 09, 2006, 09:03:55 AM
add this php code at top of that page (needs to be a php page)

<?php
define
('IN_COPPERMINE'true);
require(
'include/init.inc.php'); 
if (!
USER_IDcpg_die(ERROR$lang_errors['access_denied'], __FILE____LINE__);
?>

Title: Re: Allowing only Registered users to view a page
Post by: Joachim Müller on July 09, 2006, 11:35:49 AM
Drawback: will only work if that page resides within Coppermine's root folder...
Title: Re: Allowing only Registered users to view a page
Post by: Nibbler on July 09, 2006, 02:16:47 PM
For pages outside coppermine...


<?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__);
?>

Title: Re: Allowing only Registered users to view a page
Post by: technima 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
Title: Re: Allowing only Registered users to view a page
Post by: technima on July 10, 2006, 07:00:48 AM
Never mind I figured it out.

Thank you!
Title: Re: Allowing only Registered users to view a page
Post by: VEGA on October 23, 2008, 07:20:31 PM
Quote from: Nibbler on July 09, 2006, 02:16:47 PM
For pages outside coppermine...


<?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/