Teamspeak and phpBB Forums EVE Online API Registration System
Features Summary
- Uses the new, customizable API keys system
- Manages both phpBB (forums) and Teamspeak group membership
- Teamspeak functionality is optional
- Automatically puts users in groups in Teamspeak and phpBB based on EVE corporation via EVE API
- Automatically removes users from those groups if their API information becomes invalid or if they are no longer in a configured corporation
- Automatically switches members between corp. groups if they switch from one configured corp. to another
- Several corporations can be assigned to the same Teamspeak or forums group if desired
- Users can re-do the API registration as many times as they need to
- Provides an admin interface for admins to view a list of registration information and the error log (for troubleshooting)
- Minimum required customizable API key access level and key type (Account or Character) are configurable
- Optionally, sets users' EVE character avatars as their forums avatars (code idea by Rache Le'Bonbon)
- Reasonably well-documented code for easy customization
Screenshot
Registration Screen
Changelog
-
2011-09-01 - 1.0 - Initial release
-
2011-09-05 - 1.01 - Added phpBB table prefix support.
-
2011-09-05 - 1.02 - Fixed another issue with table prefixes.
-
2011-09-12 - 1.50 - Dramatic rewrite, uses new customizable EVE API key system, has separate registration page, etc. Complete uninstall of old version required for installation of this version
-
2011-09-13 - 1.51 - Very minor fix. Registration form wasn't correctly showing all names from configured corps.
-
2011-09-14 - 1.52 - Registration form script now verifies that the TS UID entered is recognized by the TS server (meaning the user has been in the server before and the UID is correct) and gives them an error otherwise. The instructions were clarified a little more on the registration page. Other minor typo fixes and code cleanups.
-
2011-09-14 - 1.53 - Made Teamspeak functionality optional. Other minor documentation and textual changes.
-
2011-09-16 - 1.54 - Made TS UID no longer a unique key in DB table to fix bug when TS functionality was disabled. Made check-users clear a user's permission cache after updating their group to fix users not being able to use their new group's permissions. Replaced all nowdoc syntax with heredoc syntax to allow PHP older than 5.3.0. Made index.php update PHP last_poster/topic_poster name cache in the topics table when changing a username.
-
2011-09-21 - 1.55 - Fixed users with single-quotes in their EVE character names not being able to register. Made check frequency configurable. Minor documentation changes.
-
2011-10-06 - 1.56 - Fixed users having registration deleted when EVE API server gives error messages other than authentication failures. Made similar fix in registration script to differentiate between a bad key and the API server giving other errors. Added forums link to end of registration script success message. Caused the Username column to sort case insensitively in registration list. Minor documentation changes.
-
2011-10-11 - 1.57 - Now uses cURL if available or url_fopen wrapper if not. PHP command (path to PHP binary), as used in registration script, is now configurable. Fixed users with single-quotes in names not being able to log in to forums after doing API registration. Fixed name of last poster in a forum not updating when a username is changed due to API registration. Added loading indicator in registration page while waiting for character names box to populate. In the previous release, the updated index.php (registration script) was accidentally omitted, so the changes mentioned for 1.56 involving it are now in effect. Minor documentation changes.
-
2011-10-20 - 1.58 - Removed dependency on PHP mbstring module inadvertently caused by last update's single-quote fix. Made registration script force usage of UTF-8 character set when updating a user's username_clean (related to single-quote issue). Added ability to set EVE character avatars as forums avatars (code idea by Rache Le'Bonbon). Minor documentation changes.
Requirements
- PHP 5
- cURL must be available or allow_url_fopen must be on
- magic_quotes_gpc must be off
- MySQL
- Linux or Linux-like OS
- Basically it should still work fine in Windows, but it uses the "tail" command once in the Registration List script (/admin/ page) to show the last 10 log lines, so that will break.
- Apache's AllowOverride setting
- Allows blocking direct web access to files via .htaccess. Alternatively you can block direct web access to the check-users.php script and errors.txt in some other way.
- Usually enabled on shared hosting
- PHP's SimpleXML
- Enabled by default in PHP 5.1.2 or newer
- phpBB 3
- Must be on the same domain (hostname to be exact)
- Teamspeak 3
- Doesn't need to be on the same server
- Cron
- Alternatively, the ability to otherwise make php scripts run in a timed manner.
Download
teamspeak-phpbb-eve-api-registration-2011-10-20-v1-58.zip
Installation
- Put everything from this package somewhere in your publicly accessible web space.
- This will determine the URL of the registration page (eg. "example.com/eve-api-reg/" if extracted to the root of your web space and not renamed).
- Make errors.txt writable by the web server user.
- Either make it owned by the user the web server runs as or allow others to write to it (chmod 666).
- Edit config.inc.php to your liking.
- All settings in there are obvious and/or documented.
- If running Teamspeak and this script on different IPs, make sure the IP of the server which will run this script is added to query_ip_whitelist.txt in your Teamspeak 3 installation directory.
- I assume you need to restart TS3 for this to take effect.
- Import the create-table.sql file into phpBB's database.
- It creates one empty table called "EVE Registration".
- This can be done via the command line mysql command or with a tool like phpMyAdmin.
- Create a cron job to run the check-users.php script often.
- For example, * * * * * php /home/username/public_html/eve-api-reg/check-users.php > /dev/null 2>&1 (with your actual path) would run the script every minute (advisable) and not email you any output.
- If "php" doesn't work for invoking PHP 5 on your host (non-standard), you'll need to replace it with the command needed to run PHP 5 on your web host. If you need to change it here, you'll very likely need to change it in the "PHP Command" setting in the configuration as well.
- More info available on the cron Wikipedia article or the cron manual
- Alternatively, you could allow access to it via the web (remove it from the .htaccess), give it a random URL that nobody else knows, and call it remotely from another server or computer (maybe via a Window Task Scheduler job which browses to the page or something similar).
- Add a link, preferably in the main navigation of your forums to the registration page (eg. "/eve-api-reg/" if the package was extracted to the root of your web space and not renamed).
- For example, the following would work if pasted into any phpBB style template file: <!-- IF S_USER_LOGGED_IN --><a href="/eve-api-reg/">EVE API Registration</a><!-- ENDIF -->
Components
- index.php
- The registration page
- Does some dynamic AJAX/AJAJ stuff to walk the user through the registration process
- Verifies submitted data and puts it in the registratin database
- Calls the check-users.php script when a user successfully registers
- admin/index.php
- Lists all registrations and each user's registration data.
- Shows last 10 registration errors.
- Sortable
- check-users.php
- This script does most of the actual work.
- When run, it attempts to check the API of 1 user and update their forums and TS groups as necessary.
- It will only check a user if the current time is past their EVE API CachedUntil time if they're in TS. Otherwise, it will check them if it's at least 23 hours past it. The default cache time for EVE API character list data used to be 1 hour, but it seems they've lowered it, maybe temporarily for testing purposes due to the new key system, so if a check happens and the CachedUntil time is less than 1 hour away from the check, 1 hour from the check will be stored instead of the actual CachedUntil time. These frequencies are configurable.
- Users are prioritized first by whether or not they're in TS (people in TS first), and then by how old their CachedUntil time is (older first).
- Of those users who've never been checked, those with the highest forums user IDs (newest registrations) are prioritized, in order to make it almost certain they'll be instantly given rights after they register.
- It never currently checks a specific user when run, but instead goes by the above priorities. This means that while it'll very likely instantly give a user rights in TS and to forums groups after they successfully register (assuming they're in TS), it's not guaranteed.
- config.inc.php
- Configuration, documented
- create-table.sql
- MySQL script to create the necessary "EVE Registration" table to store the registration data for each user
- errors.txt
- A log of registration errors and notices.
- You can clear it from time to time or use Linux's logrotate on it, but it needs to stay writable by the web server if you want logging to keep working.
- .htaccess
- Blocks access via the web to viewing errors.txt and to running the check-users.php script
- setup.inc.php
- Contains some shared functions that both the check-users.php and index.php scripts use
- eve-api-get-names.json.php
- Provides the data for the AJAX (actually AJAJ) dynamic Javascript functionality of the registration page
- TeamSpeak3 folder
- update-table-153-154.sql
- "EVE Registration" database table update for updating from 1.53 or below to 1.54 or higher, and only required if Teamspeak functionality is disabled