Randy Posted May 15, 2011 Share Posted May 15, 2011 windows 7 x64 php v 5.3.1 MySQL client version: 5.1.41 XAMPP for Windows 1.7.3 Any one have any modifications suggestions to the login script (script 4.3 page 146) to avoid the headers already sent warning? I'm using the downloaded script and am having issues figuring this one out. Warning: session_regenerate_id() [function.session-regenerate-id]: Cannot regenerate session id - headers already sent in C:\xampp\xampp\php\PEAR\Auth.php on line 830 Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\xampp\htdocs\PHP5Advanced\phpvqp2_scripts\Ch04\login.php:50) in C:\xampp\xampp\php\PEAR\Auth.php on line 85 Thanks Link to comment Share on other sites More sharing options...
Randy Posted May 15, 2011 Author Share Posted May 15, 2011 Okay, I found a solution on a different website. Move $auth->start() before the ?><!DOCTYPE as shown below. Any problems with this approach? $auth->start(); ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" /> <title>Restricted Page</title> </head> <body> <?php Link to comment Share on other sites More sharing options...
Larry Posted May 20, 2011 Share Posted May 20, 2011 I'll have to double-check my notes, but I believe that's a fine approach. Kudos for figuring it out and thanks for sharing. Another alternative is to enable output buffering on the server, I believe. Link to comment Share on other sites More sharing options...
Recommended Posts