These forums have been archived and are now read-only.

The new forums are live and can be found at https://forums.eveonline.com/

EVE Technology Lab

 
  • Topic is locked indefinitely.
 

Teamspeak and phpBB Forums EVE Online API Registration System

Author
Drake Draconis
Brutor Tribe
Minmatar Republic
#41 - 2011-09-15 04:42:00 UTC  |  Edited by: Drake Draconis
MisterMagotchi wrote:
Balani: I guess I should put in the requirements that it requires PHP 5.3.0 or greater.

The ( EOL ) sections aren't the problem. It's the ( 'EOL' ) (with a single quote on each side of EOL) that only work in PHP 5.3.0 or greater. You can either upgrade your PHP, or you might be able to just find and replace every occurrence of the second thing with the first thing, and it should work fine, but you might have to put a backslash ( "\" ) before the dollar signs in the javascript section in index.php (located in lines 136 -161). This syntax it's currently using is called Nowdoc in case you're wondering.



Guess what.... got dinged too.

I'm running 5.2.x

Good luck asking my host to update that...they're paranoid like hell.

>.< *Bangs head on desk*
Guess I'll need to make those changes.

EDIT: The changes you suggested to fix are not working.

Code Example:

Yours Says


'EOL'


Should it say


EOL


I did a find replace and that seemed to stop the PHP Parser from spitting nails.


The API Registration page will not load the key or go to the next screen.
Errors out saying "wrong information"

I put "\" in front of the dollar signs (coincidentally it goes further than 161 ;) ) but its still not working.

PS: I'll not be able to make any changes until tomorow night...and even then It'd be nice to have someone to check my syntax with without having to wait hours >.<;;; So any clear cut suggestions for this out of practice noob would be great!

================ STOP THE EVEMAIL SPAM! https://forums.eveonline.com/default.aspx?g=posts&t=78152

MisterMagotchi
Deep Core Mining Inc.
Caldari State
#42 - 2011-09-15 05:35:13 UTC  |  Edited by: MisterMagotchi
You should tell your host that PHP 5.3 has been a stable release for 2.5 years and that they need to get their act together if they want to keep business.

If you have 5.2.x, then certainly the 'EOL' (nowdoc) syntax won't work and the single-quotes must be removed. Furthermore, you'll need to find any situations where there are dollar signs in the heredoc string and escape them with a backslash, but I believe only the index.php has a section like that. I know this is just a rephrasing of what I already wrote.

If you absolutely cannot update away from your old version of PHP, I am willing to walk you through fixing the errors in comms, (your Ventrillo if you want). I don't have an old version of PHP to test on.

Also, the reason it goes past line 161 is that we weren't even talking about the same version of the code that exists now.

EDIT:
Apparently you don't need to escape the $ signs. I just tried it (switching from nowdoc to heredoc on that section), and it worked fine without doing so. You only need to do that sometimes, in cases where PHP could easily mistake the $ for a variable, like if a letter comes immediately after it. I guess since that jQuery code all starts with "$(", it's not a problem.

Also, here's a list of files that have the 'EOL' (with single-quotes):
admin/index.php
index.php
eve-api-get-names.json.php (a file index.php makes use of when doing the AJAJ stuff)
Drake Draconis
Brutor Tribe
Minmatar Republic
#43 - 2011-09-15 17:05:13 UTC
Using Coda last night I maanged to find and replace each and every EOL...only thing is I dont know if spaces should be inserted or not after the ">>>"


The pages load up ok but the API key isn't showing up...or im not sure whats supposed to happen.

I just put in the key and the verification code and it sits there.

So I may have had a syntax error somewhere I missed.


To top that off... my vent provider screwed me over this moring when they moved my server and nuked the entire useraccount database... kinda got my hands full.... not sure if ill get back to this tonight or not. *facedesk*

So should I remove the backslashes from $'s and then just make sure EOL's are ok?

================ STOP THE EVEMAIL SPAM! https://forums.eveonline.com/default.aspx?g=posts&t=78152

MisterMagotchi
Deep Core Mining Inc.
Caldari State
#44 - 2011-09-15 19:50:01 UTC
The dollar signs don't need backslashes, and there should be absolutely no spaces on the same line after EOL. I would just replace your index.php with the latest copy and replace all the 'EOL' (with single-quote) parts with EOL (without single-quotes).
Drake Draconis
Brutor Tribe
Minmatar Republic
#45 - 2011-09-15 19:57:35 UTC
MisterMagotchi wrote:
The dollar signs don't need backslashes, and there should be absolutely no spaces on the same line after EOL. I would just replace your index.php with the latest copy and replace all the 'EOL' (with single-quote) parts with EOL (without single-quotes).


OK.

What does EOL really accomplish?

I tried to decipher the syntax by checking PHP manuals and didn't get anywhere.

Best I could come up with an educated guess is "End of Line"

something along the lines of PHP_EOL which is a more formal better "\n" char or even a "\r"


Additionally... could you detail whats supposed to happen when you go to the reigstration page for API check.
And I didn't catch where to set group assignments at.

In other words...alliance member signs up...want him in the alliance membership group...etc.

I saw in your configuration file where to set ignoring of groups however.


Additioanly... the section where you put in the DB information.... I presume thats where you go to sign into the SQL Database right? *attempting to troubleshoot why the reigstraiton page keeps erroring out when checking*

================ STOP THE EVEMAIL SPAM! https://forums.eveonline.com/default.aspx?g=posts&t=78152

MisterMagotchi
Deep Core Mining Inc.
Caldari State
#46 - 2011-09-15 21:27:20 UTC
I can't write the syntax on these forums exactly, because whenever I post left less-than signs (angle brackets), I get an error that I can't post HTML.

Heredoc and nowdoc syntax are documented at the Strings page of the PHP manual.

"EOL" is just the string delimiter I choose for my code. The delimiter could be anything, including "TACOS".

Here's how the registration page works: A user visits the registration page. They see the form as in the screenshot (with some minor variation based on your config.inc.php settings). They enter their API Key ID and API Key Verification Code. Once they change focus away from either the Key ID or Verification Code boxes, and if there is something in them, the AJAJ process starts (using a Javascript "onchange" event), calling the "eve-api-get-names.json.php" script. "eve-api-get-names.json.php" does some basic validation of the Key ID and Verification Code, then it gets their character list via the API page "account/APIKeyInfo.xml.aspx". If the key works, the access mask is correct, the account type is correct, and they have at least one character in a configured corp., the script sends that data back to the registration page, and Javascript plugs those names into the Character Name dropdown box. If the key had an expiration date, the user is warned about that as well. If there was an error, the error is shown instead, and the first two fields are cleared. The user then enters their TS UID and submits the form (if that's enabled). Most of the same API things are then verified again, except using the character name they specified. Some other things related to their forums account are verified. It's verified that the TS UID they entered has been used before on the TS server (if that's enabled). Their entry in the EVE Registration table is then either added (or replaced if it already exists). The check-users.php script is then called.

