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?
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_ID) cpg_die(ERROR, $lang_errors['access_denied'], __FILE__, __LINE__);
?>
Drawback: will only work if that page resides within Coppermine's root folder...
For pages outside coppermine...
<?php
define('IN_COPPERMINE', true);
$d = getcwd();
chdir('path/to/coppermine');
require('include/init.inc.php');
chdir($d);
if (!USER_ID) cpg_die(ERROR, $lang_errors['access_denied'], __FILE__, __LINE__);
?>
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
Never mind I figured it out.
Thank you!
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_ID) cpg_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/