I've already "solved" this with a custom BBCode which has replacement text defined as:
Code: Select all
<script type="application/javascript">
var http_referrer_ip = '(unknown)';
</script>
<script type="application/javascript">
function getIP(json) {
http_referrer_ip = json.ip;
}
</script>
<script type="application/javascript" src="https://api.ipify.org?format=jsonp&callback=getIP"></script>
<script type="application/javascript">document.write( '' + http_referrer_ip + '' );</script>
What's nagging at me is "I'm using an external service to find an answer that phpBB itself already knows."
I don't expect there is already something ready-made like an already existing token symbol that could be referenced in the BBCode. But is there a way to invoke some PHP or JQuery from within a BBCode, or any other method that could retrieve the data sessions.php saved as "session->ip", or maybe access "$_SERVER['REMOTE_ADDR']" directly as part of the BBCode's output?
The answer may in fact be obvious; I'm just not familiar with phpBB or PHP to already know whether it's obvious or not.
Thanks.
EDIT: Some changes to the JavaScript that became necessary to support IE11.