Salve, io ho un problema con i cookies.
Mi sono creato una porzione di codice che riporto di seguito:
---------------------------------------------------------------------------------
[...]
if($_SERVER['REQUEST_METHOD'] == "POST") {
$username = $_POST['username'];
$password = $_POST['password'];
$password_md5 = md5($password);
if($username && $password) {
$sql = "select username,password from utenti where username = '$username' and password='$password_md5'";
$sql = mysql_query($sql,$db_connection) or die ("ERROR");
if(mysql_num_rows($sql)==0) {
echo "PASSWOWRD o USERNAME ERRATI";
}
else
{
setcookie('user',$username,time()+3600);
$flag = false;
echo "OK";
}
}
[...]
---------------------------------------------------------------------------------
Se faccio andare questo script in php, mi vien scritto il seguente warning:
Warning: Cannot modify header information - headers already sent by (output started at C:\PROGRAMMI_MIEI\Apache_Web_Server\htdocs\login.p hp:23) in C:\PROGRAMMI_MIEI\Apache_Web_Server\htdocs\login.p hp on line 48
Quel che vorrei fare io é tenere traccia dell'utente che naviga nel mio sito.
Grazie a tutti per l'attenzione.
![]()
![]()