logging - php - different design of webpage for logged in users -
i have 1 question. looked through 1 book , internet , unfortunately didn't find concrete answer. so... have webpage user can log in. if user logged in bar @ top of webpage different(user sees own photo, name etc.). know how use sessions&databases in case, don't know how make 2 different websites. mean.... in home site of whole webpage can write sth (in php):
if(isset($_session["user"])) ..... .
but then? should somehow hide html unlogged user in "else" , part logged user in "if" or should create whole new site logged in users , redirect site if user logged...? please, me.
it seems need spend little time looking php deeper. advice learn including php files in order create template system (so have base php file html/php on every page (like master page) include code:
if(isset($_session["user"])) { // code logged in user... } else { // code generic user... }
although rudimentary example, have global variable if need things on specific pages too. if have more specific question implementing it, feel free ask.
one cool thing can in php include html "inline". eg:
if(isset($_session["user"])) { ?> <p>welcome user! <?php echo $_session["user"]; ?></p> <?php } else { ?> <p>please login see features...</p> <?php } ?>
Comments
Post a Comment