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. Link to comment https://forums.phpfreaks.com/topic/32428-solved-im-trying-to-write-a-php-script-that-says/ 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] ??? Link to comment https://forums.phpfreaks.com/topic/32428-solved-im-trying-to-write-a-php-script-that-says/#findComment-150670 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.. Link to comment https://forums.phpfreaks.com/topic/32428-solved-im-trying-to-write-a-php-script-that-says/#findComment-150673 Share on other sites More sharing options...
dcro2 Posted January 1, 2007 Share Posted January 1, 2007 Have you set any session variables? Link to comment https://forums.phpfreaks.com/topic/32428-solved-im-trying-to-write-a-php-script-that-says/#findComment-150675 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()). Link to comment https://forums.phpfreaks.com/topic/32428-solved-im-trying-to-write-a-php-script-that-says/#findComment-150677 Share on other sites More sharing options...
dcro2 Posted January 1, 2007 Share Posted January 1, 2007 So nothing's showing up? Link to comment https://forums.phpfreaks.com/topic/32428-solved-im-trying-to-write-a-php-script-that-says/#findComment-150680 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. Link to comment https://forums.phpfreaks.com/topic/32428-solved-im-trying-to-write-a-php-script-that-says/#findComment-150685 Share on other sites More sharing options...
forumnz Posted January 1, 2007 Author Share Posted January 1, 2007 anyone? Link to comment https://forums.phpfreaks.com/topic/32428-solved-im-trying-to-write-a-php-script-that-says/#findComment-150689 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] Link to comment https://forums.phpfreaks.com/topic/32428-solved-im-trying-to-write-a-php-script-that-says/#findComment-150692 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 Link to comment https://forums.phpfreaks.com/topic/32428-solved-im-trying-to-write-a-php-script-that-says/#findComment-150693 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.