Code Snippets
Pieces of code you can use around your site
327 topics in this forum
-
- 1 follower
- 6 replies
- 3k views
This was originally a cry for help, but here's a nifty piece of code for you all to use. It shows the top five most frequent flights flown bu the airline. public function topRoutes(){ $query = "SELECT depicao, arricao, COUNT(*) AS count FROM phpvms_pireps GROUP BY depicao, arricao ORDER BY count DESC LIMIT 5"; $results = DB::get_results($query); return $results; } You can then return the depicao, arricao and count.
Last reply by simpilot, -
- 0 replies
- 3k views
Hello I want to delete expired bids per Crone Job. Is here a way to check if a pilot is inflight with the current bid? i Want so set the expired time to 2 or 3 hours but when the bid will be deleted, the flight is avaible for other pilots even if currently the pilot is still flying. I have tried to check the acarsdata table, but here is no unique id that has a reference to the bid. phpvms version is 5.5. Best regards, Jan Grimm
Last reply by Sovereign, -
- 7 replies
- 3k views
I was looking for this code as I want to put a link on the frond page saying: there are 5 xacars flights - click hee to view Thanks for all the help, james
Last reply by James142, -
- 5 replies
- 3k views
I need help. I am trying to make the generator Dispatch. But it does not work (((( This link is found a php file associated with the Dispatch https://github.com/noodlehaus/dispatch. Can you suggest how to install it on the site?
Last reply by Yash, -
- 4 replies
- 3k views
Hi there! As Air Anatolia VA , we're new on phpvms system and currently we are still stylizing. I was planning to change aircraft icons, there was 360 images files for each heading.Rotating,saving...rotating saving...just boring! And i noticed that ystem works like that in acarsmap.js ; It gets the heading data , and takes the image! I have an idea to simply that but i dont know anything about javascript :/ here is my idea; What if there is just one image file for aircraft icon , and javascript turns it by codes as the heading? Is it possible? If its possible and easy , can anyone help me? Thanks a lot!
Last reply by FSX30HD, -
- 6 replies
- 3k views
Heres a snippet I use to get the last 5 posts from phpBB to display in my side bar <?php require_once('/path/to/forum/config.php'); $link = mysql_connect($dbhost,$dbuser,$dbpasswd); mysql_select_db($dbname, $link); $result = mysql_query("SELECT * FROM `phpbb_posts` ORDER BY `post_id` DESC LIMIT 5", $link); while($r = mysql_fetch_array($result)) { echo "<a href=\"http://www.domain.tld/forum/viewtopic.php?p=" . $r['post_id'] . "\">" . $r['post_subject'] . "</a><br />"; } ?>
Last reply by joeholden, -
- 0 replies
- 3k views
Unless google comes out with a quick fix, here is a fix for an error you are, not a matter of if but when, going to see it. PLEASE RESEARCH THIS FIRST!!!!! DO NOT USE UNLESS YOU ARE SURE! I WILL NOT BE RESPONSIBLE FOR YOUR SECURITY OR WEBSITE. I am not a pro. I just read this on stackoverflow and it worked. line 42 reads: function ReCaptcha It needs to be : public function __construct to fix this: Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; ReCaptcha has a deprecated constructor in C:\wamp\www\phpvms\core\lib\recaptcha\recaptchalib.php on line 42 That error is a result of running phpvms on php 7 and m…
Last reply by TAV1702, -
- 1 follower
- 4 replies
- 3k views
I'm sure some will have discovered Charts.aero, they're a relatively new charts site. Love the site now because it's clean and easy to use, charts are synchronised at least hourly, but best of all, there's an API available. Problem is, I can't handle APIs. The API can be found here. There are three ways to retrieve charts; by search string, by IATA and by ICAO. I'll do it through all I think, but just use ICAO for now. This is the PHP for the ICAO retrieval: $response = Unirest::post( "https://charts.p.mashape.com/retrieve/icao", array( "X-Mashape-Authorization" => "******************************" ), array( "icao" => "", )); You'll notice the Unirest clas…
Last reply by freshJet, -
- 0 replies
- 3k views
Hello folks! I thought about to edit categories in the default download module and changed it to my needs. After you deactivate a download category, it wont show up in your list. Important information: BEFORE do this tutorial, backup the database tables and files you'll edit. lib/skins/pandaair_theme/downloads_list.php admin/modules/Downloads/Downloads.php admin/templates/downloads_categoryform.php core/common/DownloadData.class.php database table phpvms_downloads 1. Open your database and run the following command. It will add a column to your downloads table. Be sure to add the …
Last reply by Karamellwuerfel, -
- 8 replies
- 3k 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, -
- 3 replies
- 3k views
I have tried 2 different banner rotators and neither have worked. I am sick and tired of looking and testing and ultimately failing. Anyone got a code? I know lots of you have banner rotators at the top of your pages...
Last reply by freshJet, -
- 1 follower
- 4 replies
- 3k views
Here is a small code that you can use in pilot center or public profile. It shows total flights in a particular airline that pilot has flown. Note: If your database table prefix is not phpvms, change this part "phpvms_pireps" to yours in the code. Enjoy <table class="balancesheet" width="50%"> <tr class="balancesheet_header"> <td colspan="2">Airline Flight Count For a Pilot</td> </tr> <tr> <td align="center"><strong>Airline Name</strong></td> <td align="center"><strong>Flight Count</strong></td> </tr> <?php $airlines = OperationsData::getAllAirlines(); foreach($airlines as …
Last reply by michael Kraan, -
- 7 replies
- 3k views
Has anyone got a script which creates a different pilot badge depending on the pilot rank? Thanks
-
- 9 replies
- 3k views
Hey guys! I have a problem when coding this: <li class="list-group-item"> <b>Rank Progress</b> <div style="width: 80%;display: inline;" class="progress-group"> <span class="progress-number">XX%</span> <div class="progress sm"> <div class="progress-bar progress-bar-blue-light" style="width: XX%"></div> </div> </div> </li> I want to add code to display precentage to next rank and progress bar with it. Does someone have an idea? I would appreciate any help! Thanks, Relja
Last reply by CarlosEduardo2409, -
- 6 replies
- 3k views
full article on my blog: http://code.voemercosul.com/ CODES: http://pastebin.com/jXJFrLL1 http://pastebin.com/TAguaNYb PS.: This is not the best programming method for phpVMS, soon I will post an update of the traditional form code, this is a more inciante method. DEMO: http://voemercosul.com/v2/index.php/Dataroutes aeroportos_tw.sql.zip
Last reply by LuisMoraes132, -
- 4 replies
- 2.9k views
Hi, just a little question, wich is the code to insert into footer.tpl for show flight this month. Thanks and sorry for this kind of questions. Regards
Last reply by Rickisani, -
- 1 follower
- 2 replies
- 2.9k views
Ok I have spent a month now trying to write my own module... I simply want a list of all the airports and its details (name, icao, and chartlink) I have even tried using an existing class (operations data) and I just can't figure it out. I have a book on php code, but it seems to be different from the VMS. I have used this: and get a table with only the aiport name. The module file simply calls the template. My original class (that I gave up on and have now used the Operation Data one was: I was hoping that someone would be able to give me a very simple example of a class, module, and template so that I can reverse engineer it and figure this all out. I wou…
Last reply by kbohme, -
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, -
- 5 replies
- 2.9k 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, -
- 7 replies
- 2.9k views
I DO NOT TAKE ANY CREDIT FROM SIMPILOT'S SCREENSHOT MODULE! This is a new function to delete the screenshot.
Last reply by TAV1702, -
- 1 follower
- 2 replies
- 2.9k views
Hi guys, This is my code for a live flight board on my frontpage. Can anyone suggest an addition to the code which would mean that when a pilot bids on a flight, it will appear on the flight board as 'In Flight'. Thanks! <div class="row-fluid"> <div class="span12"> <div class="box"> <table width="100%" border="0" bordercolor="#FFFFFF"> <h3><center>Latest Flights</h3> </div> <?php $count = 5; $pireps = PIREPData::getRecentReportsByCount($count); ?> <style type="text/css"> table th { text-align: center; color:black; font-weight:bold;} table td { text-align: center; } </style> <thead> <tr> …
Last reply by TB1, -
- 1 follower
- 6 replies
- 2.9k views
Good morning to all , How are you ? I am trying to do something for pilots who has less than 10 flights in our Virtual to prevent download the files from Downloads page in our Virtual how can i do that ?? i have this code but i am not sure if it work and where can i put it $userid = $_SESSION["userid"]; $result = mysql_query("SELECT count(*) from `topics` where `userid` = '$userid') or die(mysql_error()); $topicCount = mysql_result($result,0); if($topicCount < 10){ echo "You have $topicCount topics so far. You need a minimum of 10 to get access to downloads."; } download just for pilot who has more than 10 flights otherways pilot cannot download the fi…
Last reply by servetas, -
- 1 follower
- 8 replies
- 2.9k views
I've finished a little code snippet for everyone, I was prompted to create this in regards to a particular individual that posted someone else's PHPVMS Skin. Well, the only way this person got this, was either through Fire Fox FireBug plugin, or just plain hacked it. ( the code source that is.) Easy to do now a days, so here, this is for Everyone, and is really simple, short and to the point. This will Protect against a right click to view the page source, if you put this into the ---> layout.php page, and/or the , frontpage_main.php "Anywhere", and of course this can be used anywhere you want. And it IS HTML compliant !! Period. php,htm, html, xml, and xhtml. B…
Last reply by Vangelis, -
Tourcenter
by bass- 5 replies
- 2.9k views
Hi all, tell me where to get this module ??? Tourcenter modules
Last reply by Tummi, -
All pilots
by angle- 5 replies
- 2.8k views
Were can i get the all pilots module from so you can see all pilots and there last pireps and if they have filed there first flight?? any help would be great
Last reply by TennShadow, -
- 1 follower
- 10 replies
- 2.8k views
Does anyone have a code snippet to access database fields. I am trying to grab the total flights by a pilot, I can't seem to get this even after looking into the API. Thanks,
Last reply by Tom, -
- 4 replies
- 2.8k views
Hello and Happy New Year to all, At my virtual airline, each pilot is required to submit two (2) PIREPs each month. I'm curious to know how I can modify either my app.config.php or local.config.php file to verify this for each pilot before declaring them inactive. I'm also looking to obtain a script that will send a pilot three (3) emails: 1) One email that alerts them that I've reached inactive status and need to complete two (2) flights to remain active. 2) Another email that gets sent out two (2) weeks after the previous one which will warn them that they are nearing termination. And 3) the third one will alert them that they are terminated following two (2) weeks of…
Last reply by AGuyFawkesMask, -
- 4 replies
- 2.8k views
Hello users I will make a Last Flight and Date in pilot center and pilot public center! This code works in "Pilot Center" <li><strong>Last Flight: </strong><?php echo $report->code . $report->flightnum; ?>(<?php echo $report->submitdate; ?>)</li> And I will Last Flight and Date works in Pilot Public Profile How can I create this? please help. Best regards.
-
- 1 follower
- 0 replies
- 2.8k views
Hello guys, This is a little security snippet you can use for your website. The user needs to answer the multiplication question before proceeding: PHP: $rand1 = rand(1, 9); $rand2 = rand(1, 9); HTML: <div> <label><?php echo $rand1;?> x <?php echo $rand2;?> = </label> <input type="text" class="form-control" name="sum" id="ques" placeholder="<-- Your Answer" required> <input id="sendbtn" type="submit" name="submit" value='Send' disabled> </div> Jquery to check user's answer. If the answer is correct, as soon as the user move the mouse out of the field, the "Send" button is enabled othe…
Last reply by Parkho, -
Getting airport country names
by Guest chikolol- 3 replies
- 2.8k views
sorry to post this again, i know i have posted this before but no one answers me, how can i call for the country name of the airport to show in schedules details along with the airport name, i know something like $schedules->name pulls our the airport name but how about $schedules->country would that work?