Guest lorathon Posted April 7, 2010 Report Posted April 7, 2010 I also posted this in my kACARS forum It is still possible for a pilot to be logged in twice while using kACARS. This is from a pilot being logged in with there browser (using Cookie "A") and logged in with kACARS (using Cookie "B") To clean up your code on your frontpage you can use this snippet. This will ensure that a pilots name is only shown once. $shown = array(); foreach($usersonline as $pilot) { if(in_array($pilot->pilotid, $shown)) continue; else $shown[] = $pilot->pilotid; echo " {$pilot->firstname} {$pilot->lastname}<br />"; } Quote
llju1 Posted April 7, 2010 Report Posted April 7, 2010 I also posted this in my kACARS forum It is still possible for a pilot to be logged in twice while using kACARS. This is from a pilot being logged in with there browser (using Cookie "A") and logged in with kACARS (using Cookie "B") To clean up your code on your frontpage you can use this snippet. This will ensure that a pilots name is only shown once. $shown = array(); foreach($usersonline as $pilot) { if(in_array($pilot->pilotid, $shown)) continue; else $shown[] = $pilot->pilotid; echo " {$pilot->firstname} {$pilot->lastname}<br />"; } So Where do we put it on our Front page? Quote
Guest lorathon Posted April 7, 2010 Report Posted April 7, 2010 So Where do we put it on our Front page? Where ever you have the "Pilots Online" Each frontpage is different. It might be in your footer. That is were are's is. Some of the code in the snippet should be in there. You just have to add what is missing. Quote
llju1 Posted April 7, 2010 Report Posted April 7, 2010 Where ever you have the "Pilots Online" Each frontpage is different. It might be in your footer. That is were are's is. Some of the code in the snippet should be in there. You just have to add what is missing. Thanks I figured it out shortly after I asked Here is my version and it seems to work. <?php $shown = array(); foreach($usersonline as $pilot) { if(in_array($pilot->pilotid, $shown)) continue; else $shown[] = $pilot->pilotid; echo "<p>"; echo '<img src="'.Countries::getCountryImage($pilot->location).'" alt="'.Countries::getCountryName($pilot->location).'" />'; echo PilotData::GetPilotCode($pilot->code, $pilot->pilotid). ' ' .$pilot->firstname . ' ' . $pilot->lastname; echo "</p>"; } ?> Quote
Moderators mark1million Posted April 7, 2010 Moderators Report Posted April 7, 2010 I have a slightly different version of the code i don't show the pilot id so i got an error. This is my current code, <?php foreach($usersonline as $pilot) { echo "<p>"; echo '<img src="'.Countries::getCountryImage($pilot->location).'" alt="'.Countries::getCountryName($pilot->location).'" />'; echo " {$pilot->firstname} {$pilot->lastname}<br />"; echo "</p>"; } ?> How would i use the code with that? Quote
Administrators Nabeel Posted April 7, 2010 Administrators Report Posted April 7, 2010 <?php $shown = array(); foreach($usersonline as $pilot) { if(in_array($pilot->pilotid, $shown)) continue; else $shown[] = $pilot->pilotid; echo "<p>"; echo '<img src="'.Countries::getCountryImage($pilot->location).'" alt="'.Countries::getCountryName($pilot->location).'" />'; echo " {$pilot->firstname} {$pilot->lastname}<br />"; echo "</p>"; } ?> Quote
Guest lorathon Posted April 7, 2010 Report Posted April 7, 2010 I have a slightly different version of the code i don't show the pilot id so i got an error. This is my current code, <?php $shown = array(); foreach($usersonline as $pilot) { if(in_array($pilot->pilotid, $shown)) continue; else $shown[] = $pilot->pilotid; echo "<p>"; echo '<img src="'.Countries::getCountryImage($pilot->location).'" alt="'.Countries::getCountryName($pilot->location).'" />'; echo " {$pilot->firstname} {$pilot->lastname}<br />"; echo "</p>"; } ?> How would i use the code with that? See the quoted code. That should work Quote
Moderators mark1million Posted April 7, 2010 Moderators Report Posted April 7, 2010 Sorry that was me being lazy, i usually try to figure it out myself. Thanks Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.