Codice PHP:
session_start();
include 'db.php';
$username = $_POST['username'];
$password = $_POST['password'];
if((!$username) || (!$password)){
echo "Please enter ALL of the information!
";
include 'index.htm';
exit();
}
$password = md5($password);
$sql = mysql_query("SELECT * FROM users WHERE username='$username' AND password='$password' AND activated='1'");
$login_check = mysql_num_rows($sql);
if($login_check > 0){
while($row = mysql_fetch_array($sql)){
foreach( $row AS $key => $val ){
$$key = stripslashes( $val );
}
session_register('first_name');
$_SESSION['first_name'] = $first_name;
session_register('last_name');
$_SESSION['last_name'] = $last_name;
session_register('email_address');
$_SESSION['email_address'] = $email_address;
header("Location: sample.php");
}
} else {
echo "You could not be logged in! Either the username and password do not match or you have not validated your membership!
Please try again!
";
include 'index.html';
}
?>
Io attualmente utilizzo questo script... (ovviamente è soltanto la parte che riguarda i controlli), io non sono tanto bravo col php non è che potresti darmi qualche diritta...