ho appena messo in piedi un webserver come descritto qui: php.html.it/guide/leggi/94/guida-php-su-windows/ e ho poi realizzato una pagina, collegata ad un DB, per l'accesso attraverso l'inserimento di username, email e password. Ecco il codice:
Il fatto è che sembra non prendere i valori passati attraverso la form, tant'è che mi restituisce i seguenti errori:codice:<? $user = $_POST['user']; $email = $_POST['email']; $password = $_POST['password']; $invia = $_POST['invia']; if ((!empty($user)) && (!empty($email)) && (!empty($password))) { $user_sec = htmlentities($user, ENT_QUOTES); $email = $_POST["email"]; $password = crypt ($password, 'cj'); $res = @mysql_query("SELECT * FROM users WHERE user = '".$user_sec."' AND email = '".$email."' AND password = '".$password."'"); if (@mysql_num_rows($res) != 0) { $db_data = @mysql_fetch_assoc($res); $id = $db_data["id"]; $user = $db_data["user"]; $password = $db_data["password"]; $email = $db_data["email"]; $lastseen = date ("Y-m-d G:i:s"); @mysql_query("UPDATE users SET LASTSEEN = '$lastseen' WHERE id = '$id'"); @setcookie("auth[0]", "$user", time()+36000); @setcookie("auth[1]", "$password", time()+36000); @header ("location: home.php"); } else $err_msg = "Username e/o Password errati!"; } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Control Panel</title> <style type="text/css"> <!-- @import url("style.css"); --> </style> </head> <body> <div id="all"> <div id="corpo"> <h2>Login</h2> Inserisci username e password per accedere <div style="color:#FF0000"><?=$err_msg?></div> <div style="color:#FF0000"><?=$invia?></div> <form action="login.php" method="post" > <table width="100%" border="0" cellspacing="4" cellpadding="1"> <tr> <td width="150" bgcolor="#eeeeee">Username</td> <td><input name="user" type="text" size="40" /></td> </tr> <tr> <td width="150" bgcolor="#eeeeee">Email</td> <td><input name="email" type="text" size="40" /></td> </tr> <tr> <td width="150" bgcolor="#eeeeee">Password</td> <td><input name="password" type="password" size="40" /></td> </tr> </table> <input type="hidden" name="invia" value="ok" /> <input type="submit" name="Submit" value="Accedi" /> </form> </div> </div> </body> </html>
Notice: Undefined index: user in C:\www\login.php on line 2
Notice: Undefined index: email in C:\www\login.php on line 3
Notice: Undefined index: password in C:\www\login.php on line 4
Notice: Undefined index: invia in C:\www\login.php on line 5
Come risolvo???
GRAZIE

Rispondi quotando
