html - Function in PHP to set cookie, for my login script -
i followed this guide attempt write login script hobby webpage.
problem when want incorporate page, problems occur.
i'm trying make admin panel.
in top of frame want login form be
when log in, i'd login form area
change logout fields
.
my problem cookie-related calls has done before html code starts...
so:
- when log in: content of page should displayed ( simple include ).
- when log in: login area changes logout area, hiding login fields , displaying name of user logged in...
- and when logging out: content , logout should disappear , show login fields again.
how can done (give examples pseudo code)?
ps. im not php nerd, still learning.
you write login data current session.
$_session["username"] = $user;
but don't forget call session_start() @ top of code.
after check whether "$_session["username"]" set data. if so, can change content whatever like.
example:
if (isset($_session['username']) && loginsuccessful()) { include("adminmenue.php"); }
loginsuccessful() should method checks whether login data can found in database.
more information sessions can found here.
Comments
Post a Comment