Trouble with session_regenerate_id(true)
Posted: Thu Apr 11, 2013 9:21 pm
I'm new to PHP. Have gotten a simple login system working. Each page has
at the top. base.php contains:
I do call several other php files during the course of things. It works fine, but I found here:
http://forums.devshed.com/php-developme ... 50530.html
that in order to prevent session hijacking, I should add a line to make my base.php file look like this:
Everything works fine except now I get a warning every time I execute any of my pages (all of them including this code at the top). The warning is this:
[text][11-Apr-2013 22:19:34 America/New_York] PHP Warning: session_regenerate_id(): Cannot regenerate session id - headers already sent in /home/tomsgood/public_html/base.php on line 3
[/text]
The searching I did on the web doesn't seem to help me find out why this warning is happening or how to stop it.
Code: Select all
<?php include "base.php";?>Code: Select all
<?php
session_start();
?>
http://forums.devshed.com/php-developme ... 50530.html
that in order to prevent session hijacking, I should add a line to make my base.php file look like this:
Code: Select all
<?php
session_start();
session_regenerate_id(true);
?>
[text][11-Apr-2013 22:19:34 America/New_York] PHP Warning: session_regenerate_id(): Cannot regenerate session id - headers already sent in /home/tomsgood/public_html/base.php on line 3
[/text]
The searching I did on the web doesn't seem to help me find out why this warning is happening or how to stop it.