Hello,
I've been working on this for countless hours now, to the point that I think I'm about to cry.
As with so many other people, I've encountered the incredibly bothersome "cannot modify headers" problem:
Warning: Cannot modify header information - headers already sent by (output started at /home/doki/public_html/hetalia/admin2.php:1) in /home/doki/public_html/hetalia/password_protect.php on line 184
I've already checked for white spaces and there aren't any. I wonder if it's because I'm trying to combine so many different scripts and I have no idea what I'm doing. admin2.php is supposed to have a password form and then upon entering the correct password, it opens and displays another text file (which I have working).
These are the first two lines of admin2.php
<?php include("/home/doki/public_html/hetalia/password_protect.php");
include ('pagestop.txt'); //regular text file with header info like <html>..<body>
//below this is code for opening & displaying another .txt
This was originally line 184 of password_protect.php, and after I // out the line as I read under the comments on the main page, the line of error changed to 158.
setcookie("verify", md5($lp), $timeout, '/');
These are lines 157-158 of password_protect.php
// set cookie if password was validated
setcookie("verify", md5($login.'%'.$pass), $timeout, '/');
After I commented out line 158, the headers problem disappeared. But then, naturally, it wouldn't remember any cookies and I would have to re-enter the password each time which is tiresome!
Please help, somebody! I can also email my entire PHP codes and also give the URL to show the problem.