PHP Warning: Cannot modify header information - headers already sent by
Publicado por user1 (30 intervenciones) el 15/12/2020 01:21:04
este funcionaba en localhost, pero ahora que esta en un hosting no funciona. por que es?
aqui esta el codigo
y este es el error que arroja:
[14-Dec-2020 20:55:31 America/Santiago] PHP Warning: Cannot modify header information - headers already sent by (output started at /home1/itjomeco/public_html/login(php)/dbcon.php:1) in /home1/itjomeco/public_html/login(php)/loginPass.php on line 12
aqui esta el codigo
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
<?php
include('dbcon.php');
$username = $_POST['username'];
$password = $_POST['password'];
$query = $conn->query("select * from user where username = '$username' and password = '$password'");
$count = $query->rowcount();
$row = $query->fetch();
if ($count > 0){
session_start();
$_SESSION['id'] = $row['id_user'];
header('location: ../home.php');
}else{
echo '
<script>
alert("El usuario o contraseña son incorrectos. Intentelo de nuevo");
window.location = "../login.php";
</script>
';
session_destroy();
die();
}
?>
y este es el error que arroja:
[14-Dec-2020 20:55:31 America/Santiago] PHP Warning: Cannot modify header information - headers already sent by (output started at /home1/itjomeco/public_html/login(php)/dbcon.php:1) in /home1/itjomeco/public_html/login(php)/loginPass.php on line 12
Valora esta pregunta


0