samedi 30 juillet 2016

(PHP) How can i hide a login form from people that are logged in?

<?php
if (isset($_SESSION['username']))
{
}
else
{
   echo '<div id="DLogin1" style="position:absolute;left:76px;top:549px;width:183px;height:196px;z-index:22;">
<form name="loginform" method="post" accept-charset="UTF-8" action="<?php echo basename(__FILE__); ?>" id="loginform">
<input type="hidden" name="form_name" value="loginform"/>
<table id="TLogin1">
<tr>
   <td class="header">Log In</td>
</tr>
<tr>
   <td class="label"><label for="username">User Name:</label></td>
</tr>
<tr>
   <td class="row"><input class="input" name="username" type="text" id="username" value="<?php echo $username; ?>"/></td>
</tr>
<tr>
   <td class="label"><label for="password">Password:</label></td>
</tr>
<tr>
   <td class="row"><input class="input" name="password" type="password" id="password" value="<?php echo $password; ?>"/></td>
</tr>
<tr>
   <td class="row"><input id="rememberme" type="checkbox" name="rememberme"/><label for="rememberme">Remember me</label></td>
</tr>
<tr>
   <td style="text-align:center;vertical-align:bottom"><input class="button" type="submit" name="login" value="Log In" id="login"/></td>
</tr>
</table>
</form>
</div>';
}
?>

This is what i have so far, but it doesn't do what i think it should be doing...

Basically, I think that it should check to see if the username is set. If it is, nothing happens, otherwise it will make the login box appear.




Aucun commentaire:

Enregistrer un commentaire