mysql - include and header php advice -
im building first dynamic site. have index.php based on whether following session variable true or false
if($_session['loggedin']) { include 'logged-in/logged-in.php'; } else{ include 'not-logged-in/not-logged-in.php'; }
the not-logged-in.php displays forms can either login or register calls function within included php file. if login() function validates via login via mysql sets
$_session['loggedin'] = 1; header("location: ../index.php");
i error...
warning: cannot modify header information - headers sent (output started @ //index.php:8) in //not-logged-in/not-logged-in.php on line 5
sorry '*' out url keep project private. come simple graphics programming background , new me. tips or advice appreciated.
this error caused having output browser, either echo, print, etc. before call header()
.
personally wouldn't use session variable store whether user logged in or not because may want disable user, , if they're logged in still have access until session expires. store username , hashed password in session , re-run login procedure, using these details, each page.
Comments
Post a Comment