Log-in authenticate issues.[Solved]

Place for questions and answers for all newcomers and new coders. This is a free for all forum, no question is too stupid and to noob.
Post Reply
twizix
Posts: 5
Joined: Sat Sep 28, 2013 9:02 pm

Log-in authenticate issues.[Solved]

Post by twizix »

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>";
  }
}
?>
Last edited by twizix on Sun Sep 29, 2013 5:44 am, edited 1 time in total.
User avatar
Sharlenwar
Posts: 523
Joined: Mon May 28, 2012 7:14 pm

Re: Log-in authenticate issues.

Post by Sharlenwar »

I guess I don't understand the issue, I have been following the Browser Based MMORPG video tutorials and for me it all works like a charm. I have the exact same code for my authenticate.php and it all behaves as expected.
Deep within the Void of Quasion, a creation.

**My Corner of the Web**
***NEW***GrindFest - My own PHP/MySQL game!
Sharlenwar's Adventures
Torn-City - Massively multiplayer online text based RPG
twizix
Posts: 5
Joined: Sat Sep 28, 2013 9:02 pm

Re: Log-in authenticate issues.

Post by twizix »

Please ignore and set as solved. I fixed the issue. It was a small dumb error in spelling.
Post Reply

Return to “Beginner Help and Support”