MMORPG Administration

Post all your tuts or request for tuts here.
Post Reply
phq
Posts: 14
Joined: Fri Dec 11, 2009 7:24 am

MMORPG Administration

Post 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 :).
User avatar
august
Posts: 21
Joined: Mon Apr 05, 2010 9:27 am

Re: MMORPG Administration

Post by august »

is there a step two still coming for this?

Code: Select all

<?php

echo "PHP kicks your ASP";

?>
User avatar
OldRod
Posts: 1320
Joined: Sun Sep 20, 2009 4:26 pm

Re: MMORPG Administration

Post by OldRod »

Step 1: post beginning of administration tutorial
Step 2: ???
Step 3: PROFIT!!

:)
User avatar
august
Posts: 21
Joined: Mon Apr 05, 2010 9:27 am

Re: MMORPG Administration

Post 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!

Code: Select all

<?php

echo "PHP kicks your ASP";

?>
Post Reply

Return to “Tutorials”