forumnz Posted January 1, 2007 Share Posted January 1, 2007 "Login" if the user isnt logged in and "Logout" if they are.This is my script so far but it doesnt seem to be working...[code]<tr> <td width="5" height="29" bgcolor="#FFFFFF"> </td> <td width="751" background="images/bgblue.gif" bgcolor="#FFFFFF" class="login-view"> <div align="right" class="text style1"> <php? if (!$_SESSION['username']){echo('Log In');?> </div></td> <td width="4" bgcolor="#FFFFFF"> </td> </tr> <tr> <td height="398" colspan="3" bgcolor="#FFFFFF"> </td> </tr> <tr> <td colspan="3" bgcolor="#FFFFFF"> </td> </tr>[/code]Thanks. Quote Link to comment Share on other sites More sharing options...
dcro2 Posted January 1, 2007 Share Posted January 1, 2007 [code]if (!$_SESSION['username']){echo('Log In');} else {echo('Log Out');}?>[/code] ??? Quote Link to comment Share on other sites More sharing options...
forumnz Posted January 1, 2007 Author Share Posted January 1, 2007 Thanks,How do I put this within the HTML code?... yes I have saved it as a PHP file, but its not working... heres a small sample of the newly edited code...[code]<tr> <td width="5" height="29" bgcolor="#FFFFFF"> </td> <td width="751" background="images/bgblue.gif" bgcolor="#FFFFFF" class="login-view"> <div align="right" class="text style1"> <php? if (!$_SESSION['username']){echo('Log In');} else {echo('Log Out');}?> </div></td> <td width="4" bgcolor="#FFFFFF"> </td> </tr>[/code]Thanks a lot.. Quote Link to comment Share on other sites More sharing options...
dcro2 Posted January 1, 2007 Share Posted January 1, 2007 Have you set any session variables? Quote Link to comment Share on other sites More sharing options...
forumnz Posted January 1, 2007 Author Share Posted January 1, 2007 Yes... I think so... LOL.... People can login (MySQL) and they can also logout (session_destroy()). Quote Link to comment Share on other sites More sharing options...
dcro2 Posted January 1, 2007 Share Posted January 1, 2007 So nothing's showing up? Quote Link to comment Share on other sites More sharing options...
forumnz Posted January 1, 2007 Author Share Posted January 1, 2007 Nope nothing at all... Im using dreamweaver for this php script and in the properties window it displays an error message saying that '<?php' should be <?> because its not correct HTML... but i am doin this in PHP... also... i uploaded it to a server to test it but nothing happened. Quote Link to comment Share on other sites More sharing options...
forumnz Posted January 1, 2007 Author Share Posted January 1, 2007 anyone? Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted January 1, 2007 Share Posted January 1, 2007 In the code you posted above you have - [b]<php?[/b] - this should be [b]<?php[/b] Quote Link to comment Share on other sites More sharing options...
forumnz Posted January 1, 2007 Author Share Posted January 1, 2007 Ok thanks.... minor error.... or major... anyway.Its only saying login now... not logout when im logged in or anything Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.