Forum Replies Created

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hi Alex,

    This works perfectly, thank you very much for your help!

    However, I want it only on pages. I searched a bit, and found that i had to use is_page(). So now it works!

    Regards,
    Fanfrelesque.

    Hi!

    I do have the same problem, so I allow myself to post my code here, instead of creating another topic with the same issue. If needed, I still can create a new topic!

    $default_ip = '0.0.0.0';
    $current_ip = $default_ip;
    foreach (array('HTTP_CLIENT_IP', 'HTTP_X_FORWARDED_FOR', 'HTTP_X_FORWARDED', 'HTTP_X_CLUSTER_CLIENT_IP', 'HTTP_FORWARDED_FOR', 'HTTP_FORWARDED', 'REMOTE_ADDR') as $key)
      if (array_key_exists($key, $_SERVER) === true)
        foreach (array_map('trim', explode(',', $_SERVER[$key])) as $ip)
          if (filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE) !== false)
            $current_ip = $ip;
    
    $server_id = '30103';
    if ($current_ip !== $default_ip)
    {
      $is_valid_vote = file_get_contents('https://www.serveurs-minecraft.org/api/is_valid_vote.php?id='.$server_id.'&ip='.$current_ip.'&duration=1440');
      if ($is_valid_vote == 0)
        echo "<a href='https://www.serveurs-minecraft.org/vote.php?id=".$server_id."' target='_blank'><img src='http://arkhium.fr/wp-content/uploads/2018/07/voter.png' style='display: block; margin-left: auto; margin-right: auto;'></a>";
    }

    This works perfectly when using this: [wbcr_php_snippet id="303"]
    When I try to use the Run Everywhere option, it doesn’t show anything, not even an error message.

    Thank you in advance!

    • This reply was modified 7 years, 8 months ago by fanfrelesque.
Viewing 2 replies - 1 through 2 (of 2 total)