Jump to content

Hide Html With Php


HipT
 Share

Recommended Posts

Hi all.I'm doing a page login.phpIt's like so:

<table style="width: 27em;"><form name="loginForm" method="POST">				   <tr><td></td><td></td></tr>				   <tr><td colspan=2><b>Login</b></td></tr>				   <tr><td colspan=2><br /></td></tr>				   <tr><td align=left>Username:</td><td align=right><input name=txbUser id=txbUser type=text></td></tr>				   <tr><td align=left>Password:</td><td align=right><input name=txbPass id=txbPass type=password></td></tr>				   <tr><td colspan=2 align=center><input type=checkbox name=ckbCookies id=ckbCookies value=true>Remember me.</td></tr>				   <tr><td colspan=2><br /></td></tr>				   <tr><td colspan=2><input type="Submit" name="btLogin" id="btLogin" value="Login"></td></tr>				   <tr><td colspan=2><br /></td></tr>				   <tr><td colspan=2><br /></td></tr>				   <tr><td colspan=2><font size=1><a href="register.php">Create Account</a> / <a href="forgotPassword.php">Forgot password</a></font><br /></td></tr>		 </form></table>

Now,can i hide this part of page if user is already logged in php? For example

If(IsLogged){	  //say that the user is already logged}else{	 //print the login control with the posted code [b]withoud using "echo" for every line[/b].}

How can i do this?Thanks.

Link to comment
Share on other sites

<php// firs part of your pageif(isset($_COOKIE['session'])){// user logged in?><H1>you are logged in</H1><?}else{?><H1>please log in</H1><table style="width: 27em;"><form name="loginForm" method="POST">				   <tr><td></td><td></td></tr>				   <tr><td colspan=2><b>Login</b></td></tr>				   <tr><td colspan=2><br /></td></tr>				   <tr><td align=left>Username:</td><td align=right><input name=txbUser id=txbUser type=text></td></tr>				   <tr><td align=left>Password:</td><td align=right><input name=txbPass id=txbPass type=password></td></tr>				   <tr><td colspan=2 align=center><input type=checkbox name=ckbCookies id=ckbCookies value=true>Remember me.</td></tr>				   <tr><td colspan=2><br /></td></tr>				   <tr><td colspan=2><input type="Submit" name="btLogin" id="btLogin" value="Login"></td></tr>				   <tr><td colspan=2><br /></td></tr>				   <tr><td colspan=2><br /></td></tr>				   <tr><td colspan=2><font size=1><a href="register.php">Create Account</a> / <a href="forgotPassword.php">Forgot password</a></font><br /></td></tr>		 </form></table><?}?>

Edited by gar onn
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...