Prova così, ti ho anche sistemato qualcosina ;)
Codice PHP:
<?php
session_start();
include 'db.php';
$username = addslashes($_POST['username']);
$password = $_POST['password'];
if(empty($username) || empty($password)){
?><!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>
<title>PHelpP - Php Help for Programmers</title>
<link rel="stylesheet" type="text/css" href="home.css" />
</head>
<body>
<div id="container">
<div id="header">
<h1> </h1>
</div>
<div id="navigation">
<ul>
<li><a id="activelink" href="index.php">Home</a></li>
<li><a href="/forum">Forum</a></li>
<li><a href="guide.php">Guide</a></li>
<li><a href="download.php">Applicazioni</a></li>
<li><a href="script.php">Script</a></li>
<li><a href="creazioni.php">Creazioni</a></li>
<li><a href="credits.php">Crediti</a></li>
</ul>
<?php include("menu.php"); ?>
</div>
<div id="content">
Per piacere inserisci TUTTE le informazioni! <br />
<?php include ("login.php");
exit(); ?>
</div>
<div id="footer"><?php include("footer.php"); ?></div>
</div>
</body>
</html>
<?php
}
$password = md5($password);
$sql = mysql_query("SELECT * FROM users WHERE username='$username' AND password='$password' AND activated='1'");
if($sql){
while($row = mysql_fetch_assoc($sql)){
extract($row, EXTR_PREFIX_SAME, "");
$_SESSION['first_name'] = stripslashes($first_name);
$_SESSION['email_address'] = stripslashes($email_address);
echo "<script type=\"text/javascript\">location.href='sample.php';</script>";
}
} else {
?><!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>
<title>PHelpP - Php Help for Programmers</title>
<link rel="stylesheet" type="text/css" href="home.css" />
</head>
<body>
<div id="container">
<div id="header">
<h1> </h1>
</div>
<div id="navigation">
<ul>
<li><a id="activelink" href="index.php">Home</a></li>
<li><a href="/forum">Forum</a></li>
<li><a href="guide.php">Guide</a></li>
<li><a href="download.php">Applicazioni</a></li>
<li><a href="script.php">Script</a></li>
<li><a href="creazioni.php">Creazioni</a></li>
<li><a href="credits.php">Crediti</a></li>
</ul>
<?php include("menu.php"); ?>
</div>
<div id="content">
Impossiile effettuare il login! La password o lo username da te inseriti non sono corretti!Riprova!
<br />
<?php include ("login.php"); ?>
</div>
<div id="footer"><?php include("footer.php"); ?></div>
</div>
</body>
</html>
<?php
}
?>
EDIT: ho aggiornato lo script alle 18.20:31, se hai provato lo script di prima testa anche il nuovo