Here is my authenticate.php
Code: Select all
<link href="style.css" rel="stylesheet" type="text/css" />
<div id="authenticate" align="center">
<?php
include 'logo.php';
?>
<?php
include_once 'connect.php';
session_start();
if (isset($_POST['submit']))
{
$player=$_POST['name'];
$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 "Logged in successfully<br/>";
echo "<A href='index.php'><input type='button' value='Enter the game!' name='button'";
}
else
{
echo "Wrong username or password.<br/>";
echo "<A href='login.php'><input type='button' value='Go Back!' name='button'>";
}
}
?>
Here is my login.php aswell
Code: Select all
<?php
include 'logo.php';
?>
<link href="style.css" rel="stylesheet" type="text/css" />
<form method="POST" action="authenticate.php">
<div id="login" align="center">
Username: <input type="text" name="name" size="21" /><br />
Password: <input type="password" name="password" size="12" mask="x" /><br />
<input type="submit" value="Login" name="submit" /><br />
</form>
Not registered? Register here! <a href="register.php"><input type="button" value="Register" name="button" />
</div>