Search
Left Quote    It is possible to store the mind with a million facts and still be entirely uneducated.
- Alec Bourne    
Right Quote
 
[login] | [Register]
Forum Index » PHP and mySQL » Viewing Topic and Replies
Post Reply


        Viewing Topic: Help with Login
  This user is offline  wekiller
  Subject: "Help with Login" Posted: @ 1:25 pm on Oct 22 2008   
Member #: 773
Rank: User - (4)
Since: 10/22/08
Posts: 4

well il start out by saying hello to you all, hello
im new here hope i can contribute with stuf and learn stuf from you.

my problem right now is the member system. Register works perfectly.
but when i login how do i know that im am logged in or not because i want like this site that it says something like Welcome, "Name" ; Logout" and that i can eddit profile meaning changing password.


    Viewed: 8,878 Times | Reply to This | To top
  This user is offline  bs0d
  Subject: "re: Help with Login" Posted: @ 5:31 pm on Oct 22 2008    

Member #: 1
Rank: Admin. - (1,505)
Since: 02/06/05
Posts: 600
From: USA

When you're logged in, a cookie is set (if you select 'remember me') and session variables are set, such as:

  1. $_SESSI ON['logged_in ']
  2. $_SESS ION['username ']
You use these to identify the user, and display a link to the logout page, which is unset these variables and clear the session.




-bs0d | AllSyntax.com

    Viewed: 8,862 Times | Reply to This | To top
  This user is offline  wekiller
  Subject: "re: Help with Login" Posted: @ 6:12 pm on Oct 22 2008    
Member #: 773
Rank: User - (4)
Since: 10/22/08
Posts: 4

everything works perfect now really good tutorial man thnx

there is one more thing... i want a code that when im logged in

<?php
include('heade r.php');
if($_SESSION[' logged_in'] == 1)
{

>>>> ;>>>&g t;> Remove The Linking to Login and Register so that only Profile and Home is left<<< ;<<<&l t;<<
?>

how should i do that ? what is the code? could someone help me.?



Edited at 06:31:01 pm on 10/22/08


    Viewed: 8,858 Times | Reply to This | To top
  This user is offline  bs0d
  Subject: "re: Help with Login" Posted: @ 8:32 pm on Oct 22 2008    

Member #: 1
Rank: Admin. - (1,505)
Since: 02/06/05
Posts: 600
From: USA

It would be something like this:
Code:


<?
//check if user is logged in
if($_SESSION[' logged_in'] ==1) {
//display logout stuff

} else {
//display sign-in stuff
} //end if.
?>

Is that what you wanted? Just put the code within the condition in the appropriate places.




-bs0d | AllSyntax.com

    Viewed: 8,849 Times | Reply to This | To top
  This user is offline  wekiller
  Subject: "re: Help with Login" Posted: @ 8:42 pm on Oct 22 2008    
Member #: 773
Rank: User - (4)
Since: 10/22/08
Posts: 4

no i mean like

<?php
include('heade r.php');
if($_SESSION[' logged_in'] == 1)
{
visable=" false"< ;<a href="log in.php"&g t;Login</a&g t;
visable=" false"< ;<a href="reg ister.php" ;>Login</ a>
visable=" true"< a href="pro file.php" >Login</a >

}else{

visable=" true"< <a href="log in.php"&g t;Login</a&g t;
visable=" true"< <a href="reg ister.php" ;>Login</ a>
visable=" false"< ;a href="pro file.php" >Login</a >
}
?>

i just dont know the code to make "<a href="pro file.php" >Login</a > ect disaper/show u understand ? ^^


Visible*



Edited at 08:46:24 pm on 10/22/08


    Viewed: 8,844 Times | Reply to This | To top
  This user is offline  Genius
  Subject: "re: Help with Login" Posted: @ 9:45 pm on Oct 23 2008    

Member #: 582
Rank: User - (77)
Since: 02/18/08
Posts: 76
From: kmmk

Do something like this:

in header.php put something like this:


Code:

if ($_SESSION['lo gged_in'] ==1) {

$user_msg = "<a href=\"a ccount.php\&q uot;>My Account</a&g t;";

} else {

$user_msg = "<a href=\"l ogin\"&g t;Login Here</a> ";

}



then just echo $user_msg to whereever you would like it to appear.




    Viewed: 8,816 Times | Reply to This | To top
  This user is offline  bs0d
  Subject: "re: Help with Login" Posted: @ 11:59 pm on Oct 23 2008    

Member #: 1
Rank: Admin. - (1,505)
Since: 02/06/05
Posts: 600
From: USA

yes, echo(); is what you're looking for.




-bs0d | AllSyntax.com

    Viewed: 8,813 Times | Reply to This | To top
  This user is offline  wekiller
  Subject: "re: Help with Login" Posted: @ 6:00 am on Oct 24 2008    
Member #: 773
Rank: User - (4)
Since: 10/22/08
Posts: 4

Thank u so much




    Viewed: 8,811 Times | Reply to This | To top
Viewing Page: 1 of 1


1 |

You must be logged in to post on the forums. Login or Register








"AllSyntax.com" Copyright © 2002-2018; All rights lefted, all lefts righted.
Privacy Policy  |  Internet Rank