coppermine-gallery.com/forum

Support => cpg1.4.x Support => Older/other versions => cpg1.4 permissions => Topic started by: tim18 on September 06, 2007, 07:43:27 AM

Title: Authenticate Users for Custom Content
Post by: tim18 on September 06, 2007, 07:43:27 AM
Hello,

I've made some custom pages that i really don't want guests to see, but rather only proper users.
Ive been looking through lots of the code to try and figure out what i need to add to my pages to make coppermine check for authentication on my custom pages.
The most frustrating thing is i remember reading a post from Gau Gau where he said something about authenticating users, but i simply cannot find it.
I'm fairly certain its not more than one line of code, as i believe most of coppermine's pages are authenticated.

If someone knows the code or the post on user authentication, please reply.

Thanks
Tim
Title: Re: Authenticate Users for Custom Content
Post by: Joachim Müller on September 06, 2007, 08:09:24 AM
Album properties (http://coppermine-gallery.net/demo/cpg14x/docs/index.htm#album_prop), change "Album can be viewed by" from "Everybody (public album)" to "Members of the registered group". Explained in the docs - please read before posting. No modification of the code needed.
Title: Re: Authenticate Users for Custom Content
Post by: tim18 on September 06, 2007, 08:18:13 AM
Sorry,

There is a misunderstanding.

I have created a "custom page", my own page that uses:

<?php
define
('IN_COPPERMINE'true);
require(
'include/init.inc.php');
pageheader('Main Forum');
include(
'source_main_forum.php');
pagefooter();
//(!USER_ID) {
?>


to create the menu system around my own content.

This is an entirely seperate page from the coppermine photo gallery. You wrote some code once that allowed a "custom page" to be authenticated.

Sorry for the misunderstanding.

Tim
Title: Re: Authenticate Users for Custom Content
Post by: Joachim Müller on September 06, 2007, 08:31:45 AM
To check if the visitor is logged in, try using the constant USER_ID:<?php
if (!USER_ID) {
  
// the visitor is a guest
  
cpg_die(ERROR$lang_errors['access_denied'], __FILE____LINE__);
}
?>
Title: Re: Authenticate Users for Custom Content
Post by: tim18 on September 06, 2007, 08:38:48 AM
Gau Gau,

This worked perfectly. I sincerely thank-you for your time!

Cheers
Tim