online.php called from another domain

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • George L
    Former vBulletin Support
    • May 2000
    • 32996
    • 3.8.x

    online.php called from another domain

    Okay i figured out how to call a file online.php from several domains on the same server as my vB by placing the file online.php in the root of each domain i.e. call http://www.eva2000.com/online.php from this page using SSIhttp://www.eva2000.com/movies/index.shtml

    Problem
    it works but when i close the forum from the admin panel, the included code on other domains chucks a fit and displays a bunch of garbled up text

    is there a way around this so that when i close my forum a simple message is displayed on the online.php output

    i.e. instead of

    forum users: 45 members + 124 guests : Register!

    it would say

    forum status: maintenance be back soon.. : Register
    Last edited by George L; Sat 16 Jun '01, 12:50am.
    :: Always Back Up Forum Database + Attachments BEFORE upgrading !
    :: Nginx SPDY SSL - World Flags Demo [video results]
    :: vBulletin hacked forums: Clean Up Guide for VPS/Dedicated hosting users [ vbulletin.com blog summary ]
  • George L
    Former vBulletin Support
    • May 2000
    • 32996
    • 3.8.x

    #2
    the file has the following code
    Code:
    <?php 
    chdir("/home/user1/public_html/");
    require("/home/user1/public_html/global.php");
    
    if ($displayloggedin) { 
    $datecut=time()-$cookietimeout; 
    
    //$loggedins=$DB_site->query_first("SELECT COUNT(*) AS sessions FROM session WHERE lastactivity>$datecut"); 
    //$totalonline=$loggedins['sessions']; 
    $loggedins=$DB_site->query_first("SELECT COUNT(*) AS sessions FROM session WHERE userid=0 AND lastactivity>$datecut"); 
    $numberguest=$loggedins['sessions']; 
    //$numberregistered=$totalonline-$numberguest; 
    
    $numbervisible=0; 
    $numberregistered=0; 
    //$loggedins=$DB_site->query("SELECT DISTINCT user.userid,username FROM user,session WHERE session.userid=user.userid AND session.userid<>0 AND invisible=0 AND session.lastactivity>$datecut ORDER BY username"); 
    $loggedins=$DB_site->query("SELECT DISTINCT session.userid,username,invisible 
    FROM session 
    LEFT JOIN user ON (user.userid=session.userid) 
    WHERE session.userid<>0 AND session.lastactivity>$datecut 
    ORDER BY invisible ASC, username ASC"); 
    if ($loggedin=$DB_site->fetch_array($loggedins)) { 
    $numberregistered++; 
    if ($loggedin['invisible']==0 or $bbuserinfo['usergroupid']==6) { 
    $numbervisible++; 
    $userid=$loggedin['userid']; 
    if ($loggedin['invisible']==1) { // Invisible User but show to Admin 
    $username=$loggedin['username']; 
    $invisibleuser = '*'; 
    } else { 
    $username=$loggedin['username']; 
    $invisibleuser = ''; 
    } 
    $location=$loggedin['location']; 
    eval("\$activeusers = \"".gettemplate('forumhome_loggedinuser')."\";"); 
    } 
    
    while ($loggedin=$DB_site->fetch_array($loggedins)) { 
    $numberregistered++; 
    $invisibleuser = ''; 
    if ($loggedin['invisible']==1 and $bbuserinfo['usergroupid']!=6) { 
    continue; 
    } 
    $numbervisible++; 
    $userid=$loggedin['userid']; 
    if ($loggedin['invisible']==1) { // Invisible User but show to Admin 
    $username=$loggedin['username']; 
    $invisibleuser = '*'; 
    } else { 
    $username=$loggedin['username']; 
    } 
    $location=$loggedin['location']; 
    eval("\$activeusers .= \", ".gettemplate('forumhome_loggedinuser')."\";"); 
    } 
    } 
    $DB_site->free_result($loggedins); 
    
    $totalonline=$numberregistered+$numberguest; 
    
    $numberinvisible=$numberregistered-$numbervisible; 
    
    } 
    
    echo "<FONT FACE=\"Verdana, Arial, Helvetica, sans-serif\" SIZE=\"1\"><b>forum users</b>:&nbsp; 
    &nbsp;<a href=http://animeboards.com/index.php#active target=\"_blank\"><FONT FACE=\"Verdana, Arial, Helvetica, sans-serif\" SIZE=\"1\">$numberregistered</font></a>
    &nbsp;members&nbsp;+&nbsp;
    <a href=http://animeboards.com/index.php#active target=\"_blank\"><FONT FACE=\"Verdana, Arial, Helvetica, sans-serif\" SIZE=\"1\">$numberguest</font></a>&nbsp;guests&nbsp;&nbsp;:&nbsp;
    <a href=http://animeboards.com/register.php?s=&action=signup target=\"_blank\"><FONT FACE=\"Verdana, Arial, Helvetica, sans-serif\" SIZE=\"1\">Register!</font></a></font>";
    
    ?>
    :: Always Back Up Forum Database + Attachments BEFORE upgrading !
    :: Nginx SPDY SSL - World Flags Demo [video results]
    :: vBulletin hacked forums: Clean Up Guide for VPS/Dedicated hosting users [ vbulletin.com blog summary ]

    Comment

    • George L
      Former vBulletin Support
      • May 2000
      • 32996
      • 3.8.x

      #3
      any ideas ? i just integrated kevin's last active topic hacks as well





      i closing the forums will display garbled text on those pages
      :: Always Back Up Forum Database + Attachments BEFORE upgrading !
      :: Nginx SPDY SSL - World Flags Demo [video results]
      :: vBulletin hacked forums: Clean Up Guide for VPS/Dedicated hosting users [ vbulletin.com blog summary ]

      Comment

      • Jez
        Member
        • May 2001
        • 50

        #4
        Have you tried something along the following lines?
        PHP Code:
        if (!$bbactive) {
          exit();

        Comment

        • George L
          Former vBulletin Support
          • May 2000
          • 32996
          • 3.8.x

          #5
          Originally posted by Jez
          Have you tried something along the following lines?
          PHP Code:
          if (!$bbactive) {
            exit();

          didn't work or i might not have put it in the proper place in the online.php ?
          :: Always Back Up Forum Database + Attachments BEFORE upgrading !
          :: Nginx SPDY SSL - World Flags Demo [video results]
          :: vBulletin hacked forums: Clean Up Guide for VPS/Dedicated hosting users [ vbulletin.com blog summary ]

          Comment

          • tubedogg
            Senior Member
            • Feb 2001
            • 13602

            #6
            Try adding
            Code:
            $bon = $DB_site->query_first("SELECT value FROM setting WHERE varname='bbactive'");
            if ($bon[value] == "0") {
              echo("Sorry the forums are closed");
              exit;
            }
            right before
            Code:
            if ($displayloggedin) { 
            $datecut=time()-$cookietimeout;

            Comment

            • George L
              Former vBulletin Support
              • May 2000
              • 32996
              • 3.8.x

              #7
              thanks kevin but that didn't work, closing the forum still outputs gibberish text
              :: Always Back Up Forum Database + Attachments BEFORE upgrading !
              :: Nginx SPDY SSL - World Flags Demo [video results]
              :: vBulletin hacked forums: Clean Up Guide for VPS/Dedicated hosting users [ vbulletin.com blog summary ]

              Comment

              • Mike Sullivan
                Former vBulletin Developer
                • Apr 2000
                • 13327
                • 3.6.x

                #8
                You'll actually have to do some (kludgy) hacking to the global.php.

                Or you can just remove the global.php require()'ment and do the processing without bothering to check whether the bb is closed.

                Comment

                • Jez
                  Member
                  • May 2001
                  • 50

                  #9
                  Couldn't you do an eval and check if any errors occured?

                  Or how about adding an '@' to the require function, which should prevent error outputting.

                  Comment

                  • George L
                    Former vBulletin Support
                    • May 2000
                    • 32996
                    • 3.8.x

                    #10
                    Ed and Jez, i'm still very much php illiterate for now


                    any help is appreciated
                    :: Always Back Up Forum Database + Attachments BEFORE upgrading !
                    :: Nginx SPDY SSL - World Flags Demo [video results]
                    :: vBulletin hacked forums: Clean Up Guide for VPS/Dedicated hosting users [ vbulletin.com blog summary ]

                    Comment

                    • Jez
                      Member
                      • May 2001
                      • 50

                      #11
                      What I meant was add the following '@' before the function any PHP won't ouput error messages, instead it will die gracefully.

                      PHP Code:
                      <?php 
                      chdir
                      ("/home/user1/public_html/");
                      @require(
                      "/home/user1/public_html/global.php");

                      Comment

                      • Jez
                        Member
                        • May 2001
                        • 50

                        #12
                        You might also consider using '@include()' instead of 'require' as it will continue processing even if was unsuccessful in including a file, as long as the @ is prefixed.

                        Also consider setting 'error_reporting(0)'.

                        Comment

                        widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
                        Working...