Here's my Authenticate.php
Code: Select all
<?php
include_once 'connect.php';
session_start();
header('refresh: 2; url=index.php' );
if (isset($_POST['Login']))
{
$player=$_POST['player'];
$password=$_POST['password'];
$player=strip_tags($player);
$password=strip_tags($password);
$password=md5($password);
$query = "SELECT name,password from members 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;
}
else
{
echo "<big>Wrong username or password.<A href='login.php'>Try Again</a></big>";
exit;
}
}
?>
Code: Select all
<?php
include 'connect.php';
session_start();
?>
<link href="style.css" rel="stylesheet" type="text/css" />
<div id="login">
<form method="POST" action="authenticate.php">
User Name <input type="text" name="player" size="21">
Password <input type="text" name="password" size="21" mask="x">
<br>
<input type="submit" value="Login" name="submit">
<br><br>Not Registered? <a href='register.php'>Register
Forgot password? <A href="getpass.php">Get Password</a><br>
<br>
</form>
</div>
Code: Select all
<?php
include_once 'connect.php';
session_start();
include_once 'logo.php';
?>
<link href="style.css" rel="stylesheet" type="text/css" />
<div id="login2" div align="center">
<?php
if (isset($_SESSION['player']))
{
$player=$_SESSION['player'];
}
else
{
echo "Not Logged in <br><br> <A href='login.php'>Login</a>";
exit;
}
?>
</div>
<?php
$playerinfo="SELECT * from players where name='$player'";
$playerinfo2=mysql_query($playerinfo) or die("could not get player stats!");
$playerinfo3=mysql_fetch_array($playerinfo2);
include_once 'statpanel.php';
?>
<div id ="locations">
<?php
$playersm = $playerinfo3['stamina'];
if ($playersm < 1)
{
echo "You are dead!" ;
echo "<br><a href='useitem.php>Use an Item";
exit;
}
if(isset($_GET['map']))
{
$bypass=1;
echo "<a href='index.php?mapchange=1&mapname=Forbidden Forest'>Forbidden Forest";
echo "<br><a href='index.php?mapchange=1&mapname=Savannah'>The Savannah";
echo "<br><a href='index.php?mapchange=1&mapname=Deep Lake'>Deep Lake";
echo "<br><a href='index.php?mapchange=1&mapname=The Dark Cave'>The Dark Cave";
}
if(isset($_GET['mapchange']))
{
$bypass=1;
$mapname = $_GET['mapname'];
$name = $location['name'];
$level = $location['level'];
$price = $location['price'];
$gold = $price['gold'];
$updateplayer="update players set location='$mapname' where name='$playerinfo3[name]'";
mysql_query($updateplayer) or die("Could not update player");
$updateplayer="update players set gold=gold-'$gold' where name='$player'";
if ($playerinfo3['level'] > $location['level'])
{
echo "<a>You are not high level enough to get to this Area!</a>";
echo "<a><center><a href='index.php'>Go Back</center></a>";
}
else
{
echo "You do not have enough gold for this trip!";
echo "<center><a href='index.php'>Go Back</center>";
exit;
}
echo "You have traveled to " . $mapname . ".<br>";
echo "<a href='index.php'>To location</a><br>";
}
if($bypass = 1)
{
echo "<b><big><u>" . $playerinfo3['location'] . "</u></big></b><br><br><br>";
echo "<a href='store.php'>Visit Store</a><br>";
echo "<a href='weaponshop.php'>Visit Weapon Shop</a><br>";
echo "<a href='armorshop.php'>Visit Armor Shop</a><br>";
echo "<a href='inn.php'>Visit Inn</a><br>";
echo "<a href='spelltrainer.php'>Visit Spell Trainer</a><br>";
echo "<a href='battle.php'>Battle in Arena</a><br>";
echo "<a href='game.php?map=1'>Go to Map</a><br>";
}
print "<center><h3>Locations</h3></center>";
print "<center>";
print "<table border='0' width='70%' cellspacing='20'>";
print "<tr><td width='25%' valign='top'>";
print "</td>";
print "<td valign='top' width='75%'>";
$selectlocation="SELECT * from location";
$selectlocation2=mysql_query($selectlocation) or die("could not select locations");
print "<table border='1' bordercolor='black' bgcolor='#ffffff'>";
print "<tr><td><font color='cc0033'>name:<font color='ffffff'>__________</td><td><font color='cc0033'>level<font color='ffffff'>__</font></td><td><font color='cc0033'>type<font color='ffffff'>____</font></td></tr>";
while($selectlocation3=mysql_fetch_array($selectlocation2))
{
print "<tr><td>$selectlocation2[name]</td><td>$selectlocation2[level]</td><td>$selectlocation2[type]</td></tr>";
}
print "</table>";
print "</td></tr></table>";
print "</center>";
?>
</div>
<div id="logout">
<?php
echo "<br><a href='logout.php'><img src='images/logout.gif'></a>";
?>
</div>
Code: Select all
<?php
include_once 'connect.php';
session_start();
include_once 'logo.php';
?>
<link href="style.css" rel="stylesheet" type="text/css" />
<div id="login2" div align="center">
<?php
if (isset($_SESSION['player']))
{
$player=$_SESSION['player'];
}
else
{
echo "Not Logged in <br><br> <A href='login.php'>Login</a>";
exit;
}
?>
</div>
<?php
$playerinfo="SELECT * from players where name='$player'";
$playerinfo2=mysql_query($playerinfo) or die("could not get player stats!");
$playerinfo3=mysql_fetch_array($playerinfo2);
include_once 'statpanel.php';
?>
<div id ="locations">
<?php
$playerhp = $playerinfo3['hpoints'];
if ($playerhp < 1)
{
echo "You are dead!" ;
echo "<br><a href='useitem.php>Use an Item";
exit;
}
if(isset($_GET['map']))
{
$bypass=1;
echo "<a href='index.php?mapchange=1&mapname=Crocania'>Crocania</a><br>";
echo "<a href='index.php?mapchange=1&mapname=Fordale Woods'>Fordale Woods</a><br>";
echo "<a href='index.php?mapchange=1&mapname=Mintus Mountains'>Mintus Mountains</a><br>";
}
if(isset($_GET['mapchange']))
{
$bypass=1;
$mapname = $_GET['mapname'];
$updateplayer="update players set location='$mapname' where name='$playerinfo3[name]'";
mysql_query($updateplayer) or die("Could not update player");
echo "You have traveled to " . $mapname . ".<br>";
echo "<a href='index.php'>To location</a><br>";
}
if($bypass != 1)
{
echo "<b><big><u>" . $playerinfo3['location'] . "</u></big></b><br>";
echo "<a href='store.php'>Visit Store</a><br>";
echo "<a href='weaponshop.php'>Visit Weapon Shop</a><br>";
echo "<a href='armorshop.php'>Visit Armor Shop</a><br>";
echo "<a href='inn.php'>Visit Inn</a><br>";
echo "<a href='spelltrainer.php'>Visit Spell Trainer</a><br>";
echo "<a href='battle.php'>Battle in Arena</a><br>";
echo "<a href='index.php?map=1'>Go to Map</a><br>";
}
?>
</div>
<div id="logout">
<?php
echo "<br><a href='logout.php'><img src='images/logout.gif'></a>";
?>
</div>

Code: Select all