0
  <?php
include('security.php');

if (isset($_POST['login_btn'])) {
    $email_login = $_POST['email'];
    $password_login = $_POST['password'];

    $query = "SELECT * FROM register WHERE email='$email_login' AND password='$password_login' ";
    $query_run = mysqli_query($connection, $query);
    $usertypes = mysqli_fetch_array($query_run);

    if ($usertypes['usertype'] == "admin") {
        $_SESSION['username'] = $email_login;
        header('Location:/index.php');

    } else if($usertypes['usertype'] == "user"){
        $_SESSION['username'] = $email_login;
        header('Location:../index.php');

    }else{
        $_SESSION['status'] = "Email or Password is invalid";
        header('Location:login.php');
    }
}
?>

Warning: Cannot modify header information - headers already sent by (output started at /home/imvvsmcb/public_html/admin/database/dbconfig.php:1) in /home/imvvsmcb/public_html/admin/logincode.php on line 14

webprogrammer
  • 2,393
  • 3
  • 21
  • 27
  • May be you need exit call https://www.google.com/amp/s/www.geeksforgeeks.org/how-to-make-a-redirect-in-php/amp/ – estinamir Feb 17 '20 at 18:30
  • tried exit it still gives the same error, so on localhost the redirection works but as soon as l deploy it on a server it gives that warning –  Feb 17 '20 at 18:38
  • Please check this post https://stackoverflow.com/a/24928578/10634638 – estinamir Feb 17 '20 at 18:50

1 Answers1

1

thanks for all your help, l fixed it the problem is not in the file l though it was, the bug was in my dbconfig file l had a link to my css