forum.coppermine-gallery.net

No Support => Modifications/Add-Ons/Hacks => Mods: Miscellaneous => Topic started by: bit bit spears on January 31, 2004, 04:33:39 pm

Title: How do I make a login box display if the user isn't logged i
Post by: bit bit spears 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?
Title: How do I make a login box display if the user isn't logged i
Post by: Casper 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)'.
Title: How do I make a login box display if the user isn't logged i
Post by: Nibbler on February 01, 2004, 01:58:48 pm
if (USER_ID) should work
Title: Force log in.
Post by: Casper 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.
Title: it works AMAZINGLY!
Post by: bit bit spears 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!
Title: How do I make a login box display if the user isn't logged i
Post by: Casper 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.
Title: How do I make a login box display if the user isn't logged i
Post by: fuderyuu 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
Title: hide menus in login page
Post by: elzeviro 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
Title: How do I make a login box display if the user isn't logged i
Post by: Casper 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.
Title: How do I make a login box display if the user isn't logged i
Post by: elzeviro 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
Title: How do I make a login box display if the user isn't logged i
Post by: bit bit spears 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.
Title: How do I make a login box display if the user isn't logged i
Post by: elzeviro on February 25, 2004, 03:18:55 pm
excuse me... :oops: could you show me how to do?
thanks a lot!
Title: How do I make a login box display if the user isn't logged i
Post by: bit bit spears 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:)
Title: How do I make a login box display if the user isn't logged i
Post by: elzeviro on February 26, 2004, 12:01:30 pm
It works! great: thank you so much and excuse me for my insistence!
Title: How do I make a login box display if the user isn't logged i
Post by: bit bit spears on February 27, 2004, 12:15:40 am
it worked?!???
Title: How do I make a login box display if the user isn't logged i
Post by: Casper on February 27, 2004, 12:40:07 am
TB, you sound surprised.  Have a bit more faith in yourself  :wink:
Title: How do I make a login box display if the user isn't logged i
Post by: Leighm0 on March 24, 2004, 09:31:05 pm
i could do with this too.
Title: One error message: Fatal error : There was an error while pr
Post by: jarekn 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?
Title: How do I make a login box display if the user isn't logged i
Post by: Casper 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.
Title: How do I make a login box display if the user isn't logged i
Post by: Joachim Müller on April 02, 2004, 03:53:04 pm
@jarekn: you reported a login issue as well on the thread dealing with vbulletin integration!:evil: GauGau
Title: Sorry, not sure which one this is realated to...
Post by: jarekn on April 02, 2004, 04:00:00 pm
I think my issue is related to the integration with vBulletin...

I'll post more info there....

Here is the link for more info:


http://forum.coppermine-gallery.net/viewtopic.php?p=22024#22024
Title: Re: How do I make a login box display if the user isn't logged i
Post by: korn on April 25, 2004, 02:07:27 pm
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:)

I tried this and all of the links are gone except for "Album list". I am probably doing sth wrong...

Code: [Select]
<!-- BEGIN logout -->
<a href="{ALB_LIST_TGT}">{ALB_LIST_LNK}</a>
 <!-- END logout -->
Title: Re: How do I make a login box display if the user isn't logged i
Post by: Joachim Müller on April 25, 2004, 02:21:59 pm
you didn't do anything wrong - tb's idea just doesn't work that way.

GauGau
Title: Re: How do I make a login box display if the user isn't logged i
Post by: korn on April 25, 2004, 02:46:57 pm
you didn't do anything wrong - tb's idea just doesn't work that way.

GauGau

Is it possible to remove button "Album list" from the "first page" any other way?
Title: Re: How do I make a login box display if the user isn't logged i
Post by: Joachim Müller on April 25, 2004, 11:28:35 pm
what's wrong with the album list? What will remain on the first page if you remove the album list? In theory, this is possible (by adding some if/then switches to index.php), but I can't see the point.

GauGau
Title: Re: How do I make a login box display if the user isn't logged i
Post by: korn on May 02, 2004, 11:15:37 am
Moving links (I do not want to see without logging in) under these span classes in theme.php

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

does not seem to work with theme mac_ox_x. Any idea why or what could I do not to show the links without logging in with this theme?
Title: Re: How do I make a login box display if the user isn't logged i
Post by: Joachim Müller on May 02, 2004, 11:44:11 am
if you want only registered users to be able to browse your gallery, take a look at http://coppermine.sourceforge.net/faq.php?q=registeredUsersOnly#registeredUsersOnly

GauGau
Title: Re: How do I make a login box display if the user isn't logged i
Post by: korn on May 02, 2004, 12:46:01 pm
I have already done that, but this does not help. I am talking about moving links to span classes, which works with other themes, but not with MAC_OX_X. Any idea why?
Title: Re: How do I make a login box display if the user isn't logged i
Post by: Joachim Müller on May 02, 2004, 10:49:07 pm
I have no idea what you're talking about. What's a span class? What links are supposed to show where when what happens?

GauGau
Title: Re: How do I make a login box display if the user isn't logged i
Post by: leshelle02 on July 27, 2004, 03:36:36 am
 ;D this script came in soo handy for me...thanx...you guys are great
Title: Re: How do I make a login box display if the user isn't logged i
Post by: omniscientdeveloper on July 27, 2004, 03:42:54 am
Quote
What's a span class?

LOL.  ;D

I think he's talking about using classes for <span> tags. ;)
Title: Re: How do I make a login box display if the user isn't logged i
Post by: Incite on July 27, 2004, 08:31:56 am
Quote
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.

How do i do that?
Title: Re: How do I make a login box display if the user isn't logged i
Post by: ElCool on October 11, 2004, 07:26:24 pm
I got the login box to display, so if you aren't logged in, it takes you there

thx a lot :)


now, another question:
what if the person who got there wants to register? there is no register button there
i'd have to be a registred user in order to login to my gallery now...

any suggestions?
Title: Re: How do I make a login box display if the user isn't logged i
Post by: Joachim Müller on October 11, 2004, 10:34:01 pm
there should be a register button in your navigation. If it isn't, you'll have to allow user registration (coppermine config).

Joachim
Title: Re: How do I make a login box display if the user isn't logged i
Post by: Joachim Müller on October 12, 2004, 08:31:06 am
[Moderation]
moved unrelated reply to http://forum.coppermine-gallery.net/index.php?topic=10802.0
[/Moderation]

Joachim
Title: Re: How do I make a login box display if the user isn't logged i
Post by: Arnoman on December 07, 2004, 04:22:34 pm
It's working perfectly! Thanks a lott!
Title: Re: How do I make a login box display if the user isn't logged i
Post by: Justttt on January 20, 2005, 03:47:09 pm
I got the login box to display, so if you aren't logged in, it takes you there

thx a lot :)


now, another question:
what if the person who got there wants to register? there is no register button there
i'd have to be a registred user in order to login to my gallery now...

any suggestions?

why dont you redirect it to your own login page like i have done

www.trippy-illusion.co.uk/album/ccc.php
Title: Re: How do I make a login box display if the user isn't logged i
Post by: sdl on May 29, 2005, 04:40:35 am
FYI, when I integrated/bridged SMF and Coppermine, my redirect to login.php no longer worked, because all logging in was taken over by SMF.  Even so, I really loved the hack.  I didn't want guests browsing the photos without logging in first.  

I needed to redirect to my index page for SMF, not my login page for Coppermine, so I changed the code to:

Code: [Select]
if (USER_ID){

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

   exit();
}}

...and it works like a champ!  If a user goes to my Coppermine installation, but isn't logged in, (s)he's bumped to the index file of SMF, one folder up in the root of the domain.