Group assignments are done in config.inc.php at and after line 80 of the current version with the $config['Corps'] array. There is a giant block of documentation above it.

The Forums DB information is the connection information for connecting to the database your installation of phpBB uses. This should match the information in config.php in your phpBB installation's files.
Drake Draconis
Brutor Tribe
Minmatar Republic
#47 - 2011-09-15 22:02:58 UTC
Strange..based on what you said...i have no idea why the java didn't kick in then.

as to the configuraiton page...musta missed that portion of the code...I'll have to take a closer loko at that.

thanks so much for the information. Should help me sort out why its not functional.

================ STOP THE EVEMAIL SPAM! https://forums.eveonline.com/default.aspx?g=posts&t=78152

Drake Draconis
Brutor Tribe
Minmatar Republic
#48 - 2011-09-16 14:00:39 UTC
Looks like I'll have to start fresh...dug myself into a hole...but got an additional question.

Your documentation says corporate ID's for group assignments.

Is it possible to use the Alliance ID number?

PS: This weekend I'll plenty of free time to finally get it off the ground.

================ STOP THE EVEMAIL SPAM! https://forums.eveonline.com/default.aspx?g=posts&t=78152

Phoebus ApolloX
The Scope
Gallente Federation
#49 - 2011-09-16 14:18:05 UTC  |  Edited by: Phoebus ApolloX
Hey, first of all good work so far this project is pretty good. I did however run into a couple hiccups that I figure I'd post about while it's still fresh.

