RunUO Community

This is a sample guest message. Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts, as well as connect with other members through your own private inbox!

Online status and players online

mordero

Knight
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.
 

Jarrod

Sorceror
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>

If I use the check routines you posted above, (I named it test.php), I end up with:
Fatal error: Cannot break/continue 1 level in /check/checkserver.php on line 183
 

mordero

Knight
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
 

mordero

Knight
Yeah, in the config file look for the cacheType and change it to 1. For that to work though you need to make sure you have your permissions set correctly so that the file can be written and youll have to mess around with that part on your own (change the interval to like 1 second and it will try to rewrite everytime it checks, but sure to change it back though when you are done cause otherwise it is a lot of unneccessary connection to your server on every pageload)
 

burncity

Wanderer
Hello... Have tried to get this working for 2 days now with no joy. All i get is a white page well sort of off white lol with nothing on it. I think i have everything right but i am not that clued up on all this sort of stuff but i am learning... any help would be appriciated...

Thanks

BurncitY
 

mordero

Knight
Ok, I made a script that will try to write a text file for a chache and attempt to open a socket, if they both work, you should be good, if the file doesnt write, then you need to fix your permission. If the socket has an error, you're gonna have to figure out whats causing it and check if you even are able to use sockets.

You will have to rename the extension of this file to .php because you cant upload php files on here.
 

Attachments

  • checkservertest.txt
    1.8 KB · Views: 60

burncity

Wanderer
Thanks for the reply... ;)

Go this back:

This will test to make sure you have the correct permissions set to write a text file cache and have sockets enabled on your webhost.
You need to make sure that the directory that this file is in is able to be written to (chmod 777 will definately work) and that this file is able to execute (777 again).
Trying to write file: Success in writing file. Check for "CheckServerText.txt" in this directoy.
Trying to open a socket: Sockets successfully opened!!
If sockets were successfully opened and the text file was written, you should be able to use the server checker.

Text file created... So what am i doing wrong... lol
Will keep trying and see if i can get it working... Will keep you up to date with my progress.

Thanks

BurncitY
 

mordero

Knight
Ok, I should have made that thing a while ago lol. Now that we know you are able to do that, you need to make sure that the servercheck.php has the permissions 777, that way it can write and execute and all that. Then try setting up a test page (Im pretty sure that the header of servercheck.php has an example and I might have even included one in the zip) with an interval of 0 that way it will always try to ping the server and see what comes up.

Its been a while since ive looked at the zip, so if a sample wasnt included or there isnt one in the header, ill write one up for you real quick :)
 

burncity

Wanderer
Getting some where now... Still not working though... Getting this now...

Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.

My head is starting to hurt now... lol
 

burncity

Wanderer
This is in the header:

/**
* Filename: checkserver.php
* Version: 1.8
* Author: mordero (*********)
* -Look at the checkserver-config.php file that is include and replace with your values
* -You will need to adjust you permission levels for the directory that these files
* are in (0777 should work, but try setting it lower if you can)
* Usage:
* include_once "checkserver.php";
* $checkserver = new checkserver();
* print $checkserver->statusCheck();
*
* This will output Status [Number Online]
* eg Online [5]
* $checkserver->playersOnline will return just the number online
* $checkserver->status will return just the status
 

mordero

Knight
ok, well you need to look through the config file and make sure all that stuff is the values you need (the interval needs to be 0 for this test) and then make a page like this
PHP:
<?php
include_once "checkserver.php";
$checkserver = new checkserver();
print $checkserver->statusCheck();
?>

and it should work, if not then we'll figure something out
 

burncity

Wanderer
Ok did all that and still "Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request." Not sure what is wrong..
Thanks for the help though...

BurncitY
 

burncity

Wanderer
Code:
<?php
$defaults = array( // array holding all of the adjustable values
    'host' => "213.228.232.34", //the IP or DNS of the server, do not include http://
    'port' => 2593, // the port to ping, defaults: RunUO : 2593
    'link' => "2F20BBBDC5CD7B930C1CCF7DF9B3BD61", // the URL or UOGateway ID for the server, do not include uog or http
    'RunUO' => true, // true if it is a RunUO server, false if it isnt
    'cacheType' => 3, // 1 is cacheFile, 2 is database, 3 is both, see header of checkserver.php for more details, it is assumed to be 1
    'cacheName' => "servercheck", // this is the name of the file where the status will be store, dont include ".txt"
    'interval' => 0, // the time between checks, in seconds, default is 30 minutes and if set to 0, no cache will be made and will check every page load
    'dbname' => "****",//database name
    'dbuser' => "***",//database username
    'dbpassword' => "******",//database password
    'dbhost' => "localhost",//database host, keep it localhost majority of time
    'dbtable' => "serverstatus", //the table to store values
    );
?>

Is this correct...?
 

mordero

Knight
yeah, those look good
you are getting an internal server error? Ive never had that problem with any php script ever, so im not sure whats causing that. IM in class right now but ill see if i can write up something sometime tonight that will do some more checks for you. Sorry :( Until then, see if there is a error log somewhere on your server and see if it mentions anything about this.
 

mordero

Knight
well... crap, i was thinking it might have been some edits i made a while ago that got rid of some checks, but i just uploaded everything to my server and everything worked fine... ill keep working on it when i can though and try to figure out whats wrong.

I know you have probably done this, but i just want to make sure, check.php and checkserver.php needs to have chmod 777, as well as the directory that its in (this can be changed later, but this will make sure there are no problems with permissions), and checkserver-config.php needs to be chmod 644.

All of the files need to be in the same directory and checkserver.php and checkserver-config.php need to keep their filenames the same (check.php can change).

In the config:
Try setting the cacheType to 1 that way it doesnt mess with the database stuff and the interval to 0.

I know youve prolly messed with all of this, but i just want to make sure.

Sorry for your problems :(
 

burncity

Wanderer
Well checked it over again and made sure of the correct chmod, changed the cachetype but still the same error....

Thanks for all the help

On another note, I have another web site form the same host and run some modules of it. One on that site is a Teamspeak module. I wanted it on my other site the one in question, I uploaded it to this site, installed it set it up to the relevent ts server but nothing says it is offline... So the question is are these two errors linked somehow
 

mordero

Knight
Hmmm i dunno if they are related....

But I did do some research on the error you were having. Could you find out what type of server you're host uses and which version of apache? Because there is a bug with some versions of Apache2 and some versions of php where the script is sending out all of the information before apache is ready for it. Sometimes it fixes itself for a bit and sometimes it just keeps doing it. So if you could get my your version of apache (if your webhost uses it) and your version of php, ill see what i can do.
 
Top