Authenticate Users for Custom Content Authenticate Users for Custom Content
 

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

Authenticate Users for Custom Content

Started by tim18, September 06, 2007, 07:43:27 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

tim18

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

Joachim Müller

Album properties, 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.

tim18

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

Joachim Müller

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

tim18

Gau Gau,

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

Cheers
Tim