I'm suprised this code even works. First, you require db.php twice. It should dump on that, unless you use require_once.
Next, this line:
$username = $_SESSION['username']
isn't terminated with a ;
You should gt a parse error from that.
Anyway, you may just want to do a check that username exists first....
session_start();
require_once 'db.php';
if(isset($_SESSION['username'])) {
$sql = mysql_query("SELECT username
FROM users
WHERE username = '".$_SESSION['username']."'");
$numrows = mysql_num_rows($sql);
if($numrows == 0) {
header("Location: login_form.html");
exit();
}
echo "Welcome ". $_SESSION['username'] ." ";
}
else {
header("Location: login_form.html");
}