codice:
$connect=mysql_connect('localhost','','');
mysql_select_db('test',$connect);
$sql = ("SELECT * FROM user WHERE username = \"{$_POST['username']}\" ");
$query = mysql_query($sql);
$user = @mysql_fetch_array($query, MYSQL_ASSOC);
if ($user == TRUE)
{
if(empty($user['password']))
{
echo ("vuoto");
exit;
}
else
{
if('nuvola' == $user['password'])
{
echo($ok);
print $user['nome'];
print (" ");
print $user['cognome'];
}else{
echo("Non sei autenticato");
}
}
}
mysql_close($connect);
codice:
CREATE TABLE `user` (
`id` smallint(6) NOT NULL auto_increment,
`username` text NOT NULL,
`password` text NOT NULL,
`nome` text NOT NULL,
`cognome` text NOT NULL,
PRIMARY KEY (`id`)
) TYPE=MyISAM AUTO_INCREMENT=2 ;