Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

HTTP Reverse Proxy, can't ipban.

Junior Spellweaver
Joined
Feb 6, 2013
Messages
196
Reaction score
25
Hi, I am using an HTTP Reverse Proxy for my hotel.

I can't IP ban anyone because everyone has the same IP.
I assume I need to update ip_current, but to do so I need something that finds their real IP and that runs the query when they enter the client.

Like this:
Code:
if (!empty($_SERVER['HTTP_CLIENT_IP'])) {    $ip = $_SERVER['HTTP_CLIENT_IP'];} elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {    $ip = $_SERVER['HTTP_X_FORWARDED_FOR'];} else {    $ip = $_SERVER['REMOTE_ADDR'];}

And this maybe?
Code:
UPDATE users SET ip_current = ? WHERE username = ?;

But where should I put them? And the codes is not finished, right?
 
Newbie Spellweaver
Joined
Apr 18, 2009
Messages
24
Reaction score
3
I assume you are using 1.3? That is the only one with proxy support. The first code box you have RevCMS should already do by default. The second part is a query that you have to run when a user enters the client. I'll update with some code if you need it, I'll need to find a Rev, it's been a while since I looked at it.
 
Upvote 0
Junior Spellweaver
Joined
Feb 6, 2013
Messages
196
Reaction score
25
I assume you are using 1.3? That is the only one with proxy support. The first code box you have RevCMS should already do by default. The second part is a query that you have to run when a user enters the client. I'll update with some code if you need it, I'll need to find a Rev, it's been a while since I looked at it.

Yes please update me with some code. :)
 
Upvote 0
Newbie Spellweaver
Joined
Apr 18, 2009
Messages
24
Reaction score
3
Can you link me to the thread where you go your version of RevCMS from? I only need to know if you are using a version with PDO or MySQL
 
Upvote 0
Junior Spellweaver
Joined
Feb 6, 2013
Messages
196
Reaction score
25
Can you link me to the thread where you go your version of RevCMS from? I only need to know if you are using a version with PDO or MySQL

I think it is this one, someone sent it to me trough skype.
 
Upvote 0
Newbie Spellweaver
Joined
Apr 18, 2009
Messages
24
Reaction score
3
Going based on those source files and assuming that you have made no other changes.

Opening up /app/class.core.php on line 90 is this line of code

Code:
$users->updateUser($_SESSION['user']['id'], 'ip_last', $_SERVER['HTTP_CF_CONNECTING_IP']);

If you are also using CloudFlare then most of this is fine. The only part you need to change is ip_last you need to change that to ip_current

However if you are NOT using CloudFlare you need to also change $_SERVER['HTTP_CF_CONNECTING_IP'] to $_SERVER['REMOTE_ADDR']

This is me trying to be more complete.
 
Upvote 0
Junior Spellweaver
Joined
Feb 6, 2013
Messages
196
Reaction score
25
Going based on those source files and assuming that you have made no other changes.

Opening up /app/class.core.php on line 90 is this line of code

Code:
$users->updateUser($_SESSION['user']['id'], 'ip_last', $_SERVER['HTTP_CF_CONNECTING_IP']);

If you are also using CloudFlare then most of this is fine. The only part you need to change is ip_last you need to change that to ip_current

However if you are NOT using CloudFlare you need to also change $_SERVER['HTTP_CF_CONNECTING_IP'] to $_SERVER['REMOTE_ADDR']

This is me trying to be more complete.
Great answer, but the query? How do I add that? Is is just to add or do I have to do something with the class.core?
 
Upvote 0
Newbie Spellweaver
Joined
Apr 18, 2009
Messages
24
Reaction score
3
The $users->updateUser should run the query for you. ip_last is the column in the `users` table that it was updating and you are chaning that to ip_current because that emulator is different.
 
Upvote 0
Junior Spellweaver
Joined
Feb 6, 2013
Messages
196
Reaction score
25
I tried $users->updateUser($_SESSION['user']['id'], 'ip_current', $_SERVER['REMOTE_ADDR']);


it was not working, I couldn't login using that. I also tried ip_register. It didnt help.
 
Upvote 0
Newbie Spellweaver
Joined
Apr 18, 2009
Messages
24
Reaction score
3
When you check the database the field ip_current doesn't change?
 
Upvote 0
Junior Spellweaver
Joined
Feb 6, 2013
Messages
196
Reaction score
25
When you check the database the field ip_current doesn't change?

I think not, but I can't even login using that code.
So it shouldn't even know what what users ip_current to change?
 
Upvote 0
Newbie Spellweaver
Joined
Apr 18, 2009
Messages
24
Reaction score
3
Have you made any other changes to the source files? RevCMS was made for Phoenix Emulator, not Arcturus, so there are some differences in the database structure. You'll need to have a PHP programmer change the query's inside the CMS to match Arcturus Emulators structure.
 
Upvote 0
Junior Spellweaver
Joined
Feb 6, 2013
Messages
196
Reaction score
25
But this RevCMS is adjusted for Arcturus.

I just need know what to put where.
 
Upvote 0
Newbie Spellweaver
Joined
Nov 7, 2015
Messages
61
Reaction score
1
Line 69 class.core

Code:
[B]if($_SESSION['user']['ip_current'] != $_SERVER['REMOTE_ADDR'])[/B]                {                    header('Location: '.$_CONFIG['hotel']['url'].'/logout');                }                                switch($k)                {                    case "index":                    case null:                        header('Location: '.$_CONFIG['hotel']['url'].'/me');                    exit;                    break;                                        case "register":                    header('Location: '.$_CONFIG['hotel']['url'].'/me');                    exit;                    break;                                        case "forgot":                        header('Location: '.$_CONFIG['hotel']['url'].'/me');                        exit;                    break;                                        case "client":                        [B]$users->updateUser($_SESSION['user']['id'], 'ip_current', $_SERVER['REMOTE_ADDR']);                        $template->setParams('sso', $users->createSSO($_SESSION['user']['id']));[/B]                    break;



Check that lines, if it is different, replace all of that lines with those. Based on posts before I made it REMOTE_addr. If u're using CF, make sure you edit the $_server If still bugging, post yours right here and I'll have a look.
 
Upvote 0
Skilled Illusionist
Joined
Dec 24, 2015
Messages
336
Reaction score
31
The ip_current is being, updated when the player loads the client. Which means you either have to edit the ipban command and add another field to players or even just create another table/use the table already created (player_access).
You can also just make it so the emulator doesn't update the IP when it loads and just use the CMS's IP updating system.
 
Upvote 0
Junior Spellweaver
Joined
Feb 6, 2013
Messages
196
Reaction score
25
I heard that I need to run a query everytime someone enters the client.
 
Upvote 0
Back
Top