First off I would make a new folder called admin. In that folder make an index file and leave it blank for few minutes.
Go to your MySQL database go to players and add a new field called rights and make it a small int and where it says Length type in 1.
Then go back to your games directory open the file called 'index.php'.
Look for
Code: Select all
echo "<a href='battle.php'>Battle in Arena</a><br>";
Code: Select all
if($playerinfo3[rights] == 1){
echo "<a href='admin/battle.php'>Administration</a><br>";
}
Ok, now go to the index file and add this:
Code: Select all
if ($playerhp < 1)
<?php
include '../connect.php';
session_start();
if (isset($_SESSION['player']))
{
$player=$_SESSION['player'];
}
else
{
echo "Not Logged in <br><br> <A href='login.php'>Login</a>";
exit;
}
$playerinfo="SELECT * from players where name='$player'";
$playerinfo2=mysql_query($playerinfo) or die("could not get player stats!");
$playerinfo3=mysql_fetch_array($playerinfo2);
if($playerinfo3[rights] == 0){
echo "You have no access to this page.<br>";
echo "<a href=\"../index.php\">Go back to the game</a>";
}
if($playerinfo3[rights] == 1){
echo "<a href='changestats.php'>Change player's stats.</a><br><br>";
echo "<a href='../index.php'>Go back to the game</a>";
}
?>
Code: Select all
include '../connect.php';
Code: Select all
if (isset($_SESSION['player']))
{
$player=$_SESSION['player'];
}
else
{
echo "Not Logged in <br><br> <A href='login.php'>Login</a>";
exit;
}

Code: Select all
$playerinfo="SELECT * from players where name='$player'";
$playerinfo2=mysql_query($playerinfo) or die("could not get player stats!");
$playerinfo3=mysql_fetch_array($playerinfo2);
Gets the data.
Code: Select all
if($playerinfo3[rights] == 0){
echo "You have no access to this page.<br>";
echo "<a href=\"../index.php\">Go back to the game</a>";
}
if($playerinfo3[rights] == 1){
echo "<a href='changestats.php'>Change player's stats.</a><br><br>";
echo "<a href='../index.php'>Go back to the game</a>";
}
If the rights are 1 you can see the page.
______________________________________________________________________________________________________________________________
STEP 2:
WILL BE HERE SOON
If there is any errors please post the here. I will try fix them