Problem 1: I disabled TS3 server features as my TS3 host doesn't seem to have a place to access and edit my whitelist, and TS3 registration isn't a huge deal to me. However every time the replace SQL query would run to add a new api key it'd eliminate the previous key, forcing me to keep only one key in the database at a time. I checked and rechecked, tried different query methods, and no dice. Found out after a lot of fiddling that the key for the TS UID is set to "unique", and every record I'd attempt to add was adding it with a value of "NULL", which was making the MySQL server gurgle. I changed that database column to "index" and I believe that has fixed my problem (still testing).

Problem 2: After letting someone test it out, they would get added to the right group but not be able to see the forums. It seems they were cached with the permissions prior to the edit, and having them relog didn't update their forum permissions. I found that by setting user_permissions to blank in check-users.php with a query just after the "setting default forums group" query, this fixed that problem. Here is the query I added.

edited out: the three less than signs before the first EOL

Quote:
$query = (less than signs go here)EOL
UPDATE {$config['Forums DB']['Table Prefix']}users
SET user_permissions = ""
WHERE user_id = {$forums_user['ID']}
EOL;
mysql_query($query) or log_message('Error clearing user_permissions. User: ' . $forums_user['Username']);


I also want to note that I am on php 5.2 and that with the current iteration of the code replacing all the 'EOL' with EOL definitely works just fine.
MisterMagotchi
Deep Core Mining Inc.
Caldari State
#50 - 2011-09-16 23:04:31 UTC  |  Edited by: MisterMagotchi
Drake:

No. The instructions do show you how to quickly grab a list of every corp. in an alliance, but you will have to update your config as corps. join or leave your alliance. I'll think about this and it may be a feature down the road.



Phoebus:

Problem 1: Good catch. That's exactly right. That would certainly be a problem. As I said upon releasing that feature, I figured there was a chance it may have issues. I had only tested with myself, so it was the only record,and I didn't notice. For optimization's sake, it's better to have that as a unique key, but I guess a regular index will have to do the trick for simplicity's sake combined with the option to disable TS.

Problem 2: Good catch again. I hadn't noticed, as we don't use our forums much at all. I'll figure out the exact proper way that phpBB does that when it does group assignments and make that happen. I think clearing user_permissions may cause problems with actual user-specific permissions admins can give users in phpBB.

I'll be releasing a new version with these fixes soon, and I think I'm going to get rid of all the nowdoc stuff (in favor of heredoc). I'm a fan of nowdoc, because I don't see the point of parsing for variables when there's no need, but it's not too intense of a script anyway, and if it opens it up to more people, then I guess it's worth it.

Update: Apparently the "user_permissions" field is a cache that is regenerated if empty, so your solution is exactly correct, and I'll have the code do it in that manner.
MisterMagotchi
Deep Core Mining Inc.
Caldari State
#51 - 2011-09-17 01:20:09 UTC  |  Edited by: MisterMagotchi
New version released.

From my changelog:
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.

Changed files (replace): readme.html, eve-api-get-names.json.php, index.php, check-users.php, create-table.sql, admin/index.php

Added file: update-table-153-154.sql
If updating from 1.53 (or below) to 1.54 (or above), import this SQL file into your phpBB database or otherwise run its contents. This database update is not required if you use the Teamspeak functionality of this script.



Current known issues:

Forums username colors don't get updated when a user's groups are changed, as phpBB caches them in several places. In order to fix this, the best way will be to require the path name of the phpBB installation and then use phpBB's functions for user management. I will probably do this eventually, but it's a somewhat heavy update, and I consider the colors to be a minor problem at the moment.

