This will probably be put down as a 'Duplicate' but I have read the top posts concerning this problem as sadly putting
session_start();
At the top didn't seem to work for me as that was the most suggested answer.
In addition to this, I uploaded this to my Website about 20 - 30 minutes ago but it was working fine with Xammp, probably different PHP versions.
Here is my code and the errors:
Warning: session_start(): Cannot send session cookie - headers already sent by (output started at /home/corrupts/public_html/index.php:29) in /home/corrupts/public_html/pages/examples/session.php on line 2
Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /home/corrupts/public_html/index.php:29) in /home/corrupts/public_html/pages/examples/session.php on line 2
Warning: Cannot modify header information - headers already sent by (output started at /home/corrupts/public_html/index.php:29) in /home/corrupts/public_html/pages/examples/session.php on line 33
Code:
<?php
session_start();
include('config.php');
$user_check = $_SESSION['login_user'];
$ses_sql = mysqli_query($db,"select * from users where email = '$user_check' ");
$row = mysqli_fetch_array($ses_sql,MYSQLI_ASSOC);
$login_id = $row['id'];
$login_session = $row['email'];
$login_password = $row['password'];
$rank = $row['rank'];
$join_date = $row['joined'];
$bio = $row['bio'];
$credits = $row['credits'];
$adminlevel = $row['adminlevel'];
$banned = $row['banned'];
//Get stats
$ses_sql = mysqli_query($db,"select * from stats");
$row = mysqli_fetch_array($ses_sql,MYSQLI_ASSOC);
$sales = $row['sales'];
$members = $row['members'];
$vip = $row['vips'];
if(!isset($_SESSION['login_user'])){
header("location: login.php");
}
?>