I was working on some code for my new site with my friend "Dan" (who knows way more about php than I), and I made it possible for users to log in. In the login page, he told me to add the following lines of code.
session_register(sessionuser,sessionpw,sessionemail,sessionlevel);
$sessionuser=$username;
$sessionpw=$password;
$sessionemail=$myrow['email'];
$sessionlevel=$myrow['adminlevel'];
He said "basically what a session is, is a cookie that is saved on the server so that it is more secure. and its easier to use than cookies. but it makes the variables you specify global, and they become accessable anywhere the session_start() is"
So, I added it. Except now when I tried to log in, it gave me an error below where I had it say "Log in successful. Click here to continue". It still said Log in successful though. The error was
"Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /home/dirt/public_html/login.php:6) in /home/dirt/public_html/login.php on line 7
Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/dirt/public_html/login.php:6) in /home/dirt/public_html/login.php on line 7"
Well, Dan had to go, so I figured I'd talk to you guys. What exactly can I do to fix this? And is the session necessary? Thanks.