Sunteți pe pagina 1din 11

VATSIM CERTIFICATE

SERVER

VATSIM Confidential

AUTOMATION TOOLS
As of 21 April 2003

This document lists the tools available to divisions and regions to


automatically retrieve and set data in the VATSIM Certificate File.

i © VATSIM 2002
Issue Record

1 Initial Issue 27 March 2003. James Willan James@vatsim.net

2 21 April 2003. Nick Partridge nickphuk@btinternet.com


Issue 2 Change Descriptions
a) Issue section added
b) All References to asp changed to php
c) Example Scripts added to include necessary authid etc.
d) Person.php facilities removed
e) Email.php facilities removed

ii © VATSIM 2002
General Notes

Data in the VATSIM Certificate Server is stored in a database, and is constantly


updated by a number of processes. For this reason, there is no way to simply FTP
data from the server.

Access to automated scripts is provided only on receipt of a successful basic HTTP


authentication with the regional code (internal code) and regional password (available
from the VP of Membership or the VP of Development)

Setting and retrieving data is done via POSTing or GETting data from various scripts
on the Certificate Server. The response from all scripts is either a list of comma-
separated values (records delimited with CRLFs) or an error/success code.

All scripts listed here should be prefixed with http://cert.vatsim.net/vatsimnet/admin/


and are intended for automated use only. You require a regional password in order to
use these scripts.

Ideally, you should download the database via regdb.php or divdb.php daily and use
this as your reference, to avoid continuous calls to VATSIM’s database. Under no
circumstances should any automated process use regdb or divdb more than twice in
any 24-hour period.

Requests for new features should be sent to the Vice-President Development.

iii © VATSIM 2002


Retrieving Data

Data is retrieved from VATSIM through the divdb.php and regdb.php tools. The
return is always comma-separated values.

1 ID VATSIM issued ID
2 Rating Certificate Rating:
0 = Suspended
1 = Pilot / Obs
2 = Student
4 = Senior Student
5 = Controller
7 = Senior Controller
8 = Instructor
10 = Senior Instructor
11 = Supervisor
12 = Administrator
3 Name (First) First Name
4 Name (Last) Surname
5 E-mail Registered e-mail address
6 Age Band Age band of:
1 is <= 12
2 is 13-17
3 is 18-25
4 is 26-36
5 is 37-48
6 is 49-60
7 is 61 and older
7 State State / County / Province
8 Country ICAO two-letter code for country of residence
9 Experience Code Code representing real-life experience of
N = Neither atc nor pilot
P = real Pilot
A = real Atc
B = Both a real atc and a pilot
10 End of suspension This is a date containing the date on which re-
activation of the users account will automatically
occur.

This field is valid only if the rating is 0.

If this field is empty (NULL), and the rating is 0, the


user is permanently suspended.
11 Date of registration Date/time of registration
12 Region Selected Region (INTERNAL CODE – see below)
13 Division Selected Division (INTERNAL CODE – see below)
NULL = no selected division

iv © VATSIM 2002
A sample record would then be:

800014,12,James,Willan,james@the-
willans.fsnet.co.uk,5,Midlands,GB,P,3/20/2002,2/14/2002 4:02:50 PM,EUR,GBR

This decodes to: User 800014 is an Administrator, name James Willan, e-mail
james@the-willans.fsnet.co.uk, age 37-48, living in the Midlands of Britain, with
real-world pilot experience, registered on 14 Feb 2002 at 4:02:50 in the afternoon, a
member of Europe region / UK division. The 2/14/2002 represents nothing.

Please note all dates / times are American format (mm/dd/yy)

Data can be retrieved for:

THE ENTIRE REGION (logged in region only)


regdb.php

AN ENTIRE DIVISION (of the logged in region only)


divdb.php?div=xxx (where xxx is the internal division code – see below)

At the time of writing, Division codes are:

Division Code Division Region


Responsible
AFR South Africa (VATRSA) Africa
JPN Japan Asia
KOR Korea Asia
PRC People's Republic of China Asia
ROC Republic of China (Taiwan) Asia
EUD Europe (except UK) Europe
GBR United Kingdom Europe
RUS Russia Europe
PAC Pacific Oceania
CAR Caribbean Central America
MCO Mexico Central America
CAN Canada North America
USA United States North America
SAM South America South America
BRZ Brazil South America

v © VATSIM 2002
Region codes are:

AFR Africa
ASIA Asia
EUR Europe Region
OCEN Oceania
USA-C Central America
USA-N North America
USA-S South America

The above codes are used internally only.

Checking a user’s password

After many requests, this script allows a division / region to check a user’s password.
Ideally, divisions / regions would create their own passwords for users by sending an
e-mail to the user (using the address on file). Realising that some web providers do
not allow automated e-mails to be sent, this script is a last-resort alternative.

TO CHECK A PASSWORD:
pwordcheck.php?id=xxxxxx&password=000000
(where xxxxxx is VATSIM ID and 000000 is password to check)

The responses from this script are:


-1 User does not exist
0 Password is not correct
1 Password is correct

