Is there, or could there be, a way to capture users' IP addresses when they log in? (We're still on v2, so I don't know if this is already available in v3....)
thx
Dave
In v3 it's automatically saved upon login both in Account (LastLoginIp) and in SessionToken (IPAddress) tables. In v2 you have it in CB_Session (LastActionIP) that is connected to CB_Account through IdAccount and it's updated upon every call to the web services for each session of the user.
FRANCESCO CROCETTI @ SKARED CREATIONS
Oops, forgot to subscribe to this topic.
So in v2, I see that field (should've looked harder before!) -- but it's Null for everyone except my team's accounts and those of a few dozen beta testers who registered before the game's release. Not sure what that means.
The field CB_Session.LastActionDate shouldn't be null theoretically since it's set in the function CB_Session::SetSession(), you may want to debug what's returned from $_SERVER["REMOTE_ADDR"] on your server by creating a PHP file with the following code and call it from a web browser:
<?php echo $_SERVER["REMOTE_ADDR"];
FRANCESCO CROCETTI @ SKARED CREATIONS
I get a 500 error on that:
[Error] Failed to load resource: the server responded with a status of 500 (Internal Server Error) (phptest.php, line 0)
What does that mean? Should I talk to my webhost about it?
Usually you should have access to the error log of Apache (most hosting providers have this in the host admin panel or have a folder in the host tree where access and error logs reside [not in public html]), HTTP 500 is a generic error so you need to look inside the error log to see the details.
Or are you seeing this in the error log? What version of PHP are you running?
<?php phpinfo();
FRANCESCO CROCETTI @ SKARED CREATIONS
We're running php 5.6. Here's that line from the access log:
67.6.53.107 - - [04/Dec/2017:12:02:29 -0500] "GET /phptest.php HTTP/1.1" 0 500 - "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/604.3.5 (KHTML, like Gecko) Version/11.0.1 Safari/604.3.5"
1
The only error log I can find has nothing about this at all. But maybe I should turn this question over to my webhost now?
Access log is useless, the errors are printed in the error log so theoretically you should have at least a line with something related to the error.
FRANCESCO CROCETTI @ SKARED CREATIONS
Tech support says:
After reviewing the logs, it looks like there is a syntax error in the code for that file.
[04-Dec-2017 19:35:06 UTC] PHP Parse error: syntax error, unexpected 'echo ' (T_STRING) in /home/wolfques/public_html/phptest.php on line 3
So I assume I didn't do something I should've done with that script -- I just put the code you supplied in a file:
<?php
2
echo $_SERVER["REMOTE_ADDR"];
Should there be anything else in there?
Delete the line with "2"... you copied&pasted the line number 😀
FRANCESCO CROCETTI @ SKARED CREATIONS
Ack!
Okay, fixed....but now it's blank -- page is blank, console is blank.
http://www.wolfquest.org/phptest.php
What does that mean?
If you have echo $_SERVER["REMOTE_ADDR"] in your file (preceded by a line with <?php) then it means that for some reason $_SERVER["REMOTE_ADDR"] doesn't work on your system, may be they disabled it in your PHP 5.6 (even if it's strange, I'm trying it with PHP 7.x and it's still working on my system).
You can try to add the following function inside the class Utils on /lib/Utils.php (at line 4, anyway after the line "class Utils {"):
public static function GetClientIP() { $ip = filter_input(INPUT_SERVER, "REMOTE_ADDR"); if (empty($ip) && isset($_SERVER["REMOTE_ADDR"])) { $ip = $_SERVER["REMOTE_ADDR"]; } return $ip; }
Then edit phptest.php and replace its content with this code (the file must be inside the root folder of Combu, else change the including path of Utils.php):
<?php include "lib/Utils.php"; echo Utils::GetClientIP();
FRANCESCO CROCETTI @ SKARED CREATIONS
mmh.. anyway I tried again your testscript URL with Postman and I still see HTTP 500 error, so either you're doing something wrong in the script or there's something "strange" on your server.
If you can create a temporary FTP user on your host for me to access only to the folder of Combu then please send the credentials by a PM and I can make some tests there, else you can contact me tomorrow on Skype (send your Skype ID by PM, or if you don't use Skype but some other instant messaging system like Discord or Hangouts then send your ID and contact me by PM when you'll be online).
Now it's a bit late here in Italy and I'm going to sleep, let's talk tomorrow on an IM to speed up the process and catch what's happening.
FRANCESCO CROCETTI @ SKARED CREATIONS
I tried those scripts, no luck, so I've set up an FTP account for you. Will send that by email.
thanks
Dave