[Tool]PHP Castle Status Script

Have you created a useful tool? or Do you want to get help building one? This is the right place!
Forum rules
READ NOW: L2j Forums Rules of Conduct
Post Reply
simeonKolev
Posts: 2
Joined: Thu May 31, 2012 3:01 pm

[Tool]PHP Castle Status Script

Post by simeonKolev »

Hi guys, I recently worked on a Castle Status Script for my future L2JServer website and decided to share it with you. The script has a configuration files and also all the code is commented. What I saw in the code of others is that theres used the old MySQL syntax I am using the new one - MySQLi (it stands for MySQL Impoved) which is strongly recommended by MySQL server and PHP.

Features:
1. Castle Owner - Clan name.
2. Alliance name.
3. Clan leader.
4. Siege status - (next siege date, in registration, in siege).
5. Fully working and optimized crests.
6. Configuration files to best utilize the script to your needs.
7. Free support (If you want help contact me anytime).

Here is the script: Click MediaFire download
You get a .rar file. Extract it and inside you have all the files you need. I made a few read-me files for the HTML, CSS and for the script so you can fully understand how it's working and if you want to modify it for your needs.

!IMPORTANT you have to enable the MySQLi extension from the php.ini or be sure that it is enabled or you can't run this script!

The install guide:

The install is simple, but for working crests you would need a FTP server. I'm using FileZilla FTP server. Then you have to create an user with at least read privileges and set his home directory to the crests folder on the server, i.e. "serverDir/game/data/crests/". This can be done in FileZIlla server by following this:

After installing it you will have a program FileZilla Server Interface open it and go Edit->Users. You will get a dialog where you can manage user accounts on the FTP server. So now add a user by clicking the button Add and then a pop-up box will appear just type the name there and click Ok. Now on the password field type the password you want for this username. Ok you are almost ready now you need to add the crests folder. Click in the left tab on Shared Folders then click on Add and choose the path to the "serverDir/game/data/crests/" where serverDir is the folder you store the L2J server. Click Ok and now for security reasons from the privileges from the right choose only Read click Ok and you are ready.

Now you have to set the config files:
cron/castleStatusConfig.php - located in the cron folder here you have to type the data needed for the connection to the database and some preferences for the script. So be sure to type the data correctly. Now you have to set the crestsConfig.php. Here is the data needed to connect to the FTP Server. Be sure that the data is correct and now we are ready to start the script. Go into the cron folder and edit the cron.bat file. You have to adjust where is PHP installed so if PHP is in "C:\php" the first line has to be SET PATH="C:\php"; !Note that the first eight lines are a comment!. Now save the file and run it.

Now all you have to do is to enter your host open the castleStatusProject folder and open the showCastleStatus-light.php or showCastleStatus-dark.php. If everything is correct the script should run perfectly and show the data. If you can't run this script don't hesitate to contact me if you can't find the problem.

Now all you have to do is with your favourite cron-jobs software to run this .bat or the PHP script. I'm using the Task Sheduler to run the .bat file. You go to All programs->Accessories->System Tools->Task Sheduler. Then go action->create task... On the pop-up window add a name for the job and then proceed to Triggers tab. Then click on New.... On the pop-up window check the repeat task every and type 5 minutes or the time you want the script to re-run and for for a duration of - Indefinetely. Click Ok and go to Actions->New... Then Start a program and browse to the cron.bat file. Ok and set the other tabs to your preference. When you click Ok scroll down to Active tasks and double click on the newly created task. Then on the right sight click Run. If something doesn't work and you need help or have a question feel free to ask me.

!Please read the read-me files for more info and enjoy the Castle Status Script

I am too busy now to add images after a day or two I will.
User avatar
nonom
L2j Veteran
L2j Veteran
Posts: 649
Joined: Wed Mar 11, 2009 10:34 pm
Location: Magmeld

Re: [Tool]PHP Castle Status Script

Post by nonom »

Thanks for share and the explanation!

Instead Mediafire I suggest to use github, xp-dev or assembla :)
Image
"There are three kinds of people in this world, those who can count and those who can't"
simeonKolev
Posts: 2
Joined: Thu May 31, 2012 3:01 pm

Re: [Tool]PHP Castle Status Script

Post by simeonKolev »

nonom wrote:Thanks for share and the explanation!
Instead Mediafire I suggest to use github, xp-dev or assembla :)
You are welcome, and yea I thought to make a repository but I think "We just don't need it". I am not intending to develop the script further more cause there is nothing to develop. If you have any ideas for the script just post here and if I can make them real it will be pleasure. :)
User avatar
godfreyouwens
Posts: 21
Joined: Wed May 11, 2011 10:49 pm
Location: CheeseLand USA !

Re: [Tool]PHP Castle Status Script

Post by godfreyouwens »

Thanks ! this is great !

wonder if you or anyone can help me change this into 2 columns instead of just 1 long one.... I would greatly appreciate it!! I fumbled around for a bit but couldnt figure it out..

So you guys see what I mean, the page is here: http://www.theascendedones.com/castlestatus.php

its not a big deal, just would be nice if I could make it display in multiple columns..

thanks !! :D
User avatar
godfreyouwens
Posts: 21
Joined: Wed May 11, 2011 10:49 pm
Location: CheeseLand USA !

Re: [Tool]PHP Castle Status Script

Post by godfreyouwens »

I know the OP hasnt logged on in awhile.. maybe someone else can help me with some css, or if they know what may be causing a problem I have.. I still use the link in my post above :) and in IE and Firefox, the clan owners show up fine... only in google chrome it shows up as blank.

I assume it has to do with the css and/or style sheets, if anyone has any ideas, please let me know ! thanks ! :)
Post Reply