login problem
Posted: Fri Jul 22, 2011 11:53 pm
hey im still a noob at coding, but im getting the hang of it. but when i make a registration page, and type my information in, it creates my account but when i go to my login page it says "invalid Username Or password what am i doing wrong. i think its something with my authenticate page. can someone please take a look at it. its hard trying to test something and not being able to log in.
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='$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>";
}
}
?>