com web/master: Had to loosen up IP validation as some mirrors are returning IPs we can't validate properly.: entry/user-notes-vote.php
| From: | Sherif Ramadan | Date: | Wed, 12 Dec 2012 17:47:07 +0000 |
| Subject: | com web/master: Had to loosen up IP validation as some mirrors are returning IPs we can't validate properly.: entry/user-notes-vote.php | ||
| Groups: | php.webmaster | ||
| Request: | Send a blank email to php-webmaster+get-15062@lists.php.net to get a copy of this message | ||
Commit: 66cab007ef9f49c4cfd35851cc504b3461a9889a
Author: Sherif Ramadan <googleguy@php.net> Wed, 12 Dec 2012 12:47:07 -0500
Parents: 8b0a4d377cec9551f3d0e9fce7a98fc0011bcb54
Branches: master
Link: http://git.php.net/?p=web/master.git;a=commitdiff;h=66cab007ef9f49c4cfd35851cc504b3461a9889a
Log:
Had to loosen up IP validation as some mirrors are returning IPs we can't validate properly.
Changed paths:
M entry/user-notes-vote.php
Diff:
diff --git a/entry/user-notes-vote.php b/entry/user-notes-vote.php
index bac75d8..75d6d55 100644
--- a/entry/user-notes-vote.php
+++ b/entry/user-notes-vote.php
@@ -35,7 +35,8 @@ function vote_validate_request(PDO $dbh) {
{
$ip = sprintf("%u", ip2long($_POST['ip']));
} else {
- return false;
+ // If the IP can't be validated use a non routable IP for loose validation (i.e. IPv6
and clients that couldn't send back proper IPs)
+ $ip = 0;
}
if (isset($_SERVER['REMOTE_ADDR']) &&
@@ -45,7 +46,9 @@ function vote_validate_request(PDO $dbh) {
{
$hostip = sprintf("%u", ip2long($_SERVER['REMOTE_ADDR']));
} else {
- return false;
+ // If the IP can't be validated use a non routable IP for loose validation (i.e. IPv6
and clients that couldn't send back proper IPs)
+ $ip = 0;
+
}
if (!empty($_POST['noteid']) && filter_var($_POST['noteid'],
FILTER_VALIDATE_INT))