MMORPG Administration
Posted: Tue Feb 02, 2010 10:22 pm
Administration
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
When you will find it add
Now you should be good.
Ok, now go to the index file and add this:
Explanation:
include '../connect.php'; Will look for a connection.php from the parent directory.
If you watched the tutorials you should know what it does
Gets the data.
If the player's rights are 0 then it will say that you have no access to the page.
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
.
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
