Advanced search  

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]

Pages: [1] 2   Go Down

Author Topic: How do I make a login box display if the user isn't logged i  (Read 30367 times)

0 Members and 1 Guest are viewing this topic.

bit bit spears

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 240
    • TangibleBrit.com
How do I make a login box display if the user isn't logged i
« on: January 31, 2004, 04:33:39 pm »

How do I make a login box display if the user isn't logged in? Like ~> i have this front page of the gallery, and i want it to ask you for your username and password if you are not logged in, and if you are (when you come to that page) then it will say, Welcome, please enter the gallery. or something?
« Last Edit: May 06, 2006, 07:15:35 am by GauGau »
Logged

Casper

  • VIP
  • Coppermine addict
  • ***
  • Country: 00
  • Offline Offline
  • Gender: Male
  • Posts: 5231
How do I make a login box display if the user isn't logged i
« Reply #1 on: January 31, 2004, 11:14:06 pm »

I'm trying to code this, and I got most of it to work, except I can't get the if() code right.

Can anyone tell me how to do the test 'if(user_logged_on)'.
Logged
It has been a long time now since I did my little bit here, and have done no coding or any other such stuff since. I'm back to being a noob here

Nibbler

  • Guest
How do I make a login box display if the user isn't logged i
« Reply #2 on: February 01, 2004, 01:58:48 pm »

if (USER_ID) should work
Logged

Casper

  • VIP
  • Coppermine addict
  • ***
  • Country: 00
  • Offline Offline
  • Gender: Male
  • Posts: 5231
Force log in.
« Reply #3 on: February 01, 2004, 03:49:02 pm »

Thanks nibbler.  I had tried that, and it didn't work, but I've now discovered my other code was causing it.

I have made this code work on my test site, but it is not otherwise tested, so back-up before trying.

To redirect an unlogged user to the login.php.

Open index.php.

find;
Code: [Select]
/**
 * Local functions definition
 */


Add, after it;

Code: [Select]
if (USER_ID){

 } else {
{
    $redirect = $redirect . "login.php";
        header("Location: $redirect");

    exit();
}}

 

Open displayimage.php.

find;
Code: [Select]
require('include/init.inc.php');

Add after;
Code: [Select]
if (USER_ID){

} else {
{
    $redirect = $redirect . "login.php";
        header("Location: $redirect");

    exit();
}}



Now do the same for thumbnails.php, and search.php.
Logged
It has been a long time now since I did my little bit here, and have done no coding or any other such stuff since. I'm back to being a noob here

bit bit spears

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 240
    • TangibleBrit.com
it works AMAZINGLY!
« Reply #4 on: February 02, 2004, 12:59:45 am »

OMG you are a saint! Thanks a lot casper! i really want to thank you for all of your hard work on here! you are a nice guy who got me virtually everything i wanted!
Logged

Casper

  • VIP
  • Coppermine addict
  • ***
  • Country: 00
  • Offline Offline
  • Gender: Male
  • Posts: 5231
How do I make a login box display if the user isn't logged i
« Reply #5 on: February 02, 2004, 01:17:23 pm »

Hi tb,

I think what you are asking is easily achievable, by creating a new file, let's call it 'welcome.php' which has the welcome page you want, and then adding a re-direct to the logged in user, BUT the hard bit may be to make it only work the first time someone goes to the index page each visit to your site.

You don't want it to happen when a logged on user goes from thumbnail.php to index.php, just when they come from outside the site.

I think it would be easier to change the cookie settings, so that when someone actually leaves, they are automatically logged out, then when they come back, they will go straight to the login page.

The welcome everyone already gets when logging on can be changed to what you want.
Logged
It has been a long time now since I did my little bit here, and have done no coding or any other such stuff since. I'm back to being a noob here

fuderyuu

  • Coppermine newbie
  • Offline Offline
  • Posts: 2
How do I make a login box display if the user isn't logged i
« Reply #6 on: February 12, 2004, 01:38:28 am »

You ARE a god send.. this has to be placed as a sticky  cause this is great!
MANY THANKS
Logged

elzeviro

  • Coppermine newbie
  • Offline Offline
  • Posts: 4
hide menus in login page
« Reply #7 on: February 25, 2004, 12:07:55 am »

