ora l'indice è il cattivo:
<?php
require "config.php";
$cognome = $_COOKIE['user'];
$password = $_COOKIE['pass'];
$q = mysql_query("SELECT * FROM dipendenti WHERE cognome='$cognome' AND password='$password'", $con);
$n = mysql_affected_rows();
if($n == 1) echo "<META HTTP-EQUIV=\"REFRESH\" CONTENT=\"0; URL=gestione.php\">";
?>
<html>
<head>
<title>Area Dipendenti / Amministrativa</title>
<link rel="stylesheet" type="text/css" href="estilo.css" />
<link rel="stylesheet" type="text/css" href="sdmenu/sdmenu.css" />
<script type="text/javascript" src="tablecloth/tablecloth.js"></script>
</head>
<body>
<h2>Accesso all'Area Gestionale.</h2>
<?php
if($_POST['login']) {
require "config.php";
$cognome = $_POST['cognome'];
$password = $_POST['password'];
$q = mysql_query("SELECT * FROM dipendenti WHERE cognome='$cognome' AND password='$password'", $con);
$n = mysql_affected_rows();
if($n == 0) echo "<p align=\"center\">Errore durante il login, verificare i dati immessi.</p>";
else echo "<META HTTP-EQUIV=\"REFRESH\" CONTENT=\"0; URL=login.php?c=$cognome&p=$password\">";
}
?>
<p align="center">Effettua il login inserendo i tuoi dati. Non sei registrato? Clicka qui.</p>
<form method="post">
<table align="center" width="50px">
<tr>
<td>Cognome: <input type="text" name="cognome"></td>
</tr>
<tr>
<td>Password: <input type="password" name="password"></td>
</tr>
<tr>
<td><center><input type="submit" name="login" value="Accedi"></center></td>
</tr>
</table>
</form>
</body>
</html>
Gli errori sono:
Notice: Undefined index: user in C:\Programmi\EasyPHP 3.0\www\b\index.php on line 3
Notice: Undefined index: pass in C:\Programmi\EasyPHP 3.0\www\b\index.php on line 4
Notice: Undefined index: login in C:\Programmi\EasyPHP 3.0\www\b\index.php on line 22
Grazie a tutti davvero io lo sto studiando ma ste cose proprio non le riesco a fare è da 3 giorni che studio il php

Rispondi quotando