If a user fails the API key check and their permissions are therefore revoked, their default phpBB user group will become 2 (Registered Users). If you have modified the Registered Users group or use the COPPA group, this may cause an issue.
Drake Draconis
Brutor Tribe
Minmatar Republic
#52 - 2011-09-17 02:00:09 UTC
MisterMagotchi wrote:
Drake:

No. The instructions do show you how to quickly grab a list of every corp. in an alliance, but you will have to update your config as corps. join or leave your alliance. I'll think about this and it may be a feature down the road.





Would be graet if it did...less opprotunities to mess with critical core files the more reliable the package.

But so noted...I'll stick with corp ID's from here on out.

================ STOP THE EVEMAIL SPAM! https://forums.eveonline.com/default.aspx?g=posts&t=78152

Drake Draconis
Brutor Tribe
Minmatar Republic
#53 - 2011-09-17 05:15:42 UTC
is it possible to get on a mailing list to be alerted to updates to your package? Big smile

And thanks much for the changes! Cool

================ STOP THE EVEMAIL SPAM! https://forums.eveonline.com/default.aspx?g=posts&t=78152

Drake Draconis
Brutor Tribe
Minmatar Republic
#54 - 2011-09-17 05:27:12 UTC
Ok its not pulling the API key... its just sitting there.... I'm pretty sure I got all the files updated as specified... the DB connection is good... so whats causing it to not load the API information?

================ STOP THE EVEMAIL SPAM! https://forums.eveonline.com/default.aspx?g=posts&t=78152

MisterMagotchi
Deep Core Mining Inc.
Caldari State
#55 - 2011-09-17 06:26:43 UTC
I don't know, and responding back and forth on the forums here isn't the best way to troubleshoot. Send me a mail with your comms. information or something so we can work it out.

I don't plan on making a mailing list about this. I wish the forums would email people notifications of watched threads, but they don't, and I agree that it's irritating.
Drake Draconis
Brutor Tribe
Minmatar Republic
#56 - 2011-09-17 17:44:40 UTC
Sent email. Look forward to contacting you.....

================ STOP THE EVEMAIL SPAM! https://forums.eveonline.com/default.aspx?g=posts&t=78152

Phoebus ApolloX
The Scope
Gallente Federation
#57 - 2011-09-17 21:28:19 UTC
I ran into an unexpected behavior. The updating bot script seems to add people to the correct forum group, but when API keys get deleted or characters with a valid API get booted from corp it doesn't seem to be removing them from the group. I let the script run overnight in case it's just a cache issue.

I haven't looked too far into it yet, but I'd appreciate any suggestions in pinning down the problem. I've updated the script to the version last supplied.
MisterMagotchi
Deep Core Mining Inc.
Caldari State
#58 - 2011-09-17 22:43:03 UTC  |  Edited by: MisterMagotchi
Phoebus:

I just did some testing on it, and it appears to work correctly:

I did API registration for myself. I deleted my API key (at CCP's site). I then tweaked my Cached Until time to be really old. Then when the cron job kicked in and did the check, since the API's "account/APIKeyInfo.xml.aspx" for my key ID and verification code was still cached (CCP currently caches it for about 5 minutes), my groups in TS and the forums were not changed. I changed my Cached Until time again to something old. This time when the cron job ran, my groups were revoked in TS and in the forums, and I verified that my user_permissions field in the "users" table was cleared.

Let me know if it still doesn't work for you.
Phoebus ApolloX
The Scope
Gallente Federation
#59 - 2011-09-18 00:31:20 UTC
How old does cache time need to be before it runs a check?
Drake Draconis
Brutor Tribe
Minmatar Republic
#60 - 2011-09-18 01:15:16 UTC
Ran a test to act as if I booted a corporation. Still hasn't kicked said users... how long before it actually does that? Seems kinda odd that it hasn't done that as the cache has come and gone. (All I did was remove the entry of the corp in the config file)

================ STOP THE EVEMAIL SPAM! https://forums.eveonline.com/default.aspx?g=posts&t=78152