+ Reply to Thread (include dating software, release, and patch number!)
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 15

Thread: View Guests online

  1. #1
    PLAYMATE
    Guest

    Default View Guests online

    Does anyone know how to make it do that you can see how many guests (viewers) are online?

  2. #2
    Kleetus
    Guest

    Default

    Try to use this code in one of your files or create a new file like "online_users" and include it where you want it to be shown:
    PHP Code:
    <?php
       $daten 
    "besucher.txt"
       
    $time  time(); 
       
    $ip    getenv("REMOTE_ADDR"); 
       
    $ablaufzeit $time "300"
       
    $pruefung   = @file($daten); 
       
       while (list (
    $line_num$line) = @each ($pruefung)) {
          
    $zeiten explode("&&",$line); 
          if(
    $zeiten[0] <= $ablaufzeit) {
             
    $fp fopen"$daten""r" ); 
             
    $contents fread($fpfilesize($daten)); 
             
    fclose($fp); 
             
    $line=quotemeta($line); 
             
    $string2 ""
             
    $replace ereg_replace($line$string2$contents); 
             
    $fh=fopen($daten"w"); 
             @
    flock($fp,2); 
             
    fputs($fh$replace); 
             @
    flock($fp,3); 
             
    fclose($fh);
          }
       } 
       
    $ippruefung = @file($daten); 
       while (list (
    $line_num$line) = @each ($ippruefung)) {
          
    $ips explode("&&",$line); 
          if(
    $ips[1] == $ip) {
             
    $fp fopen"$daten""r" ); 
             
    $contents fread($fpfilesize($daten)); 
             
    fclose($fp); 
             
    $line=quotemeta($line); 
             
    $string2 ""
             
    $replace ereg_replace($line$string2$contents); 
             
    $fh=fopen($daten"w"); 
             @
    flock($fp,2); 
             
    fputs($fh$replace); 
             @
    flock($fp,3); 
             
    fclose($fh);
          }
       } 
       
    $fp fopen("$daten""a+"); 
       
    flock($fp,2); 
       
    fputs ($fp"$time&&$ip&&\n"); 
       
    flock($fp,3); 
       
    fclose ($fp); 
       
    $anzahldaten file($daten); 
       
    $anzahl count($anzahldaten); 
       echo 
    $anzahl." User online";
    ?>
    You only have to create a txt file called "besucher.txt"

  3. #3
    PLAYMATE
    Guest

    Default Thank you A+++

    Thank you lets say I want to place it in the front page where Currently Online is in that box can you guide me ot how and where?

  4. #4
    Kleetus
    Guest

    Default

    OK, try this:

    Look into your templates/tmpl_dfl/scripts/index.php and replace
    PHP Code:
    function PageCompMemberStat( )
    {
        global 
    $site;
        global 
    $prof;
        global 
    $oTemplConfig;


        
    $free_mode getParam("free_mode") == "on" 0;

        
    // members statistics
        
    $total_c strlen$_POST['total_c'] ) ? $_POST['total_c'] : getParam"default_country" );
        
    $total_c2 strlen$_POST['total_c2'] ) ? $_POST['total_c2'] : getParam"default_country" );
        
    $total_arr db_arr"SELECT COUNT(ID) FROM `Profiles` WHERE Status = 'Active'" );
        
    $total_arr_week db_arr"SELECT COUNT(ID) FROM `Profiles` WHERE Status = 'Active' AND (TO_DAYS(NOW()) - TO_DAYS(LastReg)) <= 7" );
        if ( !
    $free_mode )
            
    $total_arr_gold getMembersCountMEMBERSHIP_ID_STANDARD''true );
        
    $total_c_arr db_arr"SELECT COUNT(ID) FROM `Profiles` WHERE Status = 'Active' AND `Country` = '"process_db_input($total_c2) ."'" );
        
    $total_members $total_arr[0];
        
    $total_c_members $total_c_arr[0];

        
    $total_c_members_onl get_users_online_number('c'$total_c );
        
    $total_arr_chatting get_users_online_number('t');
        
    $members_online get_users_online_number();

        
    $c_arr $prof['countries'];

    //#########################################################
        
    $ret '';
        
    $ret .= '<div class="membes_statistic_block">';
            
    $ret .= '<div class="clear_both"></div>';
            
    $ret .= '<div style="position:relative; float:left;"><img src="' $site['icons'] . 'group.gif" alt="" /></div>';
            
    $ret .= '<div style="position:relative; float:left; white-space:nowrap; left:5px; font-weight:bold; color:#000;">' _t("_Currently Online") . '</div>';
            
    $ret .= '<div class="clear_both"></div>';
            
    $ret .= '<div style="position:relative; border-bottom:1px solid silver; margin:5px 0px;"></div>';
            
    $ret .= '<div class="member_stat_block">';
                
    $ret .= '<div><img src="' $site['icons'] . 'us.gif" alt="" /><span style="margin-left:5px;">' _t("_Total") . '&nbsp;-&nbsp;' .  $members_online '</span></div>';
                
    $ret .= '<div><img src="' $site['icons'] . 'us.gif" alt="" /><span style="margin-left:5px;">' _t("_Chatting") . '&nbsp;-&nbsp;' .  $total_arr_chatting '</span></div>';
                
    $ret .= '<div><img src="' $site['icons'] . 'us.gif" alt="" /><span style="margin-left:5px;">' $total_c_members_onl '&nbsp;' _t("_members") . '&nbsp;' _t("_from") . '</span></div>';
                
    $ret .= '<div style="padding-left:20px;">';
                    
    $ret .= '<form action="'.$_SERVER['PHP_SELF'].'" method="post" name="cForm">';
                    
    $ret .= '<input type="hidden" name="total_c" value="' $total_c '" />';
                    
    $ret .= '<select style="width:123px;" name="total_c" onchange="javascript: document.forms[\'cForm\'].submit();">';
                    foreach ( 
    $c_arr as $key => $value )
                    {
                        
    $ret .= '<option value="' $key '"';
                        if ( 
    $key == $total_c )
                            
    $ret .= ' selected="selected"';
                        
    $ret .= '>' _t'__'.$value ) . '</option>';
                    }
                    
    $ret .= '</select>';
                    
    $ret .= '</form>';
                
    $ret .= '</div>';
            
    $ret .= '</div>';
        
    $ret .= '</div>';
    //#########################################################
        
    $ret .= '<div style="margin-top:10px;">';
            
    $ret .= '<div class="clear_both"></div>';
            
    $ret .= '<div style="position:relative; float:left;"><img src="' $site['icons'] . 'group.gif" alt="" /></div>';
            
    $ret .= '<div style="position:relative; float:left; white-space:nowrap; left:5px; font-weight:bold; color:#000;">' _t("_Total Registered") . '</div>';
            
    $ret .= '<div class="clear_both"></div>';
            
    $ret .= '<div style="position:relative; border-bottom:1px solid silver; margin:5px 0px;"></div>';
            
    $ret .= '<div class="member_stat_block">';
                
    $ret .= '<div><img src="' $site['icons'] . 'us.gif" alt="" /><span style="margin-left:5px;">' _t("_Total") . '&nbsp;-&nbsp;' .  $total_arr[0] . '</span></div>';
                if ( !
    $free_mode )
                    
    $ret .= '<div><img src="' $site['icons'] . 'us.gif" alt="" /><span style="margin-left:5px;">' _t("_Gold Members") . '&nbsp;-&nbsp;' .  $total_arr_gold  '</span></div>';

                
    $ret .= '<div><img src="' $site['icons'] . 'us.gif" alt="" /><span style="margin-left:5px;">' _t("_New this week") . '&nbsp;-&nbsp;' $total_arr_week[0]  . '</span></div>';
                
    $ret .= '<div><img src="' $site['icons'] . 'us.gif" alt="" /><span style="margin-left:5px;">' $total_c_members '&nbsp;' _t("_members") . '&nbsp;' _t("_from") . '</span></div>';
                
    $ret .= '<div style="padding-left:20px;">';
                    
    $ret .= '<form action="'.$_SERVER['PHP_SELF'].'" method="post" name="cForm2">';
                    
    $ret .= '<input type="hidden" name="total_c2" value="' $total_c2 '" />';
                    
    $ret .= '<select style="width:123px;" name="total_c2" onchange="javascript: document.forms[\'cForm2\'].submit();">';
                    foreach ( 
    $c_arr as $key => $value )
                    {
                        
    $ret .= '<option value="' $key '"';
                        if ( 
    $key == $total_c2 )
                            
    $ret .= ' selected="selected"';
                        
    $ret .= '>' _t'__'.$value ) . '</option>';
                    }
                    
    $ret .= '</select>';
                    
    $ret .= '</form>';
                
    $ret .= '</div>';
            
    $ret .= '</div>';
        
    $ret .= '</div>';
    //#########################################################
        
    return DesignBoxContent _t("_members"), $ret$oTemplConfig -> PageCompMemberStat_db_num);



    with
    PHP Code:
    function visitors_online( )
    {
       
    $daten "visitors.txt"
       
    $time  time(); 
       
    $ip    getenv("REMOTE_ADDR"); 
       
    $ablaufzeit $time "300"
       
    $pruefung   = @file($daten); 
       
       while (list (
    $line_num$line) = @each ($pruefung)) {
          
    $zeiten explode("&&",$line); 
          if(
    $zeiten[0] <= $ablaufzeit) {
             
    $fp fopen"$daten""r" ); 
             
    $contents fread($fpfilesize($daten)); 
             
    fclose($fp); 
             
    $line=quotemeta($line); 
             
    $string2 ""
             
    $replace ereg_replace($line$string2$contents); 
             
    $fh=fopen($daten"w"); 
             @
    flock($fp,2); 
             
    fputs($fh$replace); 
             @
    flock($fp,3); 
             
    fclose($fh);
          }
       } 
       
    $ippruefung = @file($daten); 
       while (list (
    $line_num$line) = @each ($ippruefung)) {
          
    $ips explode("&&",$line); 
          if(
    $ips[1] == $ip) {
             
    $fp fopen"$daten""r" ); 
             
    $contents fread($fpfilesize($daten)); 
             
    fclose($fp); 
             
    $line=quotemeta($line); 
             
    $string2 ""
             
    $replace ereg_replace($line$string2$contents); 
             
    $fh=fopen($daten"w"); 
             @
    flock($fp,2); 
             
    fputs($fh$replace); 
             @
    flock($fp,3); 
             
    fclose($fh);
          }
       } 
       
    $fp fopen("$daten""a+"); 
       
    flock($fp,2); 
       
    fputs ($fp"$time&&$ip&&\n"); 
       
    flock($fp,3); 
       
    fclose ($fp); 
       
    $anzahldaten file($daten); 
       
    $anzahl count($anzahldaten); 
       echo 
    $anzahl;




    function 
    PageCompMemberStat( )
    {
        global 
    $site;
        global 
    $prof;
        global 
    $oTemplConfig;


        
    $free_mode getParam("free_mode") == "on" 0;

        
    // members statistics
        
    $total_c strlen$_POST['total_c'] ) ? $_POST['total_c'] : getParam"default_country" );
        
    $total_c2 strlen$_POST['total_c2'] ) ? $_POST['total_c2'] : getParam"default_country" );
        
    $total_arr db_arr"SELECT COUNT(ID) FROM `Profiles` WHERE Status = 'Active'" );
        
    $total_arr_week db_arr"SELECT COUNT(ID) FROM `Profiles` WHERE Status = 'Active' AND (TO_DAYS(NOW()) - TO_DAYS(LastReg)) <= 7" );
        if ( !
    $free_mode )
            
    $total_arr_gold getMembersCountMEMBERSHIP_ID_STANDARD''true );
        
    $total_c_arr db_arr"SELECT COUNT(ID) FROM `Profiles` WHERE Status = 'Active' AND `Country` = '"process_db_input($total_c2) ."'" );
        
    $total_members $total_arr[0];
        
    $total_c_members $total_c_arr[0];

        
    $total_c_members_onl get_users_online_number('c'$total_c );
        
    $total_arr_chatting get_users_online_number('t');
        
    $members_online get_users_online_number();
        
    $visitors_online visitors_online( );

        
    $c_arr $prof['countries'];

    //#########################################################
        
    $ret '';
        
    $ret .= '<div class="membes_statistic_block">';
            
    $ret .= '<div class="clear_both"></div>';
            
    $ret .= '<div style="position:relative; float:left;"><img src="' $site['icons'] . 'group.gif" alt="" /></div>';
            
    $ret .= '<div style="position:relative; float:left; white-space:nowrap; left:5px; font-weight:bold; color:#000;">' _t("_Currently Online") . '</div>';
            
    $ret .= '<div class="clear_both"></div>';
            
    $ret .= '<div style="position:relative; border-bottom:1px solid silver; margin:5px 0px;"></div>';
            
    $ret .= '<div class="member_stat_block">';
                
    $ret .= '<div><img src="' $site['icons'] . 'us.gif" alt="" /><span style="margin-left:5px;">' _t("_Visitors online") . '&nbsp;-&nbsp;' .  $visitors_online '</span></div>';
                
    $ret .= '<div><img src="' $site['icons'] . 'us.gif" alt="" /><span style="margin-left:5px;">' _t("_Total") . '&nbsp;-&nbsp;' .  $members_online '</span></div>';
                
    $ret .= '<div><img src="' $site['icons'] . 'us.gif" alt="" /><span style="margin-left:5px;">' _t("_Chatting") . '&nbsp;-&nbsp;' .  $total_arr_chatting '</span></div>';
                
    $ret .= '<div><img src="' $site['icons'] . 'us.gif" alt="" /><span style="margin-left:5px;">' $total_c_members_onl '&nbsp;' _t("_members") . '&nbsp;' _t("_from") . '</span></div>';
                
    $ret .= '<div style="padding-left:20px;">';
                    
    $ret .= '<form action="'.$_SERVER['PHP_SELF'].'" method="post" name="cForm">';
                    
    $ret .= '<input type="hidden" name="total_c" value="' $total_c '" />';
                    
    $ret .= '<select style="width:123px;" name="total_c" onchange="javascript: document.forms[\'cForm\'].submit();">';
                    foreach ( 
    $c_arr as $key => $value )
                    {
                        
    $ret .= '<option value="' $key '"';
                        if ( 
    $key == $total_c )
                            
    $ret .= ' selected="selected"';
                        
    $ret .= '>' _t'__'.$value ) . '</option>';
                    }
                    
    $ret .= '</select>';
                    
    $ret .= '</form>';
                
    $ret .= '</div>';
            
    $ret .= '</div>';
        
    $ret .= '</div>';
    //#########################################################
        
    $ret .= '<div style="margin-top:10px;">';
            
    $ret .= '<div class="clear_both"></div>';
            
    $ret .= '<div style="position:relative; float:left;"><img src="' $site['icons'] . 'group.gif" alt="" /></div>';
            
    $ret .= '<div style="position:relative; float:left; white-space:nowrap; left:5px; font-weight:bold; color:#000;">' _t("_Total Registered") . '</div>';
            
    $ret .= '<div class="clear_both"></div>';
            
    $ret .= '<div style="position:relative; border-bottom:1px solid silver; margin:5px 0px;"></div>';
            
    $ret .= '<div class="member_stat_block">';
                
    $ret .= '<div><img src="' $site['icons'] . 'us.gif" alt="" /><span style="margin-left:5px;">' _t("_Total") . '&nbsp;-&nbsp;' .  $total_arr[0] . '</span></div>';
                if ( !
    $free_mode )
                    
    $ret .= '<div><img src="' $site['icons'] . 'us.gif" alt="" /><span style="margin-left:5px;">' _t("_Gold Members") . '&nbsp;-&nbsp;' .  $total_arr_gold  '</span></div>';

                
    $ret .= '<div><img src="' $site['icons'] . 'us.gif" alt="" /><span style="margin-left:5px;">' _t("_New this week") . '&nbsp;-&nbsp;' $total_arr_week[0]  . '</span></div>';
                
    $ret .= '<div><img src="' $site['icons'] . 'us.gif" alt="" /><span style="margin-left:5px;">' $total_c_members '&nbsp;' _t("_members") . '&nbsp;' _t("_from") . '</span></div>';
                
    $ret .= '<div style="padding-left:20px;">';
                    
    $ret .= '<form action="'.$_SERVER['PHP_SELF'].'" method="post" name="cForm2">';
                    
    $ret .= '<input type="hidden" name="total_c2" value="' $total_c2 '" />';
                    
    $ret .= '<select style="width:123px;" name="total_c2" onchange="javascript: document.forms[\'cForm2\'].submit();">';
                    foreach ( 
    $c_arr as $key => $value )
                    {
                        
    $ret .= '<option value="' $key '"';
                        if ( 
    $key == $total_c2 )
                            
    $ret .= ' selected="selected"';
                        
    $ret .= '>' _t'__'.$value ) . '</option>';
                    }
                    
    $ret .= '</select>';
                    
    $ret .= '</form>';
                
    $ret .= '</div>';
            
    $ret .= '</div>';
        
    $ret .= '</div>';
    //#########################################################
        
    return DesignBoxContent _t("_members"), $ret$oTemplConfig -> PageCompMemberStat_db_num);



    Then place a txt file called "visitors.txt" in your root directory and create a new language string for
    PHP Code:
    _t("_Visitors online"
    It's not tested, but it should work
    Last edited by Kleetus; 04-20-2007 at 09:05 AM.

  5. #5
    PLAYMATE
    Guest

    Default language string

    On the new language string I go to languages click on create new language then what do I put? I just want to get it right.

  6. #6
    Kleetus
    Guest

    Default

    Don't create a new language in "Manage Languages" menu !

    "Add a new language key" in "Language Strings" menu !

    Enter "_Visitors online" in "new language key name"

    Select "Category" ("misc" or something else)

    And add your discription in "String texts for available languages"

    Quote Originally Posted by PLAYMATE View Post
    On the new language string I go to languages click on create new language then what do I put? I just want to get it right.

  7. #7
    PLAYMATE
    Guest

    Default I am getting this error

    Warning: fopen(visitors.txt) [function.fopen]: failed to open stream: Permission denied in /home/jguzman/public_html/templates/tmpl_adl/scripts/index.php on line 108

    Warning: flock(): supplied argument is not a valid stream resource in /home/jguzman/public_html/templates/tmpl_adl/scripts/index.php on line 109

    Warning: fputs(): supplied argument is not a valid stream resource in /home/jguzman/public_html/templates/tmpl_adl/scripts/index.php on line 110

    Warning: flock(): supplied argument is not a valid stream resource in /home/jguzman/public_html/templates/tmpl_adl/scripts/index.php on line 111

    Warning: fclose(): supplied argument is not a valid stream resource in /home/jguzman/public_html/templates/tmpl_adl/scripts/index.php on line 112

  8. #8
    PLAYMATE
    Guest

    Default Your almost there

    Your almost there it is showing up in the box just getting these errors on to screen and messes up the screen a little.

  9. #9
    Kleetus
    Guest

    Default

    Make the visitors.txt chmod 755

  10. #10
    PLAYMATE
    Guest

    Default Still getting the error

    Still getting the error

+ Reply to Thread (include dating software, release, and patch number!)
Page 1 of 2 1 2 LastLast

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Similar Threads

  1. Guests can't download files
    By blackvault in forum General Troubleshooting
    Replies: 0
    Last Post: 02-13-2010, 06:05 PM
  2. Member's Online Time in Profile View
    By bigal0228 in forum Free Mod Exchange
    Replies: 0
    Last Post: 02-09-2008, 11:45 AM
  3. Change to view Online Members on index page on aedating
    By trebor in forum Free Mod Exchange
    Replies: 1
    Last Post: 02-12-2007, 09:23 PM
  4. polls - guests see "main_page_code"
    By makenoize in forum General Troubleshooting
    Replies: 0
    Last Post: 01-19-2007, 04:34 AM
  5. Limit Poll=>no guests, Limit View List =>Premium only
    By makenoize in forum FAQ & HOWTO
    Replies: 2
    Last Post: 09-12-2006, 03:41 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts