Jump to content

Double Logged In Pilots


Recommended Posts

Guest lorathon
Posted

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 />"; 
  }

Posted

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? :)

Guest lorathon
Posted

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.

Posted

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 :P 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>";

  }


  ?>

  • Moderators
Posted

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?

  • Administrators
Posted
<?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>";

}

?>

Guest lorathon
Posted

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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...