I've got a website where the user can log in and when they do two session variables get set:
if (validate_password($password, $user_hash))
{
$_SESSION['usrnam'] = $username;
$_SESSION['uid'] = $user_id;
$stmt -> close();
$con -> close();
dirto_homepage();
exit();
}
Then i do checks to display elements on page:
if (isset($_SESSION['uid']) && isset($_SESSION['usrnam'])) {include ".....";}
and ...
$auth_id = $con -> real_escape_string($_SESSION['uid']);
$message = $con -> real_escape_string($_POST['message']);
$stmt = $con -> prepare("UPDATE `db_table` SET `data` = ?, `date_mod` = ? WHERE `id` = ? AND `author_id` = ?")
Is this secure to do? - The uid is just the auto increment number of the users details in the database. Is there anything i can do to make user login checking more robust?