ego Posted December 23, 2012 Share Posted December 23, 2012 Hi, a bit of help. Should be easy one for you, I am only newbie:) <?php if (empty($_SESSION['MM_Username'])) { if (empty($_SESSION['MM_Username'])) { echo "Login"; }else{ echo "Hello"; } } ?> <?php Trying to get Dreamweaver to show "Login" text, if nobody is logged in. Else "Hello" of logged in user. Upper code nicely showes "Login", but when I logg, nothing is howed. Tnx for your help. Link to comment https://forums.phpfreaks.com/topic/272307-if-not-logged-in-show-login-else-hello/ Share on other sites More sharing options...
Manixat Posted December 23, 2012 Share Posted December 23, 2012 that's because you are only processing the code if session mm_username is empty, remove the first IF should look like this if (empty($_SESSION['MM_Username'])) { echo "Login"; }else{ echo "Hello"; } Link to comment https://forums.phpfreaks.com/topic/272307-if-not-logged-in-show-login-else-hello/#findComment-1400980 Share on other sites More sharing options...
Christian F. Posted December 23, 2012 Share Posted December 23, 2012 I would strongly recommend you to scrap DreamWeaver, and use a proper IDE/editor for your PHP needs. The auto-generation for DW is crap, as with any other code generator tool: They simply cannot produce proper code, as applications don't understand the problem you're trying to solve. Programming is nothing but understanding and solving problems, and then translating said solution into a programming language so that the computer can replicate the necessary steps. Link to comment https://forums.phpfreaks.com/topic/272307-if-not-logged-in-show-login-else-hello/#findComment-1400987 Share on other sites More sharing options...
Manixat Posted December 23, 2012 Share Posted December 23, 2012 actually netBeans is intelligent enough Link to comment https://forums.phpfreaks.com/topic/272307-if-not-logged-in-show-login-else-hello/#findComment-1400990 Share on other sites More sharing options...
ego Posted December 23, 2012 Author Share Posted December 23, 2012 Manixat: tnx vm. I promisse to get more into basics before i ask simple stuff like this, but just had to write something of the top of my newbie mind:) Christian F: I agree with you. After I am done with proper learning i will for sure go and use some more specialized editors. Thanks again to you both. Enjoy coding. Link to comment https://forums.phpfreaks.com/topic/272307-if-not-logged-in-show-login-else-hello/#findComment-1400992 Share on other sites More sharing options...
Christian F. Posted December 23, 2012 Share Posted December 23, 2012 I would actually recommend doing away with it now, while you're learning. DW has an unfortunate habit of using some rather bad anti-patterns, and insecure code. Stuff which you do not want to pick up as a habit, as you will have to de-learn it afterwards. It's a lot harder to de-learn something, that it is to learn it in the first place, after all. You're welcome, btw, and have fun you too! Link to comment https://forums.phpfreaks.com/topic/272307-if-not-logged-in-show-login-else-hello/#findComment-1400995 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.