I'm currently working on a CMS and got to a stage where I got the basic functions that I needed for it, so I decided to upload it to my server and test out if everything works on there, because everything did work on my localhost (XAMPP).
Now I keep getting this error when I log in, as I want the user to be re-directed to the index page when he logs in:
Warning: Cannot modify header information - headers already sent by (output started at $/MyCMS/registration.php:29) in $/MyCMS/includes/forms/login_form.php on line 10
I've looked around several posts of people that have had the same problem as I did, yet they always had some extra space or something which made the header fail.
Anyhow, here is the part of the registration.php
<?php
    session_start();
    require_once('includes/db_connect/config.php');
    require('includes/db_connect/database.inc.php');
    require_once('includes/functions/functions.php');
    if(isset($_POST['email-register']) && isset($_POST['password-register'])){
        $email = secureFormInput((isset($_POST['email-register']))) ? $_POST['email-register'] : '';
        $password = secureFormInput((isset($_POST['password-register']))) ? $_POST['password-register'] : '';
        if(checkIfExists($email)){
            header('location: ?status=user%20already%20exists');
        } else {
            doRegister($email,$password);
        }
    }
    if(isLoggedIn()){
        header('location: index.php');
    };
?>
<!DOCTYPE html>
<html>
    <head>
        <title>MyCMS - register</title>
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <link href="styles/main.css" type="text/css" rel="stylesheet"/>
        <?php include('includes/bootstrap_links_for_head.php'); //line 29?>
    </head>
This is the bootstrap_links_for_head.hp, not sure if it's needed but since it throws the error on that part I'll just post it.
<link href="styles/bootstrap-theme.css" type="text/css" rel="stylesheet"/>
<link href="styles/bootstrap-theme.min.css" type="text/css" rel="stylesheet"/>
<link href="styles/bootstrap.css" type="text/css" rel="stylesheet"/>
<link href="styles/bootstrap.min.css" type="text/css" rel="stylesheet"/>
This is the login_form part that is throwing the error
if(isset($_POST['email']) && isset($_POST['password'])){
        $email = secureFormInput((isset($_POST['email']))) ? $_POST['email'] : '';
        $password = secureFormInput((isset($_POST['password']))) ? $_POST['password'] : '';
        // line 10
        header('location: index.php');
        doLogIn($email,$password);
    }
I've been trying ways to work around this problem but I can't seem to find the solution to this problem..
Hope someone could point out what I'm doing wrong here and tell me how to fix it.
Thanks in advance!
 
     
    