php - Header doesn't work in combination with session_start? -


to avoid illegal use check login status @ beginning of code. follows:

if (!isset($_session['loggedin'])){   header('location:http://www.name.nl/prg/login.php');   exit(); }  

this works. if use code first doesn't work.

ini_set('session.save_path',realpath(dirname($_server['document_root'])).'/name.nl/tmp'); session_start(); if (!isset($_session['loggedin'])){   header('location:http://www.name.nl/prg/login.php');   exit(); }  

am missing something? looked 2 days now, can't find reason/solution. seems me header function should work after ini_set , session_start. mean common code?

try first: ini_set('session.save_path',realpath(dirname($_server['document_root']).'/name.nl/tmp'));

(move parentheses)

try looking here: http://php.net/manual/en/function.session-save-path.php

not sure if or not seems related session folder @ , pointing proper directory/folder in code.

the solution worked them: ini_set('session.save_path',realpath(dirname($_server['document_root']) . '/../session'));

your current session save:

ini_set('session.save_path',realpath(dirname($_server['document_root'])).'/name.nl/tmp');


Comments

Popular posts from this blog

javascript - Bootstrap Popover: iOS Safari strange behaviour -

Magento/PHP - Get phones on all members in a customer group -

session - Logging Out Using PHP -