Pilot Status

Hey Guys, I been on that for a while and I’m trying to firgure out how to add different status and I’m lost here,

So I have added the new options for the pilot status

And What I coded like that for the stats listing…

<select name="retired">
		<option value="0" <?php echo $activesel?>>Active</option>
		<option value="1" <?php echo $retsel1?>>Retired</option>
           <option value="2" <?php echo $retsel2?>>Banned</option>
           <option value="3" <?php echo $retsel3?>>On Leave</option>
	</select>

And I’m trying to get the database to smarten up to get these numbers in the DB, becasue I I clicked Banned, then it’ll just keep marking to 1 as retired, Is there anywhere I can manage the numbering to the database to which numbers goes to the database?

If I manually edit my DB, then if Banned is under retire 2, then it will work, but not in the backend of phpVMS.

Any help would be great!!! 1+rep!!

Look in app.config, I believe I had them in there

Hey Nabeel, I don’t see any of the configs for that.

Can you clear up what I am looking for?

Here’s how I have in my Auth Class too… for different classes of Retried.

if($userinfo->retired == 1)
	{
		self::$error_message = 'Your account was deactivated, please contact an admin';
		return false;
	}
	if($userinfo->retired == 2)
	{
		self::$error_message = 'Your account is Banned!!! Your not allowed to come back!!!';
		return false;
	}
	if($userinfo->retired == 3)
	{
		self::$error_message = 'Your account is On Leave, Please Contact the HR so they can put you back...';
		return false;
	}

Bump, I still need help with it please. Thanks

Awsome lorathon!! That did the trick, but one thing with the drop down list,

If I banned a Pilot, and It works, but If I want to go back to editing his profile, it’ll will keep saying active but he’s banned still, other hand, if I retire him, it will preslect him as retired.

How Can i get the drop down menu to know which retired class is the pilot in?

Here’s my dropdown Meun coding, so it can clear what I’m talking about…

<select name="retired">
		<option value="0" <?php echo $activesel?>>Active</option>
		<option value="1" <?php echo $retsel1?>>Retired</option>
           <option value="2" <?php echo $retsel2?>>Banned</option>
           <option value="3" <?php echo $retsel3?>>On Leave</option>
	</select>

Again, lol. Thanks for your help to finish my Pilot Status!!!

Rep Awarded!

Jeff, are those the only changed needed for that? I can implement that into mainline

Nabeel I created diffferent classes of retired. I added three new retire settings to the auth class.

Hi,

I want to show that in pilot list but he doesn’t work can you help me :

<td><div align="center"><?php
               if($pilot->retired == '1')
               {echo '<img src="'.SITE_URL.'/lib/skins/aer/images/no.png" alt="warning" /> - Inactif';}
	else if($pilot->retired == '2')
               {echo '<img src="'.SITE_URL.'/lib/skins/aer/images/no.png" alt="warning" /> - Suspendu';}
	else if($pilot->retired == '3')
               {echo '<img src="'.SITE_URL.'/lib/skins/aer/images/no.png" alt="warning" /> - En Congé';}
               else
               {echo '<img src="'.SITE_URL.'/lib/skins/aer/images/yes.png" alt="warning" /> - Actif';}
           ?></div></td>

I solved problem

This would be great to have, possibly adding a suspension one for a certain amount of time?

If not, even this would be a great release if someone was to put it together with instructions?

CD

+1

@Tomgis34 - Care to share what you did, so others can use it as well?

2 Likes

@Tomgis34 - Care to share what you did, so others can use it as well?

I have just missed a part of code. But when I set Inactive/Suspended/On Leave status, user can access on the website as active user. Can you help me ?

I have just missed a part of code. But when I set Inactive/Suspended/On Leave status, user can access on the website as active user. Can you help me ?

Check /core/common/Auth.class.php

think its line 285 (or around about there), un-comment the code which will stop logins for in-active members

CD

