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
MisterMagotchi
Deep Core Mining Inc.
Caldari State
#121 - 2011-10-10 21:40:18 UTC
Rache: I'll try to help you with that tonight (in a few hours, after work).

You might check your Teamspeak logs though, to verify that it indeed has never connected to the server.
Rache Le'Bonbon
Aliastra
Gallente Federation
#122 - 2011-10-10 21:45:25 UTC
Found my problem! others may want to take not if it hasn't been said before. In the config

$config['TS Server']['Script Nickname'] = 'EVE Registration bot';

I had

$config['TS Server']['Script Nickname'] = 'EVE Registration Assistant';

I guess there is a limit on the length of the script nickname that can be used. Assistant will not work and give an error as if it cannot connect each time. But bot works just perfectly!

Just an FYI for anyone in the future to take note of!
MisterMagotchi
Deep Core Mining Inc.
Caldari State
#123 - 2011-10-10 21:47:51 UTC
Cool, Rache. I'll have to look into that limit and put it in the config. documentation.
Drake Draconis
Brutor Tribe
Minmatar Republic
#124 - 2011-10-10 22:25:42 UTC  |  Edited by: Drake Draconis
MisterMagotchi wrote:

Drake:
Either you haven't had anybody lose their registration and haven't otherwise had errors, or there's a problem. Try editing your entry directly in the EVE Registration table in the database so that your Verification Code is invalid, and set your Cached Until timestamp to something way in the past, and see if it then revokes your privileges and puts an error in the log.


The day the API server took a nose dive prior to your patching it revoked the rights of every member on the list...but only reported my name as such in the error log.

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

Rache Le'Bonbon
Aliastra
Gallente Federation
#125 - 2011-10-10 23:06:26 UTC  |  Edited by: Rache Le'Bonbon
Here is another issue I found and have corrected. I have only found this issue to cause any problems but you may want to update the script.

in index.php Line 209

$corp = get_eve_corp ($_POST['Key_ID'], $_POST['Key_Ver_Code'], $_POST['Character_Name']) or die('Error getting corporation information with submitted API information.');
if ($corp == -1) { //connection error
die('Error connecting to EVE API server to verify corporation membership. Please try again later.');
}

Should be

$corp = get_eve_corp ($_POST['Key_ID'], $_POST['Key_Ver_Code'], stripslashes($_POST['Character_Name'])) or die('Error getting corporation information with submitted API information.');
if ($corp == -1) { //connection error
die('Error connecting to EVE API server to verify corporation membership. Please try again later.');
}

The reason for this change is for people that have names like mine with a ' in the name. This caused problems and could not verify the corp with the character because it had a slash in it. IE Rache Le\'Bonbon. The fix will remove the slash and allow the script to run properly.

Found one more issue that this causes. When it updates the forum, it adds the slash as well. Will have to figure out were in the code this is and update the fix.
TA5E
Caldari Provisions
Caldari State
#126 - 2011-10-10 23:52:00 UTC
Replacing in the exec the command from php to /usr/bin/php5 doesn't affect the result here on 1and1

Still warns about => exec() [function.exec]: Unable to fork [/usr/bin/php5 -v]
MisterMagotchi
Deep Core Mining Inc.
Caldari State
#127 - 2011-10-11 00:26:41 UTC  |  Edited by: MisterMagotchi
TA5E: I don't know. It works for Drake, and he's on 1&1. EDIT: If you have shell access, play around in it until you can figure out the correct path to PHP. Clearly since you can do "echo", your account allows the exec command, as you established, and I know 1&1 uses suPHP (PHP runs as your username), so the same path you would use to run php from the shell should work in exec.

Rache: Although from looking it, you should be right, I do have a character in my corp. with a single-quote in his name, and he registered just fine after my 1.55 update. I'll probably correct that anyway, though, after doing some testing to see why it worked for me in the first place. It might be that you have Magic Quotes on in PHP, which would then be double-escaping things unnecessarily.

EDIT: I also verified that it didn't put a backslash on his name in the database.

EDIT 2: I figured it out. As per my 1.55 fix, the $_POST array is not escaped at all. On line 181, an escaped copy of $_POST is created solely for database query use ("$post_db"). You very likely have Magic Quotes on, and I'm going to add that to the documentation as a requirement (that magic_quotes_gpc be set to Off). Even according to the PHP manual, "This feature has been DEPRECATED as of PHP 5.3.0. Relying on this feature is highly discouraged."

Drake: I don't know why. Mine was filled with log lines of people being deleted, but I didn't lose everybody (since I caught it in time). The moral of the story is that backups are key, always. Sorry for the loss, though. Is it logging other things correctly?
Rache Le'Bonbon
Aliastra
Gallente Federation
#128 - 2011-10-11 02:06:50 UTC  |  Edited by: Rache Le'Bonbon
Thanks, Yea I will have to modify the script to turn off magic quotes for this site. Would be easier than updating the whole thing, but it would be a good thing to note in doc's. BTW thank you for taking an active roll in your script, so many make it and you never hear from them again!