vi © VATSIM 2002
Setting Data

Changing Ratings

ratch.php?id=xxxxxx&rat=y

xxxxxx ID of member to change


y New Rating of:
0 = [See notes below - DO NOT USE]
1 = Pilot / Obs
2 = Student
3 = [Invalid entry!]
4 = Senior Student
5 = Controller
6 = [Invalid entry!]
7 = Senior Controller
8 = Instructor
9 = [Invalid entry!]
10 = Senior Instructor
11 = [See notes below - DO NOT USE]
12 = [See notes below - DO NOT USE]

Responses Success Successfully performed


ERR:NoExist User does not exist
ERR:NotAllowed User not in your region. Edit not allowed.

Please note that ratings of suspended and senior staff ratings may only be set through
the Admin Console and not via automation scripts. This is to ensure that these
changes are individually accountable and that appropriate comments can be entered.
Note further that the automation interface will not allow a change to the rating of a
member whose rating is any of suspended, inactive, supervisor or administrator.

The use of this script generates an e-mail to the user to inform them of the change and
should not be called unless the rating is to be changed.

Finally, all regional and divisional systems making use of this function must maintain
an audit trail that indicates who actually requested the rating change and when that
request was made. It is optional to retain justification for the rating change in the
audit trail.

vii © VATSIM 2002


Changing Division Assignment

divch.php?id=xxxxxx&div=yyy

xxxxxx ID of member to change


yyy Three letter division code. Please see list above.

Responses Success Successfully performed


ERR:NoExist User does not exist
ERR:NotAllowed User not in your region. Edit not allowed.

This script was provided to allow divisions who use a division registration procedure
to automatically notify VATSIM of the user’s choice of division if they have not
already notified their choice to VATSIM. Please check the user has not set their
division by checking the response in their record in regdb.php.

viii © VATSIM 2002


Example 1 Getting the regdb file for the region, division
You can send the data in many ways for retrieval however it would be preferable to use a hidden field
dynamically set on a page javascript protected. As previously stated work for logged in region only.

[1] authid Region


[2] authpassword

<form name="form1" method="post" action="http://cert.vatsim.net/vatsimnet/admin/regdb.php">


<input type="submit" name="Submit" value="Get Regdb">
<input type="hidden" name="authpassword" value="<%=session("authpassword")%>">
<input type="hidden" name="authid" value="<%=session("authid")%>">
</form>

For division substitute regdb.php for divdb.php


And add the divisioncode i.e.

[1] authid Region


[2] authpassword
[3] divisioncode

<form name="form1" method="post" action="http://cert.vatsim.net/vatsimnet/admin/divdb.php">


<input type="submit" name="Submit" value="Get Divdb">
<input type="hidden" name="authpassword" value="<%=session("authpassword")%>">
<input type="hidden" name="authid" value="<%=session("authid")%>">
<input type="hidden" name="div" value="xxx">
</form>

ix © VATSIM 2002
Example 2 Changing a Division

This script again you need to log in using authid etc but can effect only a member in
your region
You can substitute the DIV hidden field for a drop down list
[1] authid Region
[2] authpassword
[3] users id
[4] chosen division

<form name="form1" method="post" action="http://cert.vatsim.net/vatsimnet/admin/divch.php">


<input type="submit" name="Submit" value="Change Division">
<input type="hidden" name="authpassword" value="<%=session("authpassword")%>">
<input type="hidden" name="authid" value="<%=session("authid")%>">
<input type="text" name="id" value="xxxxxx">
<input type=”hidden” name=”div” value=”xxx”>
</form>

Example 3 Performing an Upgrade


Notice in this script that we do not include level’s 0,11,12
Again you must include
[1] authid Region
[2] authpassword
[3] users id
[4] new rating for them

<form method="POST" action="http://cert.vatsim.net/vatsimnet/admin/ratch.php">


<input type="hidden" name="authpassword" value="<%=session("authpassword")%>">
<input type="hidden" name="authid" value="<%=session("authid")%>">
<input type="text" name="id" value="xxxxxx">
New Rating Selection
<select size="1" name="rat" tabindex="6">
<option value="2">Student</option>
<option value="4">Senior Student</option>
<option value="5">Controller</option>
<option value="7">Senior Controller</option>
<option value="8">Instructor</option>
<option value="10">Senior Instructor</option>
</select>
<input type="submit" value="Upgrade Member" name="B3" style="Default">
</form>

x © VATSIM 2002
Example 4 Password check

How the individual Division uses this data is beyond the scope of this document.
However it can be retirieved as follows

[1] authid Region


[2] authpassword
[3] users id
[4] users password

<form name="form" method="post"


action="http://cert.vatsim.net/vatsimnet/admin/pwordcheck.php">
<input type="text" name="id" value="xxxxxx">
<input type="text" name="password" value="000000">
<input type="submit" name="Submit" value="Submit">
<input type="hidden" name="authid" value="<%=session(“authid”)%>">
<input type="hidden" name="authpassword" value="<%=session(“authpassword”)%>">
</form>

xi © VATSIM 2002

S-ar putea să vă placă și