|
||
|
|||||||
| Script Languages Perl/PHP/Python/Ruby so on and so forth. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 (permalink) |
|
Forum Expert
Join Date: Nov 2003
Location: Illinois, USA
Age: 21
Posts: 2,908
|
Ok, well i dont know how many people will want to use this or not, but i thought it might be nice to share since it is Christmas
. What it does is open a connection to a server (doesnt have to be a RunUO to determine if it is online) and then if it is a RunUO server, it retrieves the number of players online. The header pretty much explains everything i think and i put enough comments for even a beginner to understand. One quick note though, is i am not sure what I am sending to the server to get the number of players online except it is UOGateway sends when it checks the status.So here it is and if anyone has any questions, dont be afraid to ask, but im a definately no expert. Some initial tips though are: make sure the directory that it is in is chmod 777 so the cache file can be created (although you might be able to create it youself and not worry about that, i didnt test that though);make sure your webserver supports allowing php to use sockets because some dont; and dont ever use 0 for the interval except for testing because this means every new page load will connect to your server, which isnt good. Be sure to change the extension to php instead of txt (the forums dont allow uploading php extensions). Oh and yes it might be faster if i didnt do some of the checks and various things i did, but i wanted to make it simple when you use it, so you dont have to set all of the options, since it will do it automactially. Edit: Alright well here is the updated version in the zip, you need to upload both the install and the checkserver.php. Also make sure the directory is 775 otherwise you actually have to mess with some stuff manually (deleting and making a config file). It will tell you if it cant write these files and such. Be sure that the table name and the cache file name are unique cause i didnt do any checks so i dunno what will happen and make sure that atleast one or the other is checked. If both are checked, then the cachefile is used as a backup incase the database fails. Only the mySQL database is supported (i have version 4.0.24, but it should work with any, if not, please tell me what the error says), and i have no plans of supporting any others since i believe this is the most popular and i dont have access to anyothers. UPDATE: I got rid of the install script cause too many variables to check if it doesnt work, now all you have to do is drop it in a directory, read the header of checkserver.php, change your values in the config file, and you should be set. Shouldnt be hard at all if you know anything about php and Ill try to answer questions if i can. I know I havent updated this in a while (and this isnt much of an update anyways), but Ill see if I can be around more now. Oh and I didnt test these changes at all (cause they were small) so if you notice something weird, let me know. Last edited by mordero; 12-09-2006 at 03:58 AM. Reason: Updated Version |
|
|
|
|
|
#2 (permalink) |
|
Forum Newbie
|
Thank you so much for this script I would love to use it but have a question, What do I edit and where should I put this on my site? Can you do a readme file for this please.
sorry im a newb when it comes to php Last edited by Bham; 02-02-2006 at 04:02 AM. Reason: addition |
|
|
|
|
|
#3 (permalink) |
|
Forum Expert
Join Date: Nov 2003
Location: Illinois, USA
Age: 21
Posts: 2,908
|
Ok, well first off, your site needs to support php of course, and you need to be able to edit the php to add this in (or if your CMS allows you to add php into blocks). Anyways, you could add this anywhere on your page that you want. Ill give you an example of what you could do.
First checkserver.php needs to be in the same directory for this example to work... Example page (ill use where i play as an example): PHP Code:
Near the beginning of the index PHP Code:
PHP Code:
If you need anymore help, just ask ![]() |
|
|
|
|
|
#5 (permalink) |
|
Forum Expert
Join Date: Nov 2003
Location: Illinois, USA
Age: 21
Posts: 2,908
|
Yeah, you will have to give me a bit though, cause i am really busy up till next Thursday (exams and work :S), but I think it should be a really easy to change it over from what I have been reading on the php-nuke site.
Since I am going to be doing this for php-nuke, I think I am also going to change the normal one to be able to use a database as well for all this and create a install script to make it easier to configure it, that way you really don't need to know much about php. Edit (2/23/06): Ok, been more busy than I thought I would be, but I have the database support working and a rough installation script, so all i need to do now is see what I need to do for it to work for Nuke) Last edited by mordero; 02-23-2006 at 01:12 PM. |
|
|
|
|
|
#6 (permalink) |
|
Join Date: Feb 2005
Age: 58
Posts: 17
|
It doesnt seem to be displaying anything. Either the script isn't pinging the server, or the ping information isn't displaying. It shows the word "Status:" But nothing else. I changed the IP to the correct IP. Same with the UOG link. I'd really like to use this script. Sorry for bumping this month old thread lol.
|
|
|
|
|
|
#9 (permalink) |
|
Forum Expert
Join Date: Nov 2003
Location: Illinois, USA
Age: 21
Posts: 2,908
|
oh crap, nevermind, i didnt know i already had the error reporting turned off... so do this... copy and paste this into a page
<?php phpinfo(); ?> and save that as info.php, upload it and go to the page and make sure that in the "Configure Command" row there is "--enable-sockets" |
|
|
|
|
|
#10 (permalink) |
|
Join Date: Feb 2005
Age: 58
Posts: 17
|
Configure Command '--enable-sockets' Among other things. lol But yes that is there in that big list of things. Still nothing is displaying after it says "Status:"
How many files need to be here to work? I have: Index.html checkserver.php servcheck.txt Info.php servcheck has nothing written in it. |
|
|
|
|
|
#11 (permalink) |
|
Forum Expert
Join Date: Nov 2003
Location: Illinois, USA
Age: 21
Posts: 2,908
|
Ok I thought it might be a file permission issue (the directory needs to be chmod 775), but if the file is being creating this isnt the case, so i am not sure why this would be happening. Try the new version and see if you can get it to work...
|
|
|
|
|
|
#12 (permalink) |
|
Join Date: Feb 2005
Age: 58
Posts: 17
|
Gets to "Installing mordero's RunUO Server Status Checker" And then sits there. Is it supposed to do something? And what do you mean the directory needs to be "chmod 775". As in this all has to be in a folder named "chmod 775"? I cannot make folders with spacing in the name.. I will look around on my host and see what I can learn.
But I put all that in and it still comes up "Status:" and thats it. Doesn't even ping my server. |
|
|
|
|
|
#13 (permalink) |
|
Forum Expert
Join Date: Nov 2003
Location: Illinois, USA
Age: 21
Posts: 2,908
|
chmod stands for change mode and is used for file permissions. The folder can be named whatever you like.
copy and paste this into a file in the same directory as your checkserver.php PHP Code:
|
|
|
|
|
|
#14 (permalink) |
|
Join Date: Feb 2005
Age: 58
Posts: 17
|
Complete string: Offline...
Just status: 0... Player's online: -1... I thought it would be obvious that I havent worked with php before. hehe sry. I even changed the timer part to "1" instead of "1800" to try and see if it was that at all, but that changed nothing. I look on my RunUo console. And it shows nothing. Right now my shard is not public so no one goes on so I'd be able to tell.. No activity at all. |
|
|
|
|
|
#15 (permalink) |
|
Forum Expert
Join Date: Nov 2003
Location: Illinois, USA
Age: 21
Posts: 2,908
|
Ok well since it says it is offline that means the ping isnt getting to your server and thats why you arent seeing anything... you need to look at the config file and make sure that the host is the correct ip or hostname
|
|
|
|
|
|
#16 (permalink) |
|
Join Date: Feb 2005
Age: 58
Posts: 17
|
Yes everything is input right. If you want to know the IP its. empireuo.no-ip.info. Server name Empire Uo. website = http://empire.awardspace.com.
I dont know whats wrong with it. Has anyone got this working? Sorry if Im bugging you. If you dont feel like helping me out anymore thats all good. I can go without the server status on the website =p =[ |
|
|
|
|
|
#17 (permalink) |
|
Forum Expert
Join Date: Nov 2003
Location: Illinois, USA
Age: 21
Posts: 2,908
|
Lol, no its fine, I dont mind helping you, but i have 3 exams this week plus classes and work, so I wont be able to even look at this really for a bit. But Ill see if iI can get it to detect your server and see what happens. I really dont know if there is something you need to set up on the RunUO side of things to make this work, but I think I found a function in PHP that will verify that your webhost can use those certain functions, so ill include that in the next version to check for compatability with the host of the site.
|
|
|
|
|
|
#18 (permalink) |
|
Join Date: Feb 2005
Age: 58
Posts: 17
|
Alright cool that would be awesome. And I got a crap load of work to catch up on too. =[ I havent even had my shard up for the past like 4 days. C# class ftl lol Doing. "do...while" statements right now. So annoying lol. But thanks for all the help!
|
|
|
|
|
|
#20 (permalink) |
|
Forum Expert
Join Date: Nov 2003
Location: Illinois, USA
Age: 21
Posts: 2,908
|
ahhh finally back... ok, i dont know how much time i am going to have to do this, but im gonna try to rewrite the installation script to make some more sense and make it easier and to also check to make sure you can actually use this. If you cannot get it to work still and until i figure this out, check out the other status check but remember, that it wont cache any results so everytime your page is refreshed, thats another ping to your server
|
|
|
|
|
|
#22 (permalink) |
|
Forum Expert
Join Date: Nov 2003
Location: Illinois, USA
Age: 21
Posts: 2,908
|
Wow, its been a while. And yes it works, its always worked, Ive ran it on multiple web servers and checked different shards and Ive not had a problem. You just need to make sure that you permissions are set correctly for the files and that you have sockets enabled for you php setup (check that by using this post). Ive changed it a bit to make it easier (I think), but Ill try to answer questions or if I have time, even try setting it up for you if you need me to.
|
|
|
|
|
|
#23 (permalink) |
|
Forum Expert
Join Date: Oct 2002
Location: Germany (american though)
Age: 32
Posts: 957
|
In your .zip file there are some errors.
In checkserver.php, line 111 should be $result = "<a class=\"serverstatus\" href=\"" . $protocol . "://" . $this->defaults['link'] . "\">Online" . $playersOnlineString . "</a>" . ""; I am unable to get the script to work though. Which rows are needed in the ServerStatus table? I curently have 3 rows, checked (date), status (text), amountOn (tinyint). When I use the check.php, I end up with (source code) Code:
<html> <head> <title>Server Status</title> </head> <body> Status: </body> </html> Fatal error: Cannot break/continue 1 level in /check/checkserver.php on line 183
__________________
Aeternum Shard Last edited by Jarrod; 12-09-2006 at 03:22 AM. |
|
|
|
|
|
#24 (permalink) |
|
Forum Expert
Join Date: Nov 2003
Location: Illinois, USA
Age: 21
Posts: 2,908
|
ok actually that line doesnt need that period at all so just delete it and it should be fine...
and i added the sql needed to create the table into the zip and that last error should be fixed by getting rid of the www.aeternum.org sorry about all that Last edited by mordero; 12-09-2006 at 03:29 AM. |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|