Bravo List
Register
Go Back   > Bravo List > Source Code > Archived Trackers > BT.Manager (phpMyBitTorrent)
Reply
  #1  
Old 26th October 2012, 12:43
hEDge's Avatar
hEDge hEDge is offline
Member
 
Join Date: Oct 2012
Latvia
Posts: 10
Default 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;
    } 
__________________
Ask me not as i don't know the answer !
Reply With Quote
  #2  
Old 26th October 2012, 13:00
joeroberts's Avatar
joeroberts joeroberts is offline
BT.Manager Owner
 
Join Date: Jan 2008
United States
Posts: 2,113
Default
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'];

__________________
Do not ask me to help you work on your site that is not phpMyBitTorrent
Do not ask me to make a mod for any other source
Do not Ask me to setup your site.
I will no longer help you setup your site, there is a setup script if you have trouble with it post in the forum here or in BT.Manager™ forum
My Current Demo is here http://demo.btmanager.org/
Reply With Quote
The Following 2 Users Say Thank You to joeroberts For This Useful Post:
hEDge (6th November 2012), Phogo (29th October 2012)
  #3  
Old 6th November 2012, 15:07
hEDge's Avatar
hEDge hEDge is offline
Member
 
Join Date: Oct 2012
Latvia
Posts: 10
Default
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
__________________
Ask me not as i don't know the answer !
Reply With Quote
  #4  
Old 7th November 2012, 23:36
joeroberts's Avatar
joeroberts joeroberts is offline
BT.Manager Owner
 
Join Date: Jan 2008
United States
Posts: 2,113
Default
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"]);
__________________
Do not ask me to help you work on your site that is not phpMyBitTorrent
Do not ask me to make a mod for any other source
Do not Ask me to setup your site.
I will no longer help you setup your site, there is a setup script if you have trouble with it post in the forum here or in BT.Manager™ forum
My Current Demo is here http://demo.btmanager.org/
Reply With Quote
  #5  
Old 8th November 2012, 22:43
hEDge's Avatar
hEDge hEDge is offline
Member
 
Join Date: Oct 2012
Latvia
Posts: 10
Default
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
__________________
Ask me not as i don't know the answer !

Last edited by hEDge; 9th November 2012 at 01:15.
Reply With Quote
  #6  
Old 23rd November 2012, 05:49
joeroberts's Avatar
joeroberts joeroberts is offline
BT.Manager Owner
 
Join Date: Jan 2008
United States
Posts: 2,113
Default
What page and what line is that from?
__________________
Do not ask me to help you work on your site that is not phpMyBitTorrent
Do not ask me to make a mod for any other source
Do not Ask me to setup your site.
I will no longer help you setup your site, there is a setup script if you have trouble with it post in the forum here or in BT.Manager™ forum
My Current Demo is here http://demo.btmanager.org/
Reply With Quote
  #7  
Old 23rd November 2012, 12:38
daffy's Avatar
daffy daffy is offline
Senior Member
 
Join Date: Mar 2009
United Kingdom
Posts: 550
Default
^^ I totally 100% agree.
__________________
"FFS PPL READ GOD DAMMIT, WHAT AM I GOOGLE?"
"I Kill You!" simples


http://i.imgur.com/DtcRfH5.gif

I also Setup And Modify Trackers PM For Details
Reply With Quote
Reply

Tags
204 , 53 , fix , php , pmbt

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



All times are GMT +2. The time now is 11:53. vBulletin skin by ForumMonkeys. Powered by vBulletin® Version 3.8.11 Beta 3
Copyright ©2000 - 2024, vBulletin Solutions Inc.