Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions
  #1  
Old 07-19-2004, 02:51 AM
AN-net's Avatar
AN-net AN-net is offline
 
Join Date: Dec 2003
Location: AnimationTalk.com
Posts: 2,367
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default php isnt listening to me:(

ok well im trying to it state how many people are viewing a journal just like vb's how many are viewing a forum that it lists on the forum index "(6 viewing)".

Well the problem here is that when one person views a journal it shows on the journal index that he/she is viewing all of them. I cant find a logical reason why it does this

here are bits of my code:
PHP Code:
            require_once('./includes/functions_bigthree.php');
            
$datecut TIMENOW $vboptions['cookietimeout'];
            
$browsers '';
            
$comma '';

            
// Don't put the inthread value in the WHERE clause as it might not be the newest location!
            
$journalusers $DB_site->query("
            SELECT user.username, user.usergroupid, user.membergroupids,
            session.userid, session.inthread, session.injournal, session.location, session.lastactivity,
                IF(user.displaygroupid = 0, user.usergroupid, user.displaygroupid) AS displaygroupid,
                IF(user.options & 
$_USEROPTIONS[invisible], 1, 0) AS invisible
            FROM " 
TABLE_PREFIX "session AS session
            LEFT JOIN " 
TABLE_PREFIX "user AS user ON(user.userid = session.userid)
            WHERE session.lastactivity > 
$datecut
            ORDER BY " 
iif($permissions['genericpermissions'] & CANSEEHIDDEN'invisible ASC, ') . "username ASC, lastactivity DESC
            "
);

            
$numberguest 0;
            
$numberregistered 0;
            
$doneuser = array();

            if (
$bbuserinfo['userid']) // fakes the user being in this thread
            
{
            
$bbuserinfo['joingroupid'] = iif($bbuserinfo['displaygroupid'], $bbuserinfo['displaygroupid'], $bbuserinfo['usergroupid']);
            
$loggedin = array(
                
'userid' => $bbuserinfo['userid'],
                
'username' => $bbuserinfo['username'],
                
'invisible' => $bbuserinfo['invisible'],
                
'invisiblemark' => $bbuserinfo['invisiblemark'],
                
'inthread' => $threadinfo['threadid'],
                
'lastactivity' => TIMENOW,
                
'musername' => fetch_musername($bbuserinfo'joingroupid')
            );
            
$numberregistered 1;
            
$numbervisible 1;
            
fetch_online_status($loggedin);
            eval(
'$activeusers = "' fetch_template('forumdisplay_loggedinuser') . '";');
            
$doneuser["$bbuserinfo[userid]"] = 1;
            
$comma ', ';
            }
            
//$injournal= array();
            // this requires the query to have lastactivity ordered by DESC so that the latest location will be the first encountered.
            
while ($loggedin $DB_site->fetch_array($journalusers))
            {
                    if (empty(
$doneuser["$loggedin[userid]"]))
                    {
                            if (
$loggedin['userid'] == 0// Guest
                            
{
                                if(
$loggedin['location']=="/journal.php" OR $loggedin['location']=="/journal.php?do=showindex")
                                {
                                    
$numberguest++;
                                }
                            }
                            else
                            {
                                if(
$loggedin['location']=="/journal.php" OR $loggedin['location']=="/journal.php?do=showindex")
                                {
                                    
$loggedin['musername'] = fetch_musername($loggedin);
                                    
$numberregistered++;
                                    if (
fetch_online_status($loggedin))
                                    {
                                        eval(
'$activeusers .= "' $comma fetch_template('forumdisplay_loggedinuser') . '";');
                                        
$comma ', ';
                                    }
                                }
                            }
                        if (
$loggedin['userid'])
                        {
                            
$doneuser["$loggedin[userid]"] = 1;
                        }
                        if(!empty(
$loggedin['injournal']))
                        {
                            
$injournal['id']= $loggedin['injournal'];
                            
$injournal[$loggedin['injournal']]++;
                        }
                    }
            }
            global 
$injournal;
            
$totalviewing $numberregistered $numberguest
and here is another bit
PHP Code:
                while($journal$DB_site->fetch_array($fjournals))
                {
                    if(empty(
$journal['totalrating']) OR empty($journal['totalvotes']))
                    {
                    
$rating"0";
                    }
                    else
                    {
                        
$calcrating$journal['totalrating']/$journal['totalvotes'];
                        
$ratinground($calcrating);
                    }
                    if(
$injournal['id']==$journal['journal_id'])
                    {
                        
$viewing$injournal[$injournal['id']];
                    }
                    if(
$journal['private']==1)
                    {
                        
$show['privatelock']= true;
                    }
                    else
                    {
                        
$show['privatelock']= false;
                    }
                    if(
$bbuserinfo['lastvisit']<$journal['lastentry_date'])
                    {
                        
$show['newentryicon']= true;
                    }
                    
$lastedatevbdate($vboptions['dateformat'], $journal['lastentry_date'], 1);
                    
$lastetimevbdate($vboptions['timeformat'], $journal['lastentry_date']);
                    
exec_switch_bg();
                    
                    if(
strlen($journal[journaldesc])>30)
                    {
                        
$journal[journaldesc]= "".substr($journal[journaldesc],0,30)."...";
                    }
                    eval(
'$journalbits .= "' fetch_template('journal_journalbits') . '";');
                } 
i set it up so if the injournal isnt empty it wont both making $injournal['id'] and start counting, in the while query for grabbing the actual journals i made an if statement so that if the $injournal['id'] equals the $journal['journal_id'] it wont display anything for views but for somereason it takes the id of just one journal and says it equal to all of them even though the injournal id from the sessions table is 7

i hope i make sense

anyways thanks in advance
Reply With Quote
  #2  
Old 07-20-2004, 02:52 AM
AN-net's Avatar
AN-net AN-net is offline
 
Join Date: Dec 2003
Location: AnimationTalk.com
Posts: 2,367
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

bump exactly 24 hours
Reply With Quote
  #3  
Old 07-21-2004, 04:52 PM
AN-net's Avatar
AN-net AN-net is offline
 
Join Date: Dec 2003
Location: AnimationTalk.com
Posts: 2,367
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

bump!!! i really need help on this
Reply With Quote
  #4  
Old 07-22-2004, 07:54 PM
romeshomey romeshomey is offline
 
Join Date: Oct 2002
Location: Ohio
Posts: 119
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Goto http://www.codewalkers.com There they will be able to help you.
Reply With Quote
Reply

Thread Tools
Display Modes

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. The time now is 03:03 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.07032 seconds
  • Memory Usage 2,248KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (2)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (4)post_thanks_box
  • (4)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (4)post_thanks_postbit_info
  • (4)postbit
  • (4)postbit_onlinestatus
  • (4)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete