Welcome to HBH! If you have tried to register and didn't get a verification email, please using the following link to resend the verification email.

PHP Sessions


ghost's Avatar
0 0

When using a PHP session I'm getting the warning:

Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /home/www//profile.php:18) in /home/www//profile.php on line 25

and When I'm setting the session I'm using:

$_SESSION["name"] = $_POST["uname"];
$_SESSION["user_id"] = $res["id"];
$_SESSION["active"] = 1;```

Anyone know what I need to change/add?

spyware's Avatar
Banned
0 0

You need to add these:

-a search on PHP.net -a search on Google


ghost's Avatar
0 0

i like the google idea


ghost's Avatar
0 0

i believe u have to start the session in the first line


ghost's Avatar
0 0

i bet the session_start() isnt the first line of php code you have. put it there and your problems are solved.


ghost's Avatar
0 0

Put the session php code before you're html.

session blah blah
?>
<html>
<head>
...```

ghost's Avatar
0 0

Thanks alot guys. I knew it would be something simple like that. :D

Works lovely now :)