Post by PhantomMenace » Thu Nov 15, 2018 8:28 am

It says my current ip is 162.x.x.x.x while i have a completely different static wan ip,
When i go to API settings,

Also does it show the servers ip adres or my own wan ip?

Cause when i make an php file with

Code: Select all

<? echo $_SERVER["REMOTE_ADDR"]; 
and acces the file and press f5 it keeps changing to,,

New member

Posts

Joined
Wed Dec 30, 2015 6:03 am

Post by ocmta » Thu Nov 15, 2018 9:27 am

It shows $_SERVER['REMOTE_ADDR'], which is supposed to be your IP, but if your site uses something like Cloudflare, it shows Cloudflare's IP. For example, if it's Cloudflare you need to add this line in system/startup.php at the top right below <?php :

Code: Select all

if(isset($_SERVER['HTTP_CF_CONNECTING_IP']) && ip2long($_SERVER['HTTP_CF_CONNECTING_IP'])) $_SERVER['REMOTE_ADDR'] = $_SERVER['HTTP_CF_CONNECTING_IP'];

Extensions for affiliates (openCart 1, 2, 3):
Advanced Multi Level Affiliate System
Customer and Affiliate Accounts Combined into one Account
Affiliate Tracking with Coupons
Discount for Referred Customers - Order Total
Type Tracking Code
Mass Pay
Affiliate Transactions for openCart 3
Affiliate Pack X - all modules with 40% discount


Active Member

Posts

Joined
Mon Mar 12, 2012 11:21 am


Post by PhantomMenace » Thu Nov 15, 2018 10:05 am

ocmta wrote:
Thu Nov 15, 2018 9:27 am
It shows $_SERVER['REMOTE_ADDR'], which is supposed to be your IP, but if your site uses something like Cloudflare, it shows Cloudflare's IP. For example, if it's Cloudflare you need to add this line in system/startup.php at the top right below <?php :

Code: Select all

if(isset($_SERVER['HTTP_CF_CONNECTING_IP']) && ip2long($_SERVER['HTTP_CF_CONNECTING_IP'])) $_SERVER['REMOTE_ADDR'] = $_SERVER['HTTP_CF_CONNECTING_IP'];
That fixed the ip in the admin API settings,

Any idea how i can fix it to make an htacces file?

Code: Select all

order deny,allow
deny from all
allow from (my ip)
is not working probaly cause of cloudflare then i assume

cause the php file i made to show ip still shows random IPS

New member

Posts

Joined
Wed Dec 30, 2015 6:03 am

Post by ocmta » Thu Nov 15, 2018 4:23 pm

As far as i know, the only way is to install mod_cloudflare. But i'm not sure, i'm not an expert in all things Cloudflare. You can research (google etc.) that yourself.

Extensions for affiliates (openCart 1, 2, 3):
Advanced Multi Level Affiliate System
Customer and Affiliate Accounts Combined into one Account
Affiliate Tracking with Coupons
Discount for Referred Customers - Order Total
Type Tracking Code
Mass Pay
Affiliate Transactions for openCart 3
Affiliate Pack X - all modules with 40% discount


Active Member

Posts

Joined
Mon Mar 12, 2012 11:21 am


Post by PhantomMenace » Thu Nov 15, 2018 7:55 pm

ocmta wrote:
Thu Nov 15, 2018 4:23 pm
As far as i know, the only way is to install mod_cloudflare. But i'm not sure, i'm not an expert in all things Cloudflare. You can research (google etc.) that yourself.

thank you for your help ill try with mod_cloudlare

New member

Posts

Joined
Wed Dec 30, 2015 6:03 am

Post by paulfeakins » Thu Nov 15, 2018 8:07 pm

PhantomMenace wrote:
Thu Nov 15, 2018 10:05 am
is not working probaly cause of cloudflare then i assume
Set your hosts file on your computer to direct you straight to the server IP rather than CloudFlare.

For quick, professional OpenCart support please email info@antropy.co.uk


User avatar
Expert Member

Posts

Joined
Mon Aug 22, 2011 11:01 pm
Location - Reigate, Surrey, United Kingdom

Post by PhantomMenace » Thu Nov 15, 2018 9:01 pm

paulfeakins wrote:
Thu Nov 15, 2018 8:07 pm
PhantomMenace wrote:
Thu Nov 15, 2018 10:05 am
is not working probaly cause of cloudflare then i assume
Set your hosts file on your computer to direct you straight to the server IP rather than CloudFlare.
How would do i do that?

Code: Select all

# localhost name resolution is handled within DNS itself.
#	127.0.0.1       localhost
#	::1             localhost
*mywanip*    *serverip*
in the host file?

New member

Posts

Joined
Wed Dec 30, 2015 6:03 am

Post by ocmta » Thu Nov 15, 2018 9:12 pm

No, in hosts file it should be:

Code: Select all

serverip    your_site_domain_name
Then put your real IP in .htaccess and it should work, but only for your own IP, any other IP you add as "allow from" will not work, unless they access the site directly.

Extensions for affiliates (openCart 1, 2, 3):
Advanced Multi Level Affiliate System
Customer and Affiliate Accounts Combined into one Account
Affiliate Tracking with Coupons
Discount for Referred Customers - Order Total
Type Tracking Code
Mass Pay
Affiliate Transactions for openCart 3
Affiliate Pack X - all modules with 40% discount


Active Member

Posts

Joined
Mon Mar 12, 2012 11:21 am


Post by PhantomMenace » Thu Nov 15, 2018 9:39 pm

ocmta wrote:
Thu Nov 15, 2018 9:12 pm
No, in hosts file it should be:

Code: Select all

serverip    your_site_domain_name
Then put your real IP in .htaccess and it should work, but only for your own IP, any other IP you add as "allow from" will not work, unless they access the site directly.
i changed te hosting file accordingly and flushed my dns
but it is still showing random ips when conecting to ip.php
and still cant acces the page

New member

Posts

Joined
Wed Dec 30, 2015 6:03 am

Post by PhantomMenace » Sat Nov 17, 2018 2:49 am

Anyone any suggestion?

Using mod_cloudflare aint gonna work since im using a shared hosting,

New member

Posts

Joined
Wed Dec 30, 2015 6:03 am

Post by PhantomMenace » Thu Nov 22, 2018 6:21 pm

it shows my real ip when using

Code: Select all

<? echo  $ip=$_SERVER["HTTP_CF_CONNECTING_IP"];
if (!isset($ip)) {
  $ip = $_SERVER['REMOTE_ADDR'];
}
in a custome page,

is there a way to use this in my htaccess

New member

Posts

Joined
Wed Dec 30, 2015 6:03 am
Who is online

Users browsing this forum: No registered users and 23 guests