Rating problem and solution

Home Forums Free wallpaper script Bug Tracker Rating problem and solution

Tagged: ,

This topic contains 0 replies, has 1 voice, and was last updated by  adimoldovan 1 year, 1 month ago.

Viewing 1 post (of 1 total)
  • Author
    Posts
  • #841

    adimoldovan
    Member

    Hi,
    I don’t know if this is a general problem or only for my host (mochahost.com), so this is what happen:
    - after I voted up or down a wallpaper the rating system remain only with that vote even if the page was open from other computer (different IP);
    - I suspected that the IP for the client is not read correctly. Checking the table for votes (vws_vote – in my case), I saw that the v_ip column has the IP from my host, NOT from client.

    Solution:
    - a little change in class Input (sys/helpers/Input.php), function ip_address() (line ~354):
    function ip_address()
    {
    if ($this->ip_address !== FALSE)
    {
    return $this->ip_address;
    }

    if ($this->server(‘HTTP_CLIENT_IP’))
    {
    $this->ip_address = $_SERVER['HTTP_CLIENT_IP'];
    }
    elseif ($this->server(‘HTTP_X_FORWARDED_FOR’))
    {
    $this->ip_address = $_SERVER['HTTP_X_FORWARDED_FOR'];
    }
    elseif ($this->server(‘REMOTE_ADDR’) AND $this->server(‘HTTP_CLIENT_IP’))
    {
    $this->ip_address = $_SERVER['HTTP_CLIENT_IP'];
    }
    elseif ($this->server(‘REMOTE_ADDR’))
    {
    $this->ip_address = $_SERVER['REMOTE_ADDR'];
    }

    if ($this->ip_address === FALSE)
    {
    $this->ip_address = ’0.0.0.0′;
    return $this->ip_address;
    }

    if (strstr($this->ip_address, ‘,’))
    {
    $x = explode(‘,’, $this->ip_address);
    $this->ip_address = end($x);
    }

    if ( ! $this->valid_ip($this->ip_address))
    {
    $this->ip_address = ’0.0.0.0′;
    }

    return $this->ip_address;
    }

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.