Bravo List

Bravo List (http://www.bvlist.com/index.php)
-   BT.Manager (phpMyBitTorrent) (http://www.bvlist.com/forumdisplay.php?f=23)
-   -   FIX PMBT 2.04 PHP 5.3 (http://www.bvlist.com/showthread.php?t=8404)

hEDge 26th October 2012 12:43

FIX PMBT 2.04 PHP 5.3
 
There will be more fixes lets start with Ip_valid() error
open include/functions.php

find and replace
PHP Code:

function getip() {
  
$check = array('HTTP_X_FORWARDED_FOR''HTTP_X_FORWARDED',
                 
'HTTP_FORWARDED_FOR''HTTP_FORWARDED',
                 
'HTTP_VIA''HTTP_X_COMING_FROM''HTTP_COMING_FROM');

  foreach (
$check as $c) {
    if (
ip_valid(&$_SERVER[$c])) {
      return 
ip_first($_SERVER[$c]);
    }
  }

  return 
$_SERVER['REMOTE_ADDR'];


with my function
PHP Code:

    function getip ()
    {
      
$ip '127.0.0.1';
      if ((isset (
$_SERVER['HTTP_CLIENT_IP']) AND $_SERVER['HTTP_CLIENT_IP']))
      {
        
$ip $_SERVER['HTTP_CLIENT_IP'];
      }
      else
      {
        if ((isset (
$_SERVER['HTTP_X_FORWARDED_FOR']) AND $_SERVER['HTTP_X_FORWARDED_FOR']))
        {
          
$ip $_SERVER['HTTP_X_FORWARDED_FOR'];
        }
        else
        {
          if ((isset (
$_SERVER['REMOTE_ADDR']) AND $_SERVER['REMOTE_ADDR']))
          {
            
$ip $_SERVER['REMOTE_ADDR'];
          }
        }
      }

      return 
$ip;
    } 


joeroberts 26th October 2012 13:00

would probly work better this way
PHP Code:

function getip() {
  
$check = array('HTTP_X_FORWARDED_FOR''HTTP_X_FORWARDED',
                 
'HTTP_FORWARDED_FOR''HTTP_FORWARDED',
                 
'HTTP_VIA''HTTP_X_COMING_FROM''HTTP_COMING_FROM');

  foreach (
$check as $c) {
    if (isset(
$_SERVER[$c]) AND ip_valid($_SERVER[$c])) {
      return 
ip_first($_SERVER[$c]);
    }
  }

  return 
$_SERVER['REMOTE_ADDR'];



hEDge 6th November 2012 15:07

btw i need help on this one
PHP Code:

function if ($user->user) {
        
//Update online user list
        
$pagename substr($_SERVER["PHP_SELF"],strrpos($_SERVER["PHP_SELF"],"/")+1);
        
$sqlupdate "UPDATE ".$db_prefix."_online_users SET page = '".addslashes($pagename)."', last_action = NOW() WHERE id = ".$user->id.";";
        
$sqlinsert "INSERT INTO ".$db_prefix."_online_users VALUES ('".$user->id."','".addslashes($pagename)."', NOW(), NOW())";
        
$res $db->sql_query($sqlupdate);
        if (!
$db->sql_affectedrows($res)) $db->sql_query($sqlinsert);


returns errors

Warning: strrpos() expects parameter 1 to be string, array given in /opt/lampp/htdocs//themes/pmbt/main.php on line 163

Warning: substr() expects parameter 1 to be string, array given in /opt/lampp/htdocs//themes/pmbt/main.php on line 163

not shure hove to fix this thing
and yes thanks for that function abowe

joeroberts 7th November 2012 23:36

Hmm first off are you making a new function?
If so you need to set global $_SERVER;
Also $user->user is a true false
Of your not I never seen $_SERVER["PHP_SELF"] return an array.
Is there a chance you can show me the results of
printf($_SERVER["PHP_SELF"]);

hEDge 8th November 2012 22:43

it's not a new function it's part of themes/pmbt/main.php
must be a problem with my server

btw hove to fix this
line causeing problems
PHP Code:

$db->sql_freeresult($configquery

returns error "undefined variable configquery"
on every second refresh

joeroberts 23rd November 2012 05:49

What page and what line is that from?

daffy 23rd November 2012 12:38

^^ I totally 100% agree. :pot: :mad:


All times are GMT +2. The time now is 08:16.

Powered by vBulletin® Version 3.8.11 Beta 3
Copyright ©2000 - 2024, vBulletin Solutions Inc.