Uploaded image for project: 'phpBB'
  1. phpBB
  2. PHPBB-9801

Users on custom pages outside the board directory are being displayed on Index page

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • 3.1.0-RC2
    • 3.0.7-PL1
    • None
    • PHP 5.3.1, MySQL(i) 5.1.41, Firefox 3.6 & IE8

      When you create a custom page that is located on www.example.com and your board is inside www.example.com/community/, viewonline will display users on the custom page as if they were on the index page of the board.

      The problem is this preg_match function in viewonline.php:

      	preg_match('#^([a-z0-9/_-]+)#i', $row['session_page'], $on_page);
      

      If the saved session_page looks like ../test.php, this preg_match will just remove the session_page and the $on_page will be set as empty array.
      For the time being I just changed the if statement directly afterwards from this:

      	if (!sizeof($on_page))
      	{
      		$on_page[1] = '';
      	}
      

      To this:

      	if (!sizeof($on_page))
      	{
      		// if user is on a page like ../example.php, show that
      		if(substr($row['session_page'],0,3) == '../')
      		{
      			$ext_spot = strrpos($row['session_page'], '.');
      			$on_page[1] = substr($row['session_page'], 0, $ext_spot);
      		}
      		else
      		{
      			$on_page[1] = '';
      		}
      	}
      

      But that is just a mean fix to me. It's probably best to change the preg_match regex.

            Marc Marc
            marc1706 marc1706
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: