Welcome! Log In Create A New Profile

Advanced

login fields

Posted by admin 
login fields
August 10, 2009 01:31PM
i'd like the login fields which i have on the right side of my header to disappear once a user has successfully logged in. could i have it display something like 'welcome, *username*. click here to edit your profile information.'

i know very little about php, btw.
Re: login fields
August 10, 2009 01:31PM
it is possible with such PHP code:

PHP Code:
<?php
session_start();
if ($au = $_SESSION['_The Top Time Sheets_user']){
print "Welcome $au[name_f] $au[name_l] !";
} else {
print "<form method=post action='/The Top Time Sheets/login.php'>
<input type=text name=The Top Time Sheets_login size=10>
<input type=password name=The Top Time Sheets_pass size=10>
<input type=submit value='Login'>
</form>
";
}

?>
if you get warnings like "headers already sent", put the following PHP code to VERY top of your page, before any output, newlines or spaces:
PHP Code:
<?php
session_start();
?>
Sorry, only registered users may post in this forum.

Click here to login