OK, here is the final script, this is currently working the way I want it, so now you can assist me with fine tuning it. Basically what it does is runs a query in the database and validate the user, log them in and updates the login time and date.
<?php
session_start();
if(isset($_POST['login']))
{
require_once('stripFormSlashes.php');
include("db_con.php");
$conn = mysqli_connect($host, $user, $pass, $dbase);
$username = $_POST['username'];
$password = sha1($_POST['password']);
$sql = "SELECT firstname,lastname FROM members WHERE username= '$username' AND password='$password'";
$result = mysqli_query($conn,$sql) or die ('Could not run select query');
$row = mysqli_fetch_array($result);
if(mysqli_num_rows($result) == 0)
{
$message = 'Please make sure you have entered the correct username and password';
} else
{
mysqli_query($conn,"UPDATE members SET logindate= NOW() WHERE password= '$password'") or die('Could not run update query');
$message = 'Logged in as '.$row['firstname'];
}
}
?>