Page 1 of 1

Admin for adding DB entries

Posted: Tue Sep 28, 2010 8:14 pm
by ConceptDestiny
Hey folks,

Was wondering if anybody had managed to create a back-end/admin to add creatures, realms, items and such? I've tried coding one which adds realms, but its proven a little too difficult. :(

Any help would be greatly appreciated!

Re: Admin for adding DB entries

Posted: Tue Sep 28, 2010 8:26 pm
by Jackolantern
You would have to add some considerable time-saving features to make it worth it vs. simply using phpMyAdmin. If you are just entering single values, it isn't worth it because you can do that already in the existing back-end. I am trying to think of some time-saving features that would allow you to add multiple items at the same time, but nothing is really coming to mind. Maybe if you have multiple quality levels of an item, you could make code to scale the item, adjust the item titles and add them to the DB in one swoop.

Re: Admin for adding DB entries

Posted: Tue Sep 28, 2010 9:17 pm
by rockinliam
Although it wud be useful if it got to the point wer you required multiple people to manage it and maybe your web host was strict on how many phpmyadmin accounts you could have...

Re: Admin for adding DB entries

Posted: Tue Sep 28, 2010 9:27 pm
by Jackolantern
rockinliam wrote:Although it wud be useful if it got to the point wer you required multiple people to manage it and maybe your web host was strict on how many phpmyadmin accounts you could have...
That is true...but wow...think about the security concerns! You would have to do a lot of studying to make sure you had that thing air-tight. If a malicious user got in there, they could basically destroy your game and revert you to the backups you hopefully have.

Re: Admin for adding DB entries

Posted: Tue Sep 28, 2010 9:45 pm
by rockinliam
hmmm but i guess security is all ways a concern no matter what you are programming... but you are correct the potential for a security issue is great.

Re: Admin for adding DB entries

Posted: Tue Sep 28, 2010 10:10 pm
by Jackolantern
It is always a concern, but without a custom-made back-end application, direct database administration is restricted to the web host's systems, which in most cases are far more security-centric than we can get in our web applications.

Re: Admin for adding DB entries

Posted: Tue Sep 28, 2010 11:10 pm
by hallsofvallhalla
i put a admin backend on all my games. I may have to make some videos on this too.

Re: Admin for adding DB entries

Posted: Tue Oct 05, 2010 2:41 pm
by ConceptDestiny
I've created a simple backend template, however I was wondering if anybody could offer assistance on helping me build the opening php code on the page. :D

Code: Select all

<?php
include_once 'connect.php';
session_start();



<?php
if (isset($_SESSION['player']))
{
  $player=$_SESSION['player'];
}
else
{
  echo "Not Logged in <br><br> <A href='login.php'>Login</a>";
  exit;
}
?>


<html>
<head>

<style type="text/css">
	body { color: #ffffff; font-family: "Lucida Sans Unicode", "Lucida Grande", sans-serif; font-size: 0.6em;}
	td {font-size: 0.7em; font-family: "Lucida Sans Unicode", "Lucida Grande", sans-serif;}
	input,select { background-color: #171a1b; border: #262a2c; border-width: 1px; border-style: solid; color: #9caaaf; font-family:Arial, Helvetica, sans-serif; font-family: "Lucida Sans Unicode", "Lucida Grande", sans-serif;}
	button {font-size: 0.7em; font-family: "Lucida Sans Unicode", "Lucida Grande", sans-serif;}
</style>

</head>

<body bgcolor="black">

<form action="postcreature.php" method="post">
<center>
<table>
<tr>
	<td align="center" colspan="2"><b><font color="#ffca4b" style="font-size: 1.1em;">ADD A NEW CREATURE</font></b><br><hr size="1"></td>
</tr>
<tr>
	<td align="right">Creature Name:</td><td> <input type="text" name="fname" /></td>
</tr>
<tr>
	<td align="right">Race:</td>
			<td>
			<select name="mydropdown">
				<option value="Orc">Orc</option>
				<option value="Goblin">Goblin</option>
				<option value="Elf">Elf</option>
			</select>
			</td>
</tr>
<tr>
	<td align="right">Strength:</td><td> <input type="text" name="age" /></td>
</tr>
<tr>
	<td align="right">Defense:</td><td> <input type="text" name="age" /></td>
</tr>
<tr>
	<td align="right">HP:</td><td> <input type="text" name="age" /></td>
</tr>
<tr>
	<td align="right">XP:</td><td> <input type="text" name="age" /></td>
</tr>
<tr>
	<td align="center" colspan="2"><input type="reset" value="Clear" /> <input type="submit" value="Add Creature" /></td>
</tr>
</table>
</center>
</form>

<br><br>


<form action="postrealm.php" method="post">
<center>
<table>
<tr>
	<td align="center" colspan="2"><b><font color="#ffca4b" style="font-size: 1.1em;">ADD A NEW REALM</font></b><br><hr size="1"></td>
</tr>
<tr>
	<td align="right">Realm Name:</td><td> <input type="text" name="fname" /></td>
</tr>
<tr>
	<td align="right">Region:</td>
			<td>
			<select name="mydropdown">
				<option value="Elkor">Elkor</option>
				<option value="Ghal">Ghal</option>
				<option value="Zein">Zein</option>
			</select>
			</td>
</tr>
<tr>
	<td align="right">Height (Squares):</td><td> <input type="text" name="age" /></td>
</tr>
<tr>
	<td align="right">Width (Squares):</td><td> <input type="text" name="age" /></td>
</tr>
<tr>
	<td align="center" colspan="2"><input type="reset" value="Clear" /> <input type="submit" value="Add Realm" /></td>
</tr>
</table>
</center>
</form>

</body>

</html>
I'll sort out the post code, I just need help with the auth code in the header, as it will require a pre-registered admin un/pw. :/

Re: Admin for adding DB entries

Posted: Tue Oct 05, 2010 6:43 pm
by hallsofvallhalla
just place a field in player table called admin

then on page

Code: Select all

if($playerinfo3['admin'] == 1)
{
place all admin code, like menus and such



}
else
{
echo " you are not a admin jackass! get out of the admin panel!!!";
}

Re: Admin for adding DB entries

Posted: Tue Oct 05, 2010 7:42 pm
by ConceptDestiny
hallsofvallhalla wrote:just place a field in player table called admin

then on page

Code: Select all

if($playerinfo3['admin'] == 1)
{
place all admin code, like menus and such



}
else
{
echo " you are not a admin jackass! get out of the admin panel!!!";
}
Ohh yes, alexander19 informed me of creating an admin field in the db. Thanks for the addendum halls, that's perfect! :)