/**
    * Log the user in
    */
   public static function ProcessLogin($useridoremail, $password) {
       # Allow them to login in any manner:
       # Email: blah@blah.com
       # Pilot ID: VMA0001, VMA 001, etc
       # Just ID: 001
       if (is_numeric($useridoremail)) {
           $useridoremail = $useridoremail - intval(Config::Get('PILOTID_OFFSET'));
           $sql = 'SELECT * FROM ' . TABLE_PREFIX . 'pilots
			   WHERE pilotid=' . $useridoremail;
       } else {
           # They're logging in with an email
           if (preg_match('/^.*\@.*$/i', $useridoremail) > 0) {
               $emailaddress = DB::escape($useridoremail);
               $sql = 'SELECT * FROM ' . TABLE_PREFIX . 'pilots
					WHERE email=\'' . $useridoremail . '\'';
           }
           # They're loggin in with a pilot id
           elseif (preg_match('/^([A-Za-z]*)(.*)(\d*)/', $useridoremail, $matches) > 0) {
               $id = trim($matches[2]);
               $id = $id - intval(Config::Get('PILOTID_OFFSET'));

               $sql = 'SELECT * FROM ' . TABLE_PREFIX . 'pilots
					WHERE pilotid=' . $id;
           }
           # No idea
           else {
               self::$error_message = 'Invalid user ID';
               return false;
           }
       }

       $password = DB::escape($password);
       $userinfo = DB::get_row($sql);

       if (!$userinfo) {
           self::$error_message = 'This user does not exist';
           return false;
       }

       /*if($userinfo->retired == 1)
               {
                       self::$error_message = 'Votre compte est désactivé, contactez un staff pour réactiver votre compte';
                       return false;
               }
               if($userinfo->retired == 2)
               {
                       self::$error_message = 'Votre compte est suspendu, veuillez contactez la direction pour avoir plus d'information';
                       return false;
               }
               if($userinfo->retired == 3)
               {
                       self::$error_message = 'Votre compte est en mode absent, Contacter la Direction RH pour le remettre en activité';
                       return false;
               }*/

       //ok now check it
       $hash = md5($password . $userinfo->salt);

       if ($hash == $userinfo->password) {
           self::$userinfo = $userinfo;

           self::update_session(self::$session_id, self::$userinfo->pilotid);

           SessionManager::Set('loggedin', 'true');
           SessionManager::Set('userinfo', $userinfo);
           SessionManager::Set('usergroups', PilotGroups::GetUserGroups($userinfo->pilotid));

           PilotData::updateProfile($pilotid, array('lastlogin' => 'NOW()', 'lastip' => $_SERVER['REMOTE_ADDR'], ));

      return true;
       } else {
           self::$error_message = 'Invalid login, please check your username and password';
           self::LogOut();

           return false;
       }
   }

   /**
    * Log them out
    */
   public static function LogOut() {
       #self::remove_sessions(SessionManager::GetValue('userinfo', 'pilotid'));

       # Mark them as guest
       self::update_session(self::$session_id, 0);

       # "Ghost" entry
       //self::start_session(self::$userinfo->pilotid); // Orphaned?

       SessionManager::Set('loggedin', false);
       SessionManager::Set('userinfo', '');
       SessionManager::Set('usergroups', '');

       # Delete cookie
       $_COOKIE[VMS_AUTH_COOKIE] = '';
       setcookie(VMS_AUTH_COOKIE, true);

       self::$loggedin = false;
   }
}

I don’t see on line 285 a relation with in-active user.

/*if($userinfo->retired == 1)
               {
                       self::$error_message = 'Votre compte est désactivé, contactez un staff pour réactiver votre compte';
                       return false;
               }
               if($userinfo->retired == 2)
               {
                       self::$error_message = 'Votre compte est suspendu, veuillez contactez la direction pour avoir plus d'information';
                       return false;
               }
               if($userinfo->retired == 3)
               {
                       self::$error_message = 'Votre compte est en mode absent, Contacter la Direction RH pour le remettre en activité';
                       return false;
               }*/

remove the comment code here

Thanks

Hi, How can I have the “Pilot account history” in my site?

Hey Guys, I been on that for a while and I’m trying to firgure out how to add different status and I’m lost here,

So I have added the new options for the pilot status

And What I coded like that for the stats listing…

And I’m trying to get the database to smarten up to get these numbers in the DB, becasue I I clicked Banned, then it’ll just keep marking to 1 as retired, Is there anywhere I can manage the numbering to the database to which numbers goes to the database?

If I manually edit my DB, then if Banned is under retire 2, then it will work, but not in the backend of phpVMS.

Any help would be great!!! 1+rep!!