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

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

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/