Page 1 of 1

MMORPG Administration

Posted: Tue Feb 02, 2010 10:22 pm
by phq
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

Code: Select all

echo "<a href='battle.php'>Battle in Arena</a><br>";
When you will find it add

Code: Select all

if($playerinfo3[rights] == 1){
echo "<a href='admin/battle.php'>Administration</a><br>";
}
Now you should be good.

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>";
}
?>
Explanation:

Code: Select all

include '../connect.php';
include '../connect.php'; Will look for a connection.php from the parent directory.

Code: Select all

if (isset($_SESSION['player']))
{
  $player=$_SESSION['player'];
}
else
{
  echo "Not Logged in <br><br> <A href='login.php'>Login</a>";
  exit;
}
If you watched the tutorials you should know what it does ;)

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 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 :).

Re: MMORPG Administration

Posted: Sat Apr 10, 2010 3:27 pm
by august
is there a step two still coming for this?

Re: MMORPG Administration

Posted: Sat Apr 10, 2010 4:46 pm
by OldRod
Step 1: post beginning of administration tutorial
Step 2: ???
Step 3: PROFIT!!

:)

Re: MMORPG Administration

Posted: Sun Apr 11, 2010 3:33 am
by august
lol is that the score with him is it?

cant think what i really need an admin side in my game for anyway, not sure if it would be useful. Would have been nice if Mr. Capitalism had posted the 2nd part so I could decided if it would be or not!