Rifts Posted November 6, 2009 Share Posted November 6, 2009 Hey Everyone.. Here is what is going on... on my website I have a login on the top rightish after someone logs in I want that login form to go away and have other information there. I'm not really sure where to even start with this. (everything else is done in terms of the actual login with php/mysql works and stuff.) Quote Link to comment https://forums.phpfreaks.com/topic/180589-hard-question-hope-you-have-time/ Share on other sites More sharing options...
JAY6390 Posted November 6, 2009 Share Posted November 6, 2009 if($_SESSION['logged_in'] == true) { ?>HTML HERE FOR LOGGED IN<?php }else{ ?>HTML FOR NOT LOGGED IN HERE<?php } Quote Link to comment https://forums.phpfreaks.com/topic/180589-hard-question-hope-you-have-time/#findComment-952754 Share on other sites More sharing options...
Rifts Posted November 6, 2009 Author Share Posted November 6, 2009 so i put this where my current login form is? or where do i actually place this code Quote Link to comment https://forums.phpfreaks.com/topic/180589-hard-question-hope-you-have-time/#findComment-952761 Share on other sites More sharing options...
JAY6390 Posted November 6, 2009 Share Posted November 6, 2009 Yep replace the HTML where the current login box is and then put that html into the second part of my code (in place of HTML FOR NOT LOGGED IN HERE) Quote Link to comment https://forums.phpfreaks.com/topic/180589-hard-question-hope-you-have-time/#findComment-952762 Share on other sites More sharing options...
Rifts Posted November 6, 2009 Author Share Posted November 6, 2009 im getting Notice: Undefined variable: _SESSION in C:\wamp\www\Copy of homepage\index.php on line 188 Quote Link to comment https://forums.phpfreaks.com/topic/180589-hard-question-hope-you-have-time/#findComment-952771 Share on other sites More sharing options...
JJ2K Posted November 6, 2009 Share Posted November 6, 2009 You need to change 'logged_in' to whatever the name your login script uses It looks as if it's probably using cookies anyhow rather than sessionsbecause you're getting the error because you need session_start(); at the top of the document (but it would have this anyway if it was using sessions). Quote Link to comment https://forums.phpfreaks.com/topic/180589-hard-question-hope-you-have-time/#findComment-952778 Share on other sites More sharing options...
Rifts Posted November 6, 2009 Author Share Posted November 6, 2009 all of my php exec scripts have session_start(); at the tops Quote Link to comment https://forums.phpfreaks.com/topic/180589-hard-question-hope-you-have-time/#findComment-952784 Share on other sites More sharing options...
Maq Posted November 6, 2009 Share Posted November 6, 2009 im getting Notice: Undefined variable: _SESSION in C:\wamp\www\Copy of homepage\index.php on line 188 Could you post some of the relevant code? Quote Link to comment https://forums.phpfreaks.com/topic/180589-hard-question-hope-you-have-time/#findComment-952786 Share on other sites More sharing options...
Rifts Posted November 6, 2009 Author Share Posted November 6, 2009 Here is the code I put where my login form is... I have tried changing "login" to "$login" as that is what it is in my login-exec im just trying to get it to say "HTML FOR NOT LOGGED IN HERE". Im not going to mess around and put the actual login form there untill it says that without errors.. <?php session_start(); if($_SESSION['login'] == true) { ?>HTML HERE FOR LOGGED IN<?php }else{ ?>HTML FOR NOT LOGGED IN HERE<?php } ?> Quote Link to comment https://forums.phpfreaks.com/topic/180589-hard-question-hope-you-have-time/#findComment-952787 Share on other sites More sharing options...
JAY6390 Posted November 6, 2009 Share Posted November 6, 2009 if(isset($_SESSION['login']) && $_SESSION['login'] == true) { Try that Quote Link to comment https://forums.phpfreaks.com/topic/180589-hard-question-hope-you-have-time/#findComment-952790 Share on other sites More sharing options...
Rifts Posted November 6, 2009 Author Share Posted November 6, 2009 you are a pimp!! that worked! thank you now to implementing my login form! Quote Link to comment https://forums.phpfreaks.com/topic/180589-hard-question-hope-you-have-time/#findComment-952791 Share on other sites More sharing options...
JAY6390 Posted November 6, 2009 Share Posted November 6, 2009 lol a pimp indeed haha have fun! Quote Link to comment https://forums.phpfreaks.com/topic/180589-hard-question-hope-you-have-time/#findComment-952792 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.