Log-in authenticate issues.[Solved]
Posted: Sun Sep 29, 2013 5:28 am
So i have setup everything and so far I have everything working. There is only one big issue, the password inserted into the database in md5 encrypted but when trying to log-in the password becomes the md5 encryption. The password you choose will not log you in , only the md5 version of your password will work. I spent a good hour trying to find any similar issue throughout the forum but i haven't seen anything. Here is the auth script.
Code: Select all
<?php
include_once 'connect.php';
session_start();
if (isset($_POST['submit']))
{
$player=$_POST['player'];
$password=$_POST['password'];
$player=strip_tags($player);
$password=strip_tags($password);
$password=md5($password);
$query = "select name,password from players where name='$player' and '$password'";
$result = mysql_query($query) or die("Could not query players");
$result2 = mysql_fetch_array($result);
if ($result2)
{
$_SESSION['player']=$player;
echo "<big>Logged in successfully<br>";
echo "<A href='index.php'>Continue</a></big>";
}
else
{
echo "<big>Wrong username or password.<A href='login.php'>Try Again</a></big>";
}
}
?>