[ Help ] Revenue Sharing phpBB Mod By "thinkbling"

Discussion in 'PHP' started by Darkhodge, Aug 16, 2006.

  1. #1
    Hey,


    Has anyone used this mod? I installed it today and found a few things which don't work.

    First of all the script didn't insert the "user_id" into the "php_ad_user" table which caused problems. I solved this though...

    However the ads showing don't seem to be switching between me and my users ids. The only part of the script that handles the id switching for revenue sharing seems to be the code below so is there a problem here somewhere? This is the part that goes into "includes/page_header.php'...

    I'm still quite new to PHP so I can't work this out so any help would be appreicated :)

    
      $PageName = substr($_SERVER[PATH_INFO], strlen($_SERVER[PATH_INFO]) - 13);
    
      //Set the default ad info.
      $shared_ad_client_id = $board_config['ad_client_id'];
      $shared_ad_channel = $board_config['ad_channel'];  
    
      //If the page is "viewtopic.php" AND if the ad is enabled, or if the 50% random
      // counter is true, proceed with checking if the user has enough posts.
      if ($PageName == "viewtopic.php" &&
          $board_config['ad_enabled'] == "1" &&
          rand(0, 1) == 1)
      {
        global $FirstPoster;
        if (!isset($FirstPoster))
        {
          $FirstPoster = 0;
        }
    	
        $sql = "SELECT * ".
               "FROM phpbb_users ".
               "WHERE user_id = $FirstPoster";
    
        if ( !($result = $db->sql_query($sql)) )
        {
          echo($sql);
    	  }
        $user_row = $db->sql_fetchrow($result);
    	
        if ($user_row['user_posts'] > $board_config['ad_min_posts'])
        {
          $user_id = intval($HTTP_POST_VARS['id']);
         
          //Get the previous settings if they exist.
          $sql = "SELECT * ".
                 "FROM phpbb_ad_user ".
                 "WHERE user_id = $user_id";
    							 
          if (!($shared_result = $db->sql_query($sql)))
    	    {
            echo($sql);
    	    }
          $shared_ad_row = $db->sql_fetchrow($shared_result);
          $shared_ad_client_id = $shared_ad_row['ad_client_id'];
          $shared_ad_channel   = $shared_ad_row['ad_channel'];
    		}
      }
    	
    	if (strlen(trim($shared_ad_client_id)) < 15)
    	{
    		$shared_ad_client_id = $board_config['ad_client_id'];
    	}
    
    $adsense =
    "<script type=\"text/javascript\"><!--\n".
    "google_ad_client = \"" . $shared_ad_client_id . "\";\n".
    "google_ad_width = 468;\n".
    "google_ad_height = 60;\n".
    "google_ad_format = \"468x60_as\";\n".
    "google_ad_channel =\"" . $shared_ad_channel . "\";\n".
    "google_ad_type = \"text_image\";\n".
    "//--></script>\n".
    "<script type=\"text/javascript\"\n".
    "  src=\"http://pagead2.googlesyndication.com/pagead/show_ads.js\">\n".
    "</script>";
    
    PHP:
     
    Darkhodge, Aug 16, 2006 IP
  2. Darkhodge

    Darkhodge Well-Known Member

    Messages:
    2,111
    Likes Received:
    76
    Best Answers:
    1
    Trophy Points:
    185
    #2
    Anyone have any ideas? :eek:
     
    Darkhodge, Aug 17, 2006 IP