8ennett 0 Report post Posted December 19, 2010 Now before we begin this tutorial please ensure you have run through parts 1 and 2 and made sure you understand everything that has been said. Feel free to comment on each tutorial with any questions and I will help you out as best I can. Part 1: Advanced User Account System Part 2: Welcome Home Also for this tutorial you will need to download the updated files archive which contains all the new files included in this tutorial as well as all the previous files and the mysql tables document which you will need to run. As with the other tutorials once you have created your database and run the tables query you will need to change the config file located in lib/config.php. I'd also like to point out to everyone that there has been no change to the table structure in this tutorial so you don't need to overwrite your current example database if you have one. ############### Part 1: Administrative ############### So here we are, we are going to work on our new admin panel. In this tutorial we will cover the site config editor and a special button for turning our server online and offline. When we turn our server offline that means that no body can register with your site and cannot login either. Also anyone who is already logged in will be logged out, except of course admins and super admins. So what you need to do first is ensure you are registered with your site and logged in. If you haven't done so already you will also need to change your account type to "Super" so you have the master account. Change the account type in your database under the "type" column. Now you are an administrator you will notice now you can see an additional item on the home menu. This link will appear only if you are an admin or super admin and is a link to the admin panel. If you look in the home.php file and scroll through the code to the menu you can see how simple it is to do this, simply by checking the $_SESSION['user'] variable. As usual the lines are all commented to run you through how to do this. So now we are in our new admin panel you will see two buttons, Site Config and the On/Off switch for our server. I coloured the button text using the css file, have a quick look through the page code and the css file just to see how it's done. When toggling this switch the colour of the button changes from red to green and back again. If you click on the site config button then the site config settings will appear in a form below the admin panel. If you look closer at the php files you will notice the config settings editor is in a seperate php file to admin.php in the admin directory under modules. This file cannot be accessed by any other page other than our admin.php, this is because it also checks if the home include variable has been set the same as normal module pages (bank.php and home.php) so it can only be displayed if it's included in the home page, but because of the way we setup our module system they cannot access it by manipulating the $_GET variables either. If you have a look through our config.php file in the admin module directory you can see how we have processed the form data using php. Obviously since we aren't writing anything to the database then we don't need to escape the characters and so on, but we still need to do a couple of checks on each post variable. We also need to output error messages in case one of these checks fails and we can identify which field we entered an incorrect value. I have also added the TITLE tags to each form input. Now when you mouse over each field in the form it will bring up a description of what that setting is. Once all our form checks are complete and everything is ok then we re-write the config file in the lib folder with our new values. I also had it write all the original comments in case you want to change something manually in the config file and need help remembering what each setting does. So that's pretty much it for this tutorial. In future tutorials when we create new values in our config file we will also be adding them to our admin file config editor. Also we will be creating more features in the admin panel itself once we have made them elsewhere, including an in-game content editor (items, houses, weapons, animals and so on) and also a user editor. As usual any questions or comments are welcome. I won't be writing another tutorial now until the new year, although I might start one in a day or two. In the mean time keep examining the code to work out how to write your own version. Share this post Link to post Share on other sites
8ennett 0 Report post Posted December 19, 2010 Forgot to add the new download archive, sorry about that.Download Example3.rar Share this post Link to post Share on other sites
Viral Dragon 0 Report post Posted December 30, 2010 OP: As a fellow programmer, I respect the work you've put into this, with that in mind do note that the scripts you have provided havea "few" errors within them. Having tested this myself, I can note at least 5 errors, which prevent someone from actually playing this MMO. What editor are you using to make these files? -Viral. Share this post Link to post Share on other sites
8ennett 0 Report post Posted December 30, 2010 (edited) Don't worry, all errors have been found and fixed in the next tutorial.If you want to pm me the errors you have found though I can check them against the six I found.Also I use dreamweaver mx, with an updated syntax library of course Edited December 30, 2010 by 8ennett (see edit history) Share this post Link to post Share on other sites
Viral Dragon 0 Report post Posted December 31, 2010 8ennett, PM sent. I'll be awaiting the next tutorial. If you'd like help feel free to ask. (When can we except said tutorial?)-Viral. Share this post Link to post Share on other sites
8ennett 0 Report post Posted January 1, 2011 I'll probably be writing the next tutorial in a day or two (bit hungover today) but all the code has already been done so it's just a matter of writing the article. Thanks for the pm as well. Share this post Link to post Share on other sites
Frazzman 0 Report post Posted August 11, 2011 Hi, Thanks for this tutorial, i see this is turning into a gangster Text based game i would serisouly appreciate help in being able to transfer this into a game similar to http://movoda.net/ http://www.syrnia.com/ thanks! Share this post Link to post Share on other sites