LOGIN,
""^exp,
""^ok,
"VERIFY.USER",@1,
"SEND.FILE",@3;

[1]::VERIFY.USER
/ARGV[1]^usr,
/ARGV[2]^pw^Q,
"Error"^so,
"ENCRIPT",@2,
IF{Q'=(&(HU)HUU[usr]|5) "Bad Password"^so^sod;
   exp'<%(Z)date.in.magic((&(HU)HUU[usr]|10)/86400) "Expired Password"^so^sod;
   "Success"^so^sod,1^ok},so_" "_sod^/SO;

[2]::ENCRIPT
""^X^i^V^L^j,
DO{Q X*96+IF{E(Q)>31<128;32}-32^X,Q%0^Q},
Q(1,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73)^PR,
DO{V#0+i\21^i,V*X+PR|i^V,
   IF{L(V)/2^L>6 V%L_(V$L)^V},
   j+1^j<21&(L<70)},
V\205220027820018761729^Q^/PKE;

[3]::SEND.FILE
"<?xml version="_D(34)_1.0_D(34)_"?>"^!,
"<ReplyMessage>"^!,
"<TransactionId>"_0_"</TransactionId>"^!,
"<Status>"_so_"</Status>"^!,
"<StatusDescription>"_sod_"</StatusDescription>"^!,
"<Payload>"^!,
"<Prsnl>"^!,
"<FullName><![CDATA["_&(HU)HUU[usr]|4_"]]></FullName>"^!,
"<UserNumber>"_(&(G)GU[usr]|6^ggg)_"</UserNumber>"^!,
"<Username>"_usr_"</Username>"^!,
"<Key/>"^!,
"<Positions>"^!,
"<Position>"^!,
"<Display>"_IF{ggg "Provider";"User"}_"</Display>"^!,
"<PrsnlReltnTypes>"^!,
"<PrsnlReltnType>"^!,
"<Display>PatientKeeper</Display>"^!,
"<Mnemonic>PATIENTKEEPERDOC</Mnemonic>"^!,
"</PrsnlReltnType>"^!,
IF{ggg "<PrsnlReltnType>"^!,
"<Display>Consulting</Display>"^!,
"<Mnemonic>CONSULTDOC</Mnemonic>"^!,
"</PrsnlReltnType>"^!},
"</PrsnlReltnTypes>"^!,
"</Position>"^!,
"</Positions>"^!,
"<Groups>"^!,
IF{&(G)GGG[ggg]|14 "<Group>"^!,
"<Display><![CDATA["_&(G)GGH[&(G)GGG[ggg]|14]|1_"]]></Display>"^!,
"<Mnemonic><![CDATA[GRP."_&(G)GGG[ggg]|14_"]]></Mnemonic>"^!,
"</Group>"^!},
""^FAC,
DO{+&(G)GGG[ggg]FAC[FAC]^FAC IF{&(G)GGG[ggg]FAC[FAC]|12^Q 1,
"<Group>"^!,
"<Display><![CDATA["_&(G)GGH[Q]|1_"]]></Display>"^!,
"<Mnemonic><![CDATA[GRP."_Q_"]]></Mnemonic>"^!,
"</Group>"^!}},
"</Groups>"^!,
"</Prsnl>"^!,
"</Payload>"^!,
"</ReplyMessage>"^!;

[99]::VERIFY.USER
"Error"^so,
"ENCRIPT",@2,
Q(usr,Q,"MAW.TEST","MIS")^QQ,
%(Z)signon.verify.user(QQ)^Q,
   IF{Q;"Success"^so^sod},so_" "_sod^/SO;