really half-assed thing i half-assed in 2012

Leah Rowe 3e95326eab shit i did in 2012 hace 1 año
software 3e95326eab shit i did in 2012 hace 1 año
COPYING 3e95326eab shit i did in 2012 hace 1 año
README.txt 3e95326eab shit i did in 2012 hace 1 año
oachecker.sql 3e95326eab shit i did in 2012 hace 1 año

README.txt


someone on libreboot irc mentioned xonotic which is based on the
ioquake engine, and then i remembered i still had thing code i wrote
for openarena back in 2012.

it shows stats on a web page, for players in a server. for example
if you have a website for your game server. runs in the backend, so
you have to refresh the page. you could probably write some javascript
thing that just calls this every once in a while dynamically, or just
rewrite this in javascript.

i used this for openarena, but it should work with other games that
use the dpmaster list, like xonotic

NOTE:
This is largely unedited, from what I wrote in 2012. The code
is unchanged. I decided to actually release this out of boredom today,
on 7 April 2023, but I wrote this code some time during 2012.
I also changed the license, for release. I never actually released
this before, but i used the 4-clause openbsd license for some reason.
this release, that you are seeing now, is under MIT license.
(this readme aswell. see COPYING file)

BUG:
Sometimes the mailer will just spam endlessly, detecting wrongly
that a server is offline because the *master list* (dpmaster) was
down or couldn't be pinged or whatever. that should be fixed.
(there's probably an exploit or two in this code aswell. don't
use it unless you've audited it and fixed it - patches welcome i guess)

also it literally just uses the php mailer, so make sure mail is properly
configured on your system that you run this on

other than that, this was a pretty solid half-assed thing i made
in 2012 when i was really into openarena. enjoy!

The original readme text from 2012 is as follows:
___________________________________

How to use
--
make sure you install first (see below)

on the page where you want to display server statistics, add the following code:
include "oadisplay.php";
?>

for the above to work, the page must be a *.php.
However, some webhosts also allow PHP code execution on *.htm or *.html

it is recommended to extract oachecker software into the root of your website.

configurator.php is independant, it can generate its own pages.
but oadisplay.php is supposed to be used on a page of your own.


Before you can use the software, there are some configuration steps that are needed,

NOTE: oagenerate.php and oaparse.php are just libraries (they have useful functions)
dont use these directly, just include oadisplay.php on your page.
it will do the rest.


How to install
--


import sql file into your mysql database using phpmyadmin

edit software/oaprotected/common.php
- look in function dbConfig()
- edit variables 'host','database','user' and 'password'
(mysql host, normally 'localhost' or mysql.domain.com, etc)
(database you want to use)
(database username)
(database password)

upload the contents of the 'software' folder to a location of your choosing.

in your web browser, goto where you installed the software on your webhost,
and open the page 'configurator.php'

By default there is no user/pass needed

Add at least 1 admin (user/pass/email), and then a user/pass will be needed
(the user/pass that you enter)

Add the IP and Port of your OA server in configurator.php

Make sure that the right qStat list is specified
(most OA servers use dpmaster.deathmask.net, so the default entry should be fine)


--

oacron.php

in your webhost control panel (each panel differs depending on hosting software),
set a cron job to run oacron.php every 10 minutes

you could also choose other intervals, but 10 minutes is reasonable.
Consult with your webhosting provider for how to setup a cronjob

Note: Linux webhosting is required for setting cronjobs.
You probably use Linux hosting, most people do.


Thats it.
Add any more users/servers that you want in the future.
You could also add new users for others, and add their server address,
so that they know when the server goes down or comes back online.

--

.htpasswd / .htaccess

set a .htaccess password on the 'oaprotected' folder in your webhost control panel
(or make the .htaccess file yourself in a text editor)