I have this code that works fine on a development machine but when ported over to production the user will get the alert wrong details despite being right.
My guess is this is a session issue with PHP. However, I am seeing session files saved to /tmp on the server. Am I missing something obvious as to what is causing this issue?
The code is referenced below.
session_start();
include_once 'dbconnect.php';
if(isset($_SESSION['user'])!="")
{
header("Location: home.php");
}
if(isset($_POST['btn-login']))
{
$email = mysql_real_escape_string($_POST['email']);
$upass = mysql_real_escape_string($_POST['pass']);
$res=mysql_query("SELECT * FROM `USERS` WHERE `EMAIL` = '$email'");
$row=mysql_fetch_array($res);
if($row['PASSWORD']==md5($upass))
{
$_SESSION['user'] = $row['ID'];
header("Location: home.php");
}
else
{
?>
<script>alert('wrong details');</script>
<?php
}
}