Code Snippets
Pieces of code you can use around your site
314 topics in this forum
-
- 5 replies
- 2.3k views
Hey, I think,if have a way to get routes direct from other sites,because if you have a lot of a routes do add, is very tiring and time consuming to add with admin panel. Waiting. Thanx
Last reply by Gabriel Fernandez, -
- 1 reply
- 1.8k views
I am a web designer and would like to build my own VA website, do you guys have all the codes that i would need to add different functionality to my site and is there any video tutorial that explains step by step how to go about adding such scripts in for some who may not know who are beginners....reason i ask is because i have many folks here who is into aviation looking to start a VA and get their sites up but i have to first get clearification as to building one and teaching them how i got it done.
Last reply by Sava, -
Live Fuel Problem work around
by Guest lorathon- 9 replies
- 5.7k views
Since the live fuel server stopped allowing phpVMS users to access the live fuel I have been seeing too many flights with a zero for fuel price. I am assuming this was due to the copy that Nabeel put up for the live lookup. I still wanted to use the live lookup ( I dont like the idea of all of the airports having the same fuel price) so I just looked for a work around. What I wanted was to be able to poll the live fuel server, if there was a price there then use it. If not then use the default. The problem became that sometimes a zero was sent back. The script would then run the fuel calc with zero as the fuel price. So I dug in and worked out a way to accomplish…
Last reply by Ghiby, -
- 11 replies
- 4.8k views
If you would like to use phpfree chat, here goes. Visit their page for docs, their info is really helpful. Upload phpfree chat to your website . Place this at the beginning of your chat page. <?php require_once dirname(__FILE__)."/phpfreechat-1.5/src/phpfreechat.class.php"; //this is the location of your chat directory $params = array(); $params["admins"] = array('your-admin-name' => 'your-password');//this is the admin name and password - you can have more than one admin $params["title"] = "Pilot's Lounge"; //name of the chat room $params['firstisadmin'] = false; //do not change this $params["theme"] = "blune"; //this is where you change the theme $params['…
Last reply by RogerB, -
- 5 replies
- 4k views
Is possible in phpvms prevent to receive pireps for flights who are non booked? One of my pilots manualy fill acars and after flight complete send and system receive flight which is not in va system.
Last reply by Ephendi, -
- 1 reply
- 1.7k views
Please help me, i want to limit access to specific module. Probably via .htaccess and password. Please help if you know how ... P.
Last reply by simpilot, -
- 0 replies
- 1.4k views
Hi, How would I go about creating a page in the Admin panel of PHPVMS? I understand about adding the link in the nav on the left, but I can't link it up etc. If anybody could help, would be great. Thanks Daniel
Last reply by PlumbBum, -
- 5 replies
- 2.4k views
Hello, I'm trying to make it so that random ID's are assigned to pilots, and not in sequential order. Is there a possibility to this? I've done it for other CMS's but I don't know if the MySQL wont like the randomness. Thanks for your help Dave
Last reply by Talisman57, -
- 5 replies
- 3.3k views
I love the landing rate (landingstats) feature that SimPilot & Nabeel brought to phpVMS. I have always had a little niggle with it though, and that was the fact that if a pilot didn't use an ACARS program which records the land rate, or they file a PIREP manually, then the output shows 0. This can be confusing for visitors to your site. So with a slight mod to the output php, any PIREPS submitted without the landing rate present will now show "Not Recorded". You could use whatever text you want. Here's how: <?php if($pirep->landingrate == '0') {echo 'Not recorded';} else {echo "{$pirep->landingrate} ft/min"; }?> I just dropped this in a table cell …
Last reply by michael Kraan, -
- 3 replies
- 2.3k views
Hello, Could someone please provide me with a bit of code that echo's out the id of the current signed in pilot. I can already make it go VIRXXXX but I just need it to show the XXXX part, without the "VIR" infront? If that makes sense, Thanks for help in advanced, Regards, Daniel
Last reply by Sava, -
- 8 replies
- 3.1k views
Hello everyone, i am trying to built my own award module for my virtual airline in order to have the possibility to add the same award multiple times to a pilot. For now i have stucked on a "silly" part: I want to make an auto count the <tr> of my table awards. Fore example: Auto Number Award Type Issued 1. Good Pilot 10/10/10 2. Good Landing 11/10/12 I just want to create the bold numbers automatically . servetas
Last reply by Strider, -
- 4 replies
- 1.9k views
Whilst looking at my bookings list for my pilots the idea of having a reminder of bookings hit me. I know this can be done. I was considering something along the lines having an email sent to the pilot if their bid is more than one week old. And to prevent several emails at once (say the pilot booked a 10-leg journey) mention each booking in the one mail. I would do a rough code but my brain won't work. I've been working on a lot tonight. ----- Oh and one more thing, some of you may remember me asking what the cons of deleting a pilot were. Well, I found this in my PilotData.class.php: public static function deletePilot($pilotid) { $sql = array(); unset(self::$pi…
Last reply by freshJet, -
- 8 replies
- 5.2k views
Hey guys, I have a new project that I want to do. I noticed the boarding pass does this thing where is gets a random gate, how can I make it randomly select the specific gate at an airport? For example, I have 14 gates at Las Vegas, and 11 gates at San Jose. If a pilot views the boarding pass I want it to randomly select one of the gate numbers I put in for Vegas. Then I plan on taking this method and putting it in my flight dispatch for pilots. So, how would I go about doing this? Would if be possible to write something like if $airport = KLAS select gates x - x or something of the sort? I'm not all to great with php..
Last reply by CPC900, -
- 4 replies
- 2.9k views
The latest pilots to join thing on the index is nice and dandy if you keep consecutive Pilot IDs. If you change the Pilot IDs on registration (say, for hub purposes) there is an unfortunate problem where it only shows the highest Pilot ID, which may not necessarily be the newest pilot. I whipped up a work-around that should benefit airlines that do this. This simple change can be condensed even more, but I figured I would create a new Method just to keep things clean (and give me something to fall back on later). Open core/common/PilotData.class.php Add this snippet somewhere (perhaps after the getLatestPilots method, Line ~227) public static function getLatestPilot…
Last reply by Vidofnir, -
There is no field for this so if I want the booking date I presume I would just find the phpvms_bids table and add a date field to for a timestamp? And if so is that all or is there more to it?
Last reply by Txmmy83, -
- 1 reply
- 1.8k views
Would like to see what the code is to show the number of pending pilots.
Last reply by Kyle, -
- 4 replies
- 2.5k views
I want to add a link on my website so pilots can download or view a word document. Problem is, I don't know where I can post the document so I can link to it. I tried googledocs but it only stores files, you can't link to the file. I tried uploading them via my cpanel, but the link is not recognized. I'm assuming that is because you need to log in to view that page. Any ideas where I could upload these files to?
Last reply by rpalmer800, -
- 0 replies
- 1.8k views
Hi all,Iwould like someonecould help me, ImountedmyAVsystembutwhen I connectFSFKto trackon the map, insteadof maintaininga line tothe pilot and theflight dataposition andeachonceIupdatedacarsgeneratesa new lineandsoindefinitely, asinthe mapdoes not generatea singleplaneiconbutit generatesan icon ineach positionwith the correspondingaspect ofthe planerow of iconsfor eachpositionthatI triedsendingtheacars.Lowithfsacarsand does not generatethiserror, but reportsthat buildsFSFKare much morecomplete. I hopeyour help. Thanksand sorry forthe grammarbecauseI do not speakEnglishproperly
Last reply by AirLevante, -
- 3 replies
- 1.6k views
Hi, there is some error in getReportsByAcceptStatus function in PIREPData.class.php. It is in around line 438. Change /** * Get all of a pilot's reports by status * * @param int $pilotid The Pilot ID to find * @param integer $accept PIREP_PENDING, PIREP_ACCEPTED, PIREP_REJECTED, PIREP_INPROGRESS * @return */ public static function getReportsByAcceptStatus($pilotid, $accept = 0) { return self::findPIREPS(array( 'pilotid' => intval($pilotid), 'accepted' => intval($accept) ) ); } to /** * Get all of a pilot's reports by status * * @param int $pilotid The Pilot ID to find * @param integer $accept PIREP_PENDING, PIREP_ACCEPTED, PIREP_REJEC…
Last reply by Kyle, -
- 1 follower
- 8 replies
- 2.9k views
Hi made a little Snippet in /core/templates/schedule_results.tpl It shows like this : Here is the code (Line 14-78 in my code) <tbody> <?php foreach($schedule_list as $schedule) { ?> <tr> <td> <a href="<?php echo url('/schedules/details/'.$schedule->id);?>"><?php echo $schedule->code . $schedule->flightnum?> <?php echo '('.$schedule->depicao.' - '.$schedule->arricao.')'?> </a> <br /> <strong>Departure: </strong><?php echo $schedule->deptime;?> <strong>Arrival: </strong><?php echo $schedule->arrtime;?><br /> <strong>Equipm…
Last reply by tutmeister, -
- 2 replies
- 2.5k views
I have the currently booked flights showing on my main page of my site. I am having a problem trying to show the airline image for the current booked flight. I can get it to show the spot for the Airline in the title, but I cannot get the image to pull from my image folder. Can someone please please assist me with this. I have been up searching on here for hours and trying to make it work: this is my code:\ Thanks to anyone that can help me with this <h3>Currently Booked Flights</h3> <?php if(!$lastbids) { echo '<p align="left">No flights have currently been booked</p>'; return; } ?> <table width="100%" cellpadding="1" cellspacin…
Last reply by smoke2312, -
- 7 replies
- 3.3k views
Hello, Is there a way in PHPVMS to show the route that a pilot has flown so far on the ACARS page like this: http://screenshooter.net/9948368/rwksmof Greets, Martijn
Last reply by Scandi7, -
Hello guys, Is there a way to show a route that is generated from a website like this: http://www.vataware....om=LEMD&to=GCTS directly into a flightplan? So that it will show in this example the following route: "CCS UN975 BIRBA UN873 SOTEX UZ223 BEXAL UN866 KONBA ` Regards, Martijn
Last reply by tgycgijoes, -
- 7 replies
- 4.6k views
Anyone know how I can show the live flights on my home page?? Thanks
Last reply by Jeff, -
- 7 replies
- 3.6k views
Hi, I'm trying to add a color part in the touchdowns, but when i add this code: echo '<td>'.if($stat->landingrate > -300) echo '<font color="green">'.$stat->landingrate.' ft/m</font>'; elseif($stat->landingrate <= -300)echo '<font color="red">'.$stat->landingrate.' ft/m</font>'.'</td>'; I'm getting this error: Parse error: syntax error, unexpected T_IF in Why i put it on a different part of the page outside the <td> </td> it is working, so i'm doing something wrong, but can't figure out what. Hope someone can help me out. Edwin
Last reply by Edwin, -
- 5 replies
- 3.1k views
Hey guys, Just wondering if anyone have some code so that on the sidebar menu it will have "My Bookings" and underneath it will say "you havent booked a flight yet<br />Click Here to to get a flight. And when you have Bid for a flight it will shouw the departure and destination??? Thanks for the help (See ya in the skies) Kieran
Last reply by HighFlyerPL185, -
- 1 reply
- 2.3k views
Hello, I'm trying to create a code that alter the condition of the aircraft when a pirep is been submitted. it looks to the landing rate, so when the landing rate is below 200 than 0.5% off the condition. when a landing rate is higher than 200 than 2% of condition. when a landing rate is higher than 500 than 50% off condition. so far i have: $pos = find_in_fsacars_log('TouchDown:Rate', $log); $landingrate = str_replace('TouchDown:Rate', '', $log[$pos]); $count = preg_match('/([0-9]*:[0-9]*).*([-+]\d*).*/i', $landingrate, $matches); if($count > 0) { PIREPData::editPIREPFields($report->pirepid, array('landingrate' => $matches[2])); } PIREPData…
Last reply by Jakes, -
- 7 replies
- 3.6k views
There's an excellent post on this forum for calculating percentage complete. After scratching my head figuring out why this wouldn't work for me, I realized that xacars, and subsequently kacars as well, does not calculate distance remaining. Which explains why this data never shows up on my map. I modifed ACARS.PHP to manually calculate the distance remaining no matter what client you're using. I've only tested this with xacars client. I'll also post the percentage complete code here as well as I've modified that slightly. ASCARS.PHP located in core/modules/ACARS <?php /** * phpVMS - Virtual Airline Administration Software * Copyright (c) 2008 Nabeel Shahzad *…
Last reply by CarlosGarcia, -
- 1 reply
- 2.2k views
I've got an arrivals board with latest flights but I want it to display whether it's early, on time or delayed. Here's my code: $actualtime = $pirep->flighttime; $schedtime = $schedule->flighttime; if($actualtime < $schedtime){ echo '<td>Early</td>'; } elseif($actualtime > $schedtime){ echo '<td>Delayed</td>'; } else { echo '<td>On Time</td>'; } It only shows it as delayed at the moment though. Anyone help? http://www.freshjetvirtual.com/
Last reply by Txmmy83, -
- 7 replies
- 5k views
need help with code to put up stats from a whazzup.txt file. I have this info...and am not sure what to do with it.... <? $whazzuptxt = "whazzup.txt"; //get file $file = file_get_contents('whazzup.txt'); //get clients preg_match('/!CLIENTS(.*?)!SERVERS/ms', $file, $results); $content = trim($results[1]); //get out \r\n so on $lines = preg_split('/(\015\012)|(\015)|(\012)/', $content); //filter for pilot and atc clients function filter ($value) { if (strpos($value, 'PILOT') !== false){ return true; }elseif(strpos($value, 'ATC') !== false){ return true; }else{ return false; } } $lines = array_filter($lines, 'filter'); $br = "<br>"; /g…
Last reply by Jeff,