This added to the top of index.php took care of all slashes if you magic quotes are turned on. May be a good thing to add just so its a non issue.

if (get_magic_quotes_gpc()) {
$process = array(&$_GET, &$_POST, &$_COOKIE, &$_REQUEST);
while (list($key, $val) = each($process)) {
foreach ($val as $k => $v) {
unset($process[$key][$k]);
if (is_array($v)) {
$process[$key][stripslashes($k)] = $v;
$process[] = &$process[$key][stripslashes($k)];
} else {
$process[$key][stripslashes($k)] = stripslashes($v);
}
}
}
unset($process);
}
Curson
The Scope
Gallente Federation
#129 - 2011-10-11 04:29:25 UTC
Ok first off, excellent work being the first to actually attempt this with the new keys. From the posts here seems fairly solid.

However in my case we are hitting a wall with no real explanation. After Key entry when the user goes to click the character selection drop down the setup holds for second (It doesn't lock up) It seems to be attempting to contact the API server then returns with a message...

"Error Contacting API server"

Now I'm pretty sure of the culprit but before I proceed, is this the error that was displayed due to the 'EOL' vs. EOL and SQL version that was listed earlier in this thread? No real description of the that error was ever given only that the mod "Didn't work".

We aren't running 5.3 and I'm sure we need to upgrade, but before I go chasing that I wanted a little feedback here.

Thanks for the hard work BTW.
MisterMagotchi
Deep Core Mining Inc.
Caldari State
#130 - 2011-10-11 04:51:11 UTC  |  Edited by: MisterMagotchi
Rache:

That edit you made, while it may work, isn't the best workaround in my opinion.

In many configurations, PHP settings can be changed in a local php.ini file.

In that case, you could put a file called php.ini in the directory with the scripts and put the following in it:
Quote:
magic_quotes_gpc = Off

For those that need to enable allow_url_fopen, they can also usually add the following line and have it work:
Quote:
allow_url_fopen = On

As Magic Quotes is already deprecated, I'm not going to sully my code with stuff to work around its presence. It's long been a hated setting by developers, and in the past, many big projects have made attempts to work with it, on or off, but these days I believe it's a minority of hosts that have it on by default, any good host should have it off, and it's not hard to fix your environment, either via the php.ini method or the .htaccess methods (when not using a suPHP environment) to change PHP settings.

Regarding allow_url_fopen, I plan to make the code check for the presence of cURL and use it if it's available, as it works a little faster than the default URL wrapper (url_fopen), and if it's not available, I'll have it use the default URL wrapper. This should be in my next release, which I'm working on now.

Curson:

Thanks for the compliments.

The EOL thing is no longer an issue, because as of 1.54, I made everything use heredoc syntax (EOL) instead of nowdoc syntax ('EOL').

Verify that allow_url_fopen is on and verify that there isn't a firewall issue somehow.

If you still can't get it to connect, if you want to message me, we can probably work through whatever the problem is.
Rache Le'Bonbon
Aliastra
Gallente Federation
#131 - 2011-10-11 05:05:29 UTC
Yea, php.ini is the best way, but its not always a perfect world. I guess when I make scripts I try to think of it this way. Most people are dumb, and probably don't know how to modify there php.ini! Or their hosting service wont let them, or even they do use it for other scripts thus can not turn it off.

So as making a script I always put stuff in to take care of any problems that might rise to any situation, so I don't have to worry about it later. Making assumptions that people are smart will always get ya into trouble. LOL no matter what its about Life, scripts, Eve lol

I do understand from your prospective that Magic Quotes is deprecated and I believe in 6.0 is gone all together if I remember reading. So really no big deal! I guess I am the only one that ran into it seems anyhow. LoL. At minimum its in these forums, for anyone that might run into it, they can then search and find answers!

I am a novice to advanced in what I know about PHP, basically know enough to get into trouble lol.

However I did run into one more problem! I can not get it to interface with TS3.. It says everything is ok, but it is not adjusting groups like it should! Haven't started to dig yet into it. you have my TS info jump on if ya like, or just write back.

Also I would like to get your opinion on why I can not use the HTTPS as it tells me that the cert is bad.
Drake Draconis
Brutor Tribe
Minmatar Republic
#132 - 2011-10-11 05:35:15 UTC
MisterMagotchi wrote:


Drake: I don't know why. Mine was filled with log lines of people being deleted, but I didn't lose everybody (since I caught it in time). The moral of the story is that backups are key, always. Sorry for the loss, though. Is it logging other things correctly?


didn't lose anything...

It just didn't report everyone getting removed even though it did as expected.

I'm only griping about the lack of logging...not so much function.

Which does so quite beautifully mind you. Big smile


PS: I won't be able to get around to the 1and1 fixes due to real life but I'll try my best to look you up TA5E if you need help... but it may be the weekend.

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

MisterMagotchi
Deep Core Mining Inc.
Caldari State
#133 - 2011-10-11 05:48:13 UTC  |  Edited by: MisterMagotchi
Although I mentioned some fixes in index.php, I apparently forgot to include the updated index.php in my most recent release, so they actually weren't added, and I'll instead stick it in my next release. The good news is that they weren't critical changes.

Sorry about that.

Drake:
It should have logged, and it logged it all for me. That's what I'm trying to troubleshoot. Does it log errors normally otherwise?
MisterMagotchi
Deep Core Mining Inc.
Caldari State
#134 - 2011-10-11 08:49:09 UTC  |  Edited by: MisterMagotchi
New version released.

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

Changed files (replace): check-users.php, eve-api-get-names.json.php, index.php, setup.inc.php, readme.html

Changed files (hand edit): config.inc.php (added 'PHP Command' option and documentation at bottom, added documentation to lines 7 and 11)
Quantum Doom
Ominous Orders
#135 - 2011-10-11 12:49:42 UTC
Hello, i have a problem in TS3, im install you script, user EVE Registration Bot found in Admin server query group, but no one new user not enter any group. Forum registration work fine and no errors in txt file. Help me pls.
Drake Draconis
Brutor Tribe
Minmatar Republic
#136 - 2011-10-11 18:40:03 UTC
MisterMagotchi wrote:
Although I mentioned some fixes in index.php, I apparently forgot to include the updated index.php in my most recent release, so they actually weren't added, and I'll instead stick it in my next release. The good news is that they weren't critical changes.

Sorry about that.

Drake:
It should have logged, and it logged it all for me. That's what I'm trying to troubleshoot. Does it log errors normally otherwise?



Yes its logging....if you want to call it that...just only my account shows up when something happens.

All other accounts aren't being logged but its obviously doing something in the background.

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

MisterMagotchi
Deep Core Mining Inc.
Caldari State
#137 - 2011-10-11 19:03:02 UTC
Quantum:
It could be a lot of things. Verify your group configuration and TS ignore list are set up correctly. Beyond that, it's hard to give you specific information when I have limited information. If Teamspeak is connecting at some point (probably when the registration form is submitted, but possibly not when check-users.php runs, that rules out a lot of things. If you need help, mail or email me with your comms. information, and I may be able to help figure out why it isn't connecting.

Drake:
I have no idea why it would log problems with only one user, it doesn't make sense that that one user would just be you (instead of some other random person), it's not happening for me, and I haven't seen it happen with anyone else.

Something you might try to test: On line 3 of check-users.php, paste the following:
Quote:
log_message('Check script ran.', FALSE);

With that, you should get an entry in errors.txt every time check-users.php runs via the cron job or via the registration form. My only guess I can think of is that it might be only logging when it runs via the registration form and not via the cron, but if you said it did show that your registration got deleted during the EVE API downtime, then that may not be it. Either way, that's a good troubleshooting step to make sure it at least can log at the appropriate times.
Drake Draconis
Brutor Tribe
Minmatar Republic
#138 - 2011-10-11 23:08:37 UTC
MisterMagotchi wrote:

Drake:
I have no idea why it would log problems with only one user, it doesn't make sense that that one user would just be you (instead of some other random person), it's not happening for me, and I haven't seen it happen with anyone else.

Something you might try to test: On line 3 of check-users.php, paste the following:
Quote:
log_message('Check script ran.', FALSE);

With that, you should get an entry in errors.txt every time check-users.php runs via the cron job or via the registration form. My only guess I can think of is that it might be only logging when it runs via the registration form and not via the cron, but if you said it did show that your registration got deleted during the EVE API downtime, then that may not be it. Either way, that's a good troubleshooting step to make sure it at least can log at the appropriate times.



Very nice...I'll insert that when i get access to the server tonight.

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

Drake Draconis
Brutor Tribe
Minmatar Republic
#139 - 2011-10-12 20:53:05 UTC
Running into RL stuff...gonna be a bit delayed on feedback results for the test.

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

Rache Le'Bonbon
Aliastra
Gallente Federation
#140 - 2011-10-13 22:59:11 UTC
Just to let ya know MisterMagotchi I am still having the problem with I register with the ' in my name. It register's fine but when I got to log in I can't, Log in with admin account remove ' and add ' and it works just fine after that. All I can think is that it has something to do with the database not wanting to see the ' as a '. Just letting ya know, not a big problem due to not many have ' in names.

Also I am working on a mod for this script. I will post what I have in here or to you, however ya like.