Hi all, I made login page the default page for my gallery (as descripted in http://forum.coppermine-gallery.net/index.php?topic=3503). How can I hide menus (album list, favorites... login) ONLY from the login page? But I'd like t display these menus in the user pages... deleting them from the theme.php file is not good...
thanks
Logged

Casper

  • VIP
  • Coppermine addict
  • ***
  • Country: 00
  • Offline Offline
  • Gender: Male
  • Posts: 5231
How do I make a login box display if the user isn't logged i
« Reply #8 on: February 25, 2004, 12:47:51 am »

provided you completed the mod, including doing it to thumbnails.php and search.php, it does not matter that the links are there, because they also redirect to login.php.
Logged
It has been a long time now since I did my little bit here, and have done no coding or any other such stuff since. I'm back to being a noob here

elzeviro

  • Coppermine newbie
  • Offline Offline
  • Posts: 4
How do I make a login box display if the user isn't logged i
« Reply #9 on: February 25, 2004, 01:03:52 pm »

I made all the mod in thumbnails.php or search.php but the main menus (login, album list, favorites etc.) are still there in the login page...
I would like that only registered users could see these menus
Logged

bit bit spears

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 240
    • TangibleBrit.com
How do I make a login box display if the user isn't logged i
« Reply #10 on: February 25, 2004, 01:44:16 pm »

I think you would need to move these under a certain span class in order to be only shown if you are logged in. What I did was take all of the stuff out of the menu, but login and logout, and made a frame page that would use redirection if the user was logged in.
Logged

elzeviro

  • Coppermine newbie
  • Offline Offline
  • Posts: 4
How do I make a login box display if the user isn't logged i
« Reply #11 on: February 25, 2004, 03:18:55 pm »

excuse me... :oops: could you show me how to do?
thanks a lot!
Logged

bit bit spears

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 240
    • TangibleBrit.com
How do I make a login box display if the user isn't logged i
« Reply #12 on: February 26, 2004, 04:53:24 am »

ok-i am not sure this works-but it might.

i would just move all of the links or whatever you don't want to be displayed without logging in under these span classes in theme.php

Code: [Select]
<!-- BEGIN logout -->
<a href="{LOGOUT_TGT}">{LOGOUT_LNK}</a>
<!-- END logout -->


Move them into that span class:

Code: [Select]
<!-- BEGIN logout -->
 <!-- END logout -->


please be sure to back up-because i am not certain that this will work:)
Logged

elzeviro

  • Coppermine newbie
  • Offline Offline
  • Posts: 4
How do I make a login box display if the user isn't logged i
« Reply #13 on: February 26, 2004, 12:01:30 pm »

It works! great: thank you so much and excuse me for my insistence!
Logged

bit bit spears

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 240
    • TangibleBrit.com
How do I make a login box display if the user isn't logged i
« Reply #14 on: February 27, 2004, 12:15:40 am »

it worked?!???
Logged

Casper

  • VIP
  • Coppermine addict
  • ***
  • Country: 00
  • Offline Offline
  • Gender: Male
  • Posts: 5231
How do I make a login box display if the user isn't logged i
« Reply #15 on: February 27, 2004, 12:40:07 am »

TB, you sound surprised.  Have a bit more faith in yourself  :wink:
Logged
It has been a long time now since I did my little bit here, and have done no coding or any other such stuff since. I'm back to being a noob here

Leighm0

  • Coppermine newbie
  • Offline Offline
  • Posts: 1
How do I make a login box display if the user isn't logged i
« Reply #16 on: March 24, 2004, 09:31:05 pm »

i could do with this too.
Logged

jarekn

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 47
One error message: Fatal error : There was an error while pr
« Reply #17 on: April 02, 2004, 03:38:09 pm »

The login works fine on the first attempt, but after I log out and try going back to the forum, instead of being redirected to the login page I get the following error message:

Fatal error : There was an error while processing a database query

If I delete cookies and temp files the redirection to the login page works fine.

Any ideas?
Logged

Casper

  • VIP
  • Coppermine addict
  • ***
  • Country: 00
  • Offline Offline
  • Gender: Male
  • Posts: 5231
How do I make a login box display if the user isn't logged i
« Reply #18 on: April 02, 2004, 03:47:44 pm »

Did you do the basic mod, or did you apply tb's changes as well?
Log in, and turn on debug mode in config, and report what it says when the problem happens.

Edit;  I just saw your other post, and you are bridged with VB3, and I suspect this is to dowith that, and the 'remember me' issue.
Logged
It has been a long time now since I did my little bit here, and have done no coding or any other such stuff since. I'm back to being a noob here

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47844
  • aka "GauGau"
    • gaugau.de
How do I make a login box display if the user isn't logged i
« Reply #19 on: April 02, 2004, 03:53:04 pm »

@jarekn: you reported a login issue as well on the thread dealing with vbulletin integration!
  • Do not double-post!
  • login issues differ for standalone and bbs-integrated coppermine. Specify your version and post on the appropriate thread only!
:evil: GauGau
« Last Edit: September 15, 2004, 10:58:14 pm by GauGau »
Logged
Pages: [1] 2   Go Up
 

Page created in 0.027 seconds with 21 queries.