Here is a pretty short, simple and straightforward code I wrote to use for my site to log users in. I was hoping someone could check it out and tell me whether there's anything wrong with it what could use some improvement.
Thanks in advance!
session_start();
/* connect to the db */
define("INCLUDED-PUBLIC", true);
include('dbConnection.php');
/* define safe variables */
$login = mysqli_real_escape_string($connection, $_POST['login-email']);
$pass = md5($_POST['login-pass']);
/* send the query */
$query = mysqli_query($connection, "
SELECT `user_id`
FROM `users`
WHERE `user_contact_email`='$login'
AND `user_password`='$pass'
LIMIT 1
");
/* does such account exist? */
$count = mysqli_num_rows($query);
if ($count > 0){
/* user exists, loggin' in! */
$data = mysqli_fetch_array($query);
$userID = $data['user_id'];
$_SESSION['user']['user_id'] = $userID;
}