la pagina checklogin.php è composta in questo modo:
Codice PHP:
<?php
$host=" "; // Host name
$username=" "; // Mysql username
$password=" "; // Mysql password
$db_name=" "; // Database name
$tbl_name=" "; // Table name
// Connect to server and select database
mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");
// username and password sent from form
$utente=$_POST['utente'];
$password=$_POST['password'];
// To protect MySQL injection (more detail about MySQL injection)
$utente = stripslashes($utente);
$password = stripslashes($password);
$utente = mysql_real_escape_string($utente);
$password = mysql_real_escape_string($password);
$sql="SELECT * FROM $tb1_name WHERE utente='$utente' and password='$password'";
$result=mysql_query($sql);
// Mysql_num_row is counting table row
$count=mysql_num_rows($result);
// If result matched $utente and $password, table row must be 1 row
if($count==1){
// Register $utente, $password and redirect to file "login_success.php"
session_register("utente");
session_register("password");
header("location:login_success.php");
}
else {
echo "non corretto nome utente o password";
}
?>
è corretta???
all'inizio nelle prime 5 righe devo inserire i dati del mio database mysql giusto?