surveywp / kk-star-ratings

kk Star Ratings wordpress plugin
https://wordpress.org/plugins/kk-star-ratings
Other
118 stars 44 forks source link

Problem with Unique Votes on CloudFlare #135

Closed marcin-firmanty-finelf closed 1 year ago

marcin-firmanty-finelf commented 1 year ago

Detailed description

I found a bug while using this plugin on hostings associated with cloudflare. The unique clicks functionality does not work properly due to the way cloudflare passes the IP address.

Context

This problem is significant for me and for everyone using similar hosting (e.g. rocket.net) research: https://stackoverflow.com/questions/14985518/cloudflare-and-logging-visitor-ip-addresses-via-in-php

Possible implementation

I checked that possible solution may be like this:

$ip = $_SERVER['REMOTE_ADDR']; // Cloudflare CDN Fix: if ($httpCFconnectingIp = ($_SERVER['HTTP_CF_CONNECTING_IP'] ?? null)) { $ip = $httpCFconnectingIp; // End Cloudflare CDN Fix } elseif ... rest of code

Your environment

wordpress 6.1 on rocket.net (checked on 5 different installations)

kamalkhan commented 1 year ago

Thanks for letting me know. This has now been included in version 5.4.4

w3guy commented 6 months ago

@kamalkhan I sent you an email. Please check 🙏