Henrique Posted August 25, 2019 Report Share Posted August 25, 2019 (edited) could you help me with this error? ( Warning: Creating default object from empty value in C:\Program Files (x86)\Ampps\www\core\templates\randomsearch.php on line 12 ) <?php /* * phpVMS Module: Random Itinerary Builder * Coding by Jeffrey Kobus * www.fs-products.net * Verion 1.3 * Dated: 03/22/2011 */ $pilotid = Auth::$userinfo->pilotid; $last_location = PIREPData::getLastReports($pilotid, 1); if(!$last_location) $last_location->arricao = Auth::$userinfo->hub; $last_name = OperationsData::getAirportInfo($last_location->arricao); $equipment = OperationsData::GetAllAircraftSearchList(true); $airlines = OperationsData::getAllAirlines(true); ?> <table border = "0"> <tr> <th scope="col">Random Itinerary from Current Location</th> </tr> <tr><form name="randomflights" id="randomflights" action="<?php echo SITE_URL?>/index.php/randomflights/getRandomFlights" method="post"> <td>Current Location Preselected </td> <table> <tr> <td width ="25%"><b>Current Location:</b></td> <td width ="75%"><select id="depicao" name="depicao"> <option value="<?php echo $last_location->arricao?>"><?php echo $last_location->arricao?> (<?php echo $last_name->name?>)</option> </td> </tr> <tr> <td width ="25%"><b>Airline:</b></td> <td width ="75%"><select id="airline" name="airline"> <option value="">Select Airline</option> <?php if(!$airlines) $airlines = array(); foreach($airlines as $airline) { echo '<option value="'.$airline->code.'">'.$airline->name.'</option>'; } ?> </td> </tr> <tr> <td width ="25%"><b>Aircraft:</b></td> <td width ="75%"><select id="equipment" name="equipment"> <option value="">Select Equipment</option> <?php if(!$equipment) $equipment = array(); foreach($equipment as $equip) { echo '<option value="'.$equip->icao.'">'.$equip->name.'</option>'; } ?> </td> </tr> <tr> <td width ="25%"><b>Number of Flights:</b></td> <td width ="75%"><select id="count" name="count"> <option value="3">3</option> <option value="5">5</option> <option value="15">15</option> </select></td> <td><input type="submit" name="submit" value="Find Random Flights"></td> </tr> </table> </form> </tr> </table> Edited August 25, 2019 by Henrique Quote Link to comment Share on other sites More sharing options...
Yash Posted August 25, 2019 Report Share Posted August 25, 2019 Turn off Error reporting on your server! Quote Link to comment Share on other sites More sharing options...
Henrique Posted August 25, 2019 Author Report Share Posted August 25, 2019 14 minutes ago, Yash said: Turn off Error reporting on your server! when i disable the server warnings it gives this error Fatal error: Class 'mysqli' not found in C:\Program Files (x86)\Ampps\www\intranet\core\classes\ezdb\ezdb_mysqli.class.php on line 101 Quote Link to comment Share on other sites More sharing options...
Administrators ProAvia Posted August 25, 2019 Administrators Report Share Posted August 25, 2019 (edited) Don't turn off error reporting - work to fix the issue first and foremost. What version of phpVMS? What version of PHP? Change $pilotid = Auth::$userinfo->pilotid; $last_location = PIREPData::getLastReports($pilotid, 1); if(!$last_location) $last_location->arricao = Auth::$userinfo->hub; $last_name = OperationsData::getAirportInfo($last_location->arricao); $equipment = OperationsData::GetAllAircraftSearchList(true); $airlines = OperationsData::getAllAirlines(true); ?> To $pilotid = Auth::$userinfo->pilotid; $last_location = PIREPData::getLastReports($pilotid, 1); if(!$last_location) $last_location = new StdClass(); if(!$last_location) $last_location->arricao = Auth::$userinfo->hub; $last_name = OperationsData::getAirportInfo($last_location->arricao); $equipment = OperationsData::GetAllAircraftSearchList(true); $airlines = OperationsData::getAllAirlines(true); ?> I think that's the only change necessary. I'm on mobile right now and can't easily do a file compare to be sure. If the above doesn't fix it, I will do a file compare once I am near my computer. Edited August 25, 2019 by ProAvia Quote Link to comment Share on other sites More sharing options...
Henrique Posted August 25, 2019 Author Report Share Posted August 25, 2019 (edited) 8 minutes ago, ProAvia said: Don't turn off error reporting - work to fix the issue first and foremost. What version of phpVMS? What version of PHP? Change $pilotid = Auth::$userinfo->pilotid; $last_location = PIREPData::getLastReports($pilotid, 1); if(!$last_location) $last_location->arricao = Auth::$userinfo->hub; $last_name = OperationsData::getAirportInfo($last_location->arricao); $equipment = OperationsData::GetAllAircraftSearchList(true); $airlines = OperationsData::getAllAirlines(true); ?> To $pilotid = Auth::$userinfo->pilotid; $last_location = PIREPData::getLastReports($pilotid, 1); if(!$last_location) $last_location = new StdClass(); if(!$last_location) $last_location->arricao = Auth::$userinfo->hub; $last_name = OperationsData::getAirportInfo($last_location->arricao); $equipment = OperationsData::GetAllAircraftSearchList(true); $airlines = OperationsData::getAllAirlines(true); ?> I think that's the only change necessary. I'm on mobile right now and can't easily do a file compare to be sure. If the above doesn't fix it, I will do a file compare once I am near my computer. My version: php 5.5 simpilot he adds icao and doesn't scale! https://prnt.sc/oxbes2 Edited August 25, 2019 by Henrique Quote Link to comment Share on other sites More sharing options...
Administrators ProAvia Posted August 25, 2019 Administrators Report Share Posted August 25, 2019 (edited) 5.5.2 - that is the same version I use. Not sure what you mean by "he adds icao and doesn't scale". As far as current location being blank, you must fly at least one flight to a destination in your db for that field to show your current location. I guess there may be a way around that, but my pilots can't use the random flights generator until they reach a certain rank - and will have flown several flights before then. Did you try what I posted and did the error disappear? Edited August 25, 2019 by ProAvia Quote Link to comment Share on other sites More sharing options...
Henrique Posted August 25, 2019 Author Report Share Posted August 25, 2019 10 minutes ago, ProAvia said: 5.5.2 - that is the same version I use. Not sure what you mean by "he adds icao and doesn't scale". As far as current location being blank, you must fly at least one flight to a destination in your db for that field to show your current location. I guess there may be a way around that, but my pilots can't use the random flights generator until they reach a certain rank - and will have flown several flights before then. Did you try what I posted and did the error disappear? this location went blank when I put your code Quote Link to comment Share on other sites More sharing options...
Administrators ProAvia Posted August 25, 2019 Administrators Report Share Posted August 25, 2019 (edited) I will review my files later when I am home and on the computer - and let you know what I have. There may be other changed I made to get it working correctly. Edited August 25, 2019 by ProAvia Quote Link to comment Share on other sites More sharing options...
Henrique Posted August 25, 2019 Author Report Share Posted August 25, 2019 1 minute ago, ProAvia said: I will review my files later when I am home and on the computer - and let you know what I have. There may be other changed I made to get it working correctly. ok thank you so much I'm waiting Quote Link to comment Share on other sites More sharing options...
Administrators ProAvia Posted August 25, 2019 Administrators Report Share Posted August 25, 2019 There are only 3 files for the RandomFlights module In /templates/randomsearch.php - the change I listed above is the only code change in mine from the original file. In /template/randomflights.php - my file is the same as the original In /modules/Randomflights/RandomFlights.php - my file is the same as the original Have you actually completed at least one flight to a destination in your DB with the pilot sign-on you are using to test the module? I just checked mine, and with a sign-on that has not completed a flight, the current location is blank - but with a sign-on that has completed at least one flight, the current location is listed.So, basically, that pilot needs at least one PIREP submitted and approve that landed at an airport in your DB before the current location will show in Random Flights. Quote Link to comment Share on other sites More sharing options...
Henrique Posted August 25, 2019 Author Report Share Posted August 25, 2019 this location is automatically filled with the airport hud, so much so that in the old code it generates normal flights but in its code you it does not generate Quote Link to comment Share on other sites More sharing options...
Henrique Posted August 25, 2019 Author Report Share Posted August 25, 2019 1 hour ago, ProAvia said: There are only 3 files for the RandomFlights module In /templates/randomsearch.php - the change I listed above is the only code change in mine from the original file. In /template/randomflights.php - my file is the same as the original In /modules/Randomflights/RandomFlights.php - my file is the same as the original Have you actually completed at least one flight to a destination in your DB with the pilot sign-on you are using to test the module? I just checked mine, and with a sign-on that has not completed a flight, the current location is blank - but with a sign-on that has completed at least one flight, the current location is listed.So, basically, that pilot needs at least one PIREP submitted and approve that landed at an airport in your DB before the current location will show in Random Flights. I think my module is outdated, could you send me what you use? Quote Link to comment Share on other sites More sharing options...
Administrators ProAvia Posted August 25, 2019 Administrators Report Share Posted August 25, 2019 (edited) Your module is NOT outdated. It's the exact same one I have. I went thru each file and changed any references in the files from tpl to php and then made sure all the file names ended in php. And then I added the code line I posted above. If I provided my files to you, the end result would be the same. You still haven't answered my question.... Has the pilot filed at least one PIREP. Until the pilot files at least one PIREP, the current location will remain empty - that's just the way the module works. The module looks at PIREP data to get the last arrival point and uses that as the pilots current location. Edited August 25, 2019 by ProAvia Quote Link to comment Share on other sites More sharing options...
Henrique Posted August 25, 2019 Author Report Share Posted August 25, 2019 it worked, thanks Quote Link to comment Share on other sites More sharing options...
Administrators ProAvia Posted August 25, 2019 Administrators Report Share Posted August 25, 2019 Great Another option would be to write additional code so that if the pilot hasn't filed at least one PIREP, the module would then get the pilots assigned hub as the current location.... But you are on your own there, as that's beyond my present skill set. Quote Link to comment Share on other sites More sharing options...
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.