Allowing only Registered users to view a page Allowing only Registered users to view a page
 

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]

Main Menu

Allowing only Registered users to view a page

Started by technima, July 09, 2006, 08:52:15 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

technima

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?

Stramm

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


Joachim Müller

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

Nibbler

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


technima

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

technima


VEGA

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/