Jump to content

Need help getting a login slider to disappear when logged in


Zola

Recommended Posts

Hi all,

 

I have a problem I am not sure how to sort, hopefully someone here can help.

 

I have a sliding login panel on a website that I am making. Its quite discreet. I have a stripped down version here that you can see:

http://mgdesign.hostultra.com/login_test/login_test.php

 

On the page I am making, users with a log in enter their details and will be taken to the restricted page. I would like this sliding panel to be on every page when the user is not logged in.

 

Once they log in from the sliding panel they can still surf around all the main site pages. When they log out the session dies and it reverts to the home page.

 

However, when they are logged in I would like the sliding login panel to disappear from the top of each page. Is there any way I can do this simply?

 

Any help or advice would be greatly appreciated.

Link to comment
Share on other sites

not sure how you render your pages but you could do with a simple conditional and an include.

 

So when they log in you set a session variable to signify they've been authenticated and logged in.

 

Then you can just do something simple like

 


if (!isset($_SESSION['loggedin'])){

include('slide_login_header.php')

}

else {// either do nothing or include an alternate header]



Link to comment
Share on other sites

Hi,

 

sorry for the late reply, I was away all weekend.

 

I have code which I think we can tweak to make it work?

 

At the moment if the user logs in with wrong details PHP will take the user to a dedicated login / register / support page. The code to do this is:

 

if(!isset($_SESSION['name'])) {
header("Location: http://mylink");
}
?>

 

 

If I add this to the index page and tweak it a little could it work?

 

<?php if(!isset($_SESSION['name'])) {
include ('includes/login_panel.php'); 
}
?>

 

 

Link to comment
Share on other sites

I tried messing around with this, even adding the footer in to see if it was responding, but doesn't work:

 

 

<?php if(!isset($_SESSION['name'])) {
include ('includes/login_panel.php'); 
}


if(isset($_SESSION['name'])) {
include ('includes/footer.php');			   
}

?>

 

Anyone know why?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.