Admin for adding DB entries

Need help with an engine or coding not on the list? Need help with a game or the website and forums here? Direct all questions here.
Post Reply
ConceptDestiny
Posts: 261
Joined: Wed Apr 28, 2010 8:35 am

Admin for adding DB entries

Post 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!
User avatar
Jackolantern
Posts: 10891
Joined: Wed Jul 01, 2009 11:00 pm

Re: Admin for adding DB entries

Post 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.
The indelible lord of tl;dr
User avatar
rockinliam
Posts: 466
Joined: Sun Jun 07, 2009 11:26 am

Re: Admin for adding DB entries

Post 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...
Skillset: C/C++, OpenGL, C#, Lua, PHP, MySql, Web Dev etc.
Website: https://liam-griffiths.co.uk/
User avatar
Jackolantern
Posts: 10891
Joined: Wed Jul 01, 2009 11:00 pm

Re: Admin for adding DB entries

Post 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.
The indelible lord of tl;dr
User avatar
rockinliam
Posts: 466
Joined: Sun Jun 07, 2009 11:26 am

Re: Admin for adding DB entries

Post 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.
Skillset: C/C++, OpenGL, C#, Lua, PHP, MySql, Web Dev etc.
Website: https://liam-griffiths.co.uk/
User avatar
Jackolantern
Posts: 10891
Joined: Wed Jul 01, 2009 11:00 pm

Re: Admin for adding DB entries

Post 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.
The indelible lord of tl;dr
User avatar
hallsofvallhalla
Site Admin
Posts: 12026
Joined: Wed Apr 22, 2009 11:29 pm

Re: Admin for adding DB entries

Post by hallsofvallhalla »

i put a admin backend on all my games. I may have to make some videos on this too.
ConceptDestiny
Posts: 261
Joined: Wed Apr 28, 2010 8:35 am

Re: Admin for adding DB entries

Post 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. :/
User avatar
hallsofvallhalla
Site Admin
Posts: 12026
Joined: Wed Apr 22, 2009 11:29 pm

Re: Admin for adding DB entries

Post 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!!!";
}
ConceptDestiny
Posts: 261
Joined: Wed Apr 28, 2010 8:35 am

Re: Admin for adding DB entries

Post 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! :)
Post Reply

Return to “Advanced Help and Support”