Uploaded.php 119 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956
  1. <?php
  2. //require 'std.encryption.class.inc';
  3. // Pour cryptage du Rapport de visite Pdf
  4. require_once('fpdi/FPDI_Protection.php');
  5. class Uploaded
  6. {
  7. function updateUploaded($database, $serveurbase, $loginbase, $passwordbase, $Fichier, $Situation, $ID)
  8. {
  9. $link = mysql_connect($serveurbase, $loginbase, $passwordbase) or die ("Impossible de se connecter : " . mysql_error());
  10. mysql_select_db($database, $link);
  11. mysql_query("SET NAMES 'utf8'");
  12. $query="UPDATE uploaded SET Fichier='$Fichier', Situation='$Situation' WHERE ID=$ID";
  13. $result=mysql_query($query);
  14. return result;
  15. }
  16. function updateRdvImages($database, $serveurbase, $loginbase, $passwordbase, $images, $ID, $idutilisateur)
  17. {
  18. $link = mysql_connect($serveurbase, $loginbase, $passwordbase) or die ("Impossible de se connecter : " . mysql_error());
  19. mysql_select_db($database, $link);
  20. mysql_query("SET NAMES 'utf8'");
  21. $rendezvous = 'rendezvous'.$idutilisateur;
  22. $query="UPDATE $rendezvous SET Images=$images WHERE ID=$ID";
  23. $result=mysql_query($query);
  24. return result;
  25. }
  26. function getUploaded($database, $serveurbase, $loginbase, $passwordbase)
  27. {
  28. $rest = array();
  29. // on se connecte
  30. $link = mysql_connect($serveurbase, $loginbase, $passwordbase) or die ("Impossible de se connecter : " . mysql_error());
  31. mysql_select_db($database, $link);
  32. mysql_query("SET NAMES 'utf8'");
  33. $sql = "SELECT * FROM `Uploaded`";
  34. // on envoie la requête
  35. $req = mysql_query($sql) or die('Erreur SQL !'.$sql.''.mysql_error());
  36. // on fait une boucle qui va faire un tour pour chaque enregistrement
  37. while($data = mysql_fetch_assoc($req))
  38. {
  39. $ID = $data['ID'];
  40. $Fichier= $data['Fichier'];
  41. $Situation = $data['Situation'];
  42. array_push($rest, array("ID"=>$ID, "Fichier"=>$Fichier, "Situation"=>$Situation, "Vignette"=>''));
  43. }
  44. // on retourne le tableau
  45. return $rest;
  46. }
  47. function insertUtilisateur($database, $serveurbase, $loginbase, $passwordbase, $prenom, $nom, $hospital, $email, $adresse, $ville, $cp, $pays, $telephone, $fax, $specialite, $etude, $marqueechographe, $typeechographe, $anneesdepuisachat, $frequencesonde, $telephonecentre, $faxcentre, $adresseip, $password, $question1, $question2, $reponse1, $reponse2, $licenceAgree, $etudeAgree)
  48. {
  49. $link = mysql_connect($serveurbase, $loginbase, $passwordbase) or die ("Impossible de se connecter : " . mysql_error());
  50. mysql_select_db($database, $link);
  51. mysql_query("SET NAMES 'utf8'");
  52. $query="INSERT INTO utilisateurs (Prenom, Nom, Hospital, Email, Adresse, Ville, CP, Pays, Telephone, Fax, Specialite, Etude, MarqueEchographe, TypeEchographe, AnneesDepuisAchat, FrequenceSonde, TelephoneCentre, FaxCentre, AdresseIP, Password, indiceQuestion1, indiceQuestion2, Reponse1, Reponse2, AccepteConditions, RegistreEpidemiologique) VALUES ('$prenom', '$nom', '$hospital', '$email', '$adresse', '$ville', '$cp', '$pays', '$telephone', '$fax', '$specialite', '$etude', '$marqueechographe', '$typeechographe', '$anneesdepuisachat', '$frequencesonde', '$telephonecentre', '$faxcentre', '$adresseip', '$password', $question1, $question2, '$reponse1', '$reponse2', '$licenceAgree', '$etudeAgree' )";
  53. $result=mysql_query($query);
  54. $result2=mysql_insert_id();
  55. return $result2;
  56. }
  57. function testPassword($User)
  58. {
  59. $rest = array();
  60. $database = "mathphysician";
  61. $serveurbase = "localhost";
  62. $loginbase = "mathphysician";
  63. $passwordbase = "imt09";
  64. $link = mysql_connect($serveurbase, $loginbase, $passwordbase) or die ("Impossible de se connecter : " . mysql_error());
  65. mysql_select_db($database, $link);
  66. mysql_query("SET NAMES 'utf8'");
  67. $query="SELECT ID, Nom, Prenom, Email, Hospital, Adresse, CP, Ville, Telephone, DateEcheance, Tentatives, Credits, indiceQuestion1, indiceQuestion2, Reponse1, Reponse2, Active FROM utilisateurs WHERE (Email = '$Email' AND Password = '$Password' AND Password <> '') LIMIT 0,30000";
  68. $result=mysql_query($query);
  69. $result2=mysql_num_rows($result);
  70. if ($result2 == 1)
  71. {
  72. $data = mysql_fetch_assoc($result);
  73. $id = $data['ID'];
  74. $nom = $data['Nom'];
  75. $prenom= $data['Prenom'];
  76. $administrateur= $data['Administrateur'];
  77. $dateecheance = $data['DateEcheance'];
  78. $tentatives = $data['Tentatives'];
  79. $Email2 = $data['Email'];
  80. $prenom = $data['Prenom'];
  81. $hospital = $data['Hospital'];
  82. $adresse = $data['Adresse'];
  83. $cp = $data['CP'];
  84. $ville = $data['Ville'];
  85. $telephone = $data['Telephone'];
  86. $credits = $data['Credits'];
  87. $question1 = $data['indiceQuestion1'];
  88. $question2 = $data['indiceQuestion2'];
  89. $reponse1 = $data['Reponse1'];
  90. $reponse2 = $data['Reponse2'];
  91. $active = $data['Active'];
  92. /*
  93. if ($tentatives >= 5)
  94. {
  95. $id = 0;
  96. $nom = 'blockedaccount';
  97. $prenom= '';
  98. $administrateur= 0;
  99. $dateecheance = '';
  100. }
  101. else
  102. {
  103. */
  104. array_push($rest, array("ID"=>$id, "Nom"=>$nom, "Prenom"=>$prenom,"Hospital"=>$hospital, "Adresse"=>$adresse, "CP"=>$cp,"Ville"=>$ville,"Telephone"=>$telephone,"Administrateur"=>$administrateur, "DateEcheance"=>$dateecheance, "Credits"=>$credits, "Question1"=>$question1, "Question2"=>$question2, "Reponse1"=>$reponse1, "Reponse2"=>$reponse2, "Active"=>$active));
  105. /*
  106. if ($Email2 == $Email)
  107. {
  108. $tentatives = 0;
  109. $query="UPDATE utilisateurs SET Tentatives=$tentatives WHERE (Email = '$Email')";
  110. }
  111. $result5=mysql_query($query);
  112. }
  113. */
  114. }
  115. /* else
  116. {
  117. // Le login et le mot de passe ne correspondent pas
  118. $query = "SELECT Tentatives FROM utilisateurs WHERE (Email = '$Email') LIMIT 0,30000";
  119. $result3 = mysql_query($query);
  120. $result4 = mysql_num_rows($result3);
  121. if ($result4 >= 1)
  122. {
  123. $data3 = mysql_fetch_assoc($result3);
  124. $tentatives = $data3['Tentatives'];
  125. if ($tentatives >= 5)
  126. {
  127. $id = 0;
  128. $nom = 'maxtentatives';
  129. $prenom= '';
  130. $administrateur= 0;
  131. $dateecheance = '';
  132. }
  133. else
  134. {
  135. $tentatives++;
  136. $query="UPDATE utilisateurs SET Tentatives=$tentatives WHERE (Email = '$Email')";
  137. $result5=mysql_query($query);
  138. $id = 0;
  139. $nom = 'unknown';
  140. $prenom= '';
  141. $administrateur= 0;
  142. $dateecheance = '';
  143. }
  144. }
  145. */
  146. else
  147. {
  148. $id = 0;
  149. $nom = 'unknown';
  150. $prenom= '';
  151. $administrateur= 0;
  152. $dateecheance = '';
  153. $hospital = '';
  154. $adresse = '';
  155. $cp = '';
  156. $ville = '';
  157. $telephone = '';
  158. $credits = 0;
  159. $question1 = 0;
  160. $question2 = 0;
  161. $reponse1 = '';
  162. $reponse2 = '';
  163. $active = 0;
  164. array_push($rest, array("ID"=>$id, "Nom"=>$nom, "Prenom"=>$prenom,"Hospital"=>$hospital, "Adresse"=>$adresse, "CP"=>$cp,"Ville"=>$ville,"Telephone"=>$telephone,"Administrateur"=>$administrateur, "DateEcheance"=>$dateecheance, "Credits"=>$credits, "Question1"=>$question1, "Question2"=>$question2, "Reponse1"=>$reponse1, "Reponse2"=>$reponse2, "Active"=>$active));
  165. }
  166. // on retourne le tableau
  167. return $rest;
  168. }
  169. function getReponses($database, $serveurbase, $loginbase, $passwordbase, $Email)
  170. {
  171. $rest = array();
  172. $link = mysql_connect($serveurbase, $loginbase, $passwordbase) or die ("Impossible de se connecter : " . mysql_error());
  173. mysql_select_db($database, $link);
  174. mysql_query("SET NAMES 'utf8'");
  175. $query="SELECT ID, indiceQuestion1, indiceQuestion2, Reponse1, Reponse2 FROM utilisateurs WHERE (Email = '$Email') LIMIT 0,30000";
  176. $result=mysql_query($query);
  177. $result2=mysql_num_rows($result);
  178. if ($result2 == 1)
  179. {
  180. $data = mysql_fetch_assoc($result);
  181. $id = $data['ID'];
  182. $question1 = $data['indiceQuestion1'];
  183. $question2 = $data['indiceQuestion2'];
  184. $reponse1 = $data['Reponse1'];
  185. $reponse2 = $data['Reponse2'];
  186. }
  187. else
  188. {
  189. $id = 0;
  190. $question1 = 0;
  191. $question2 = 0;
  192. $reponse1 = '';
  193. $reponse2 = '';
  194. }
  195. array_push($rest, array("ID"=>$id, "Question1"=>$question1, "Question2"=>$question2, "Reponse1"=>$reponse1, "Reponse2"=>$reponse2));
  196. // on retourne le tableau
  197. return $rest;
  198. }
  199. function testEmail($database, $serveurbase, $loginbase, $passwordbase, $Email)
  200. {
  201. $link = mysql_connect($serveurbase, $loginbase, $passwordbase) or die ("Impossible de se connecter : " . mysql_error());
  202. mysql_select_db($database, $link);
  203. mysql_query("SET NAMES 'utf8'");
  204. $query = "SELECT Nom, Prenom FROM utilisateurs WHERE (Email = '$Email' AND Password <> '') LIMIT 0,30000";
  205. $result = mysql_query($query);
  206. $result2 = mysql_num_rows($result);
  207. return $result2;
  208. }
  209. function verifDemoDemandee($database, $serveurbase, $loginbase, $passwordbase, $Email, $Password)
  210. {
  211. $rest = array();
  212. $link = mysql_connect($serveurbase, $loginbase, $passwordbase) or die ("Impossible de se connecter : " . mysql_error());
  213. mysql_select_db($database, $link);
  214. mysql_query("SET NAMES 'utf8'");
  215. $query = "SELECT DemoDemandee FROM utilisateurs WHERE (Email = '$Email') LIMIT 0,30000";
  216. $result = mysql_query($query);
  217. $result2 = mysql_num_rows($result);
  218. if ($result2 > 0)
  219. {
  220. $data = mysql_fetch_assoc($result);
  221. $demo = $data['DemoDemandee'];
  222. }
  223. else
  224. {
  225. $demo = 0;
  226. }
  227. array_push($rest, array("DemoDemandee"=>$demo));
  228. return $rest;
  229. }
  230. function writeDemoDemandee($database, $serveurbase, $loginbase, $passwordbase, $Email, $Password)
  231. {
  232. $link = mysql_connect($serveurbase, $loginbase, $passwordbase) or die ("Impossible de se connecter : " . mysql_error());
  233. mysql_select_db($database, $link);
  234. mysql_query("SET NAMES 'utf8'");
  235. $query = "UPDATE utilisateurs SET DemoDemandee=1 WHERE (Email = '$Email')";
  236. $result = mysql_query($query);
  237. return 1;
  238. }
  239. function verifPromoDemandee($database, $serveurbase, $loginbase, $passwordbase, $Email, $Password)
  240. {
  241. $rest = array();
  242. $link = mysql_connect($serveurbase, $loginbase, $passwordbase) or die ("Impossible de se connecter : " . mysql_error());
  243. mysql_select_db($database, $link);
  244. mysql_query("SET NAMES 'utf8'");
  245. $query = "SELECT PromotionDemandee FROM utilisateurs WHERE (Email = '$Email') LIMIT 0,30000";
  246. $result = mysql_query($query);
  247. $result2 = mysql_num_rows($result);
  248. if ($result2 > 0)
  249. {
  250. $data = mysql_fetch_assoc($result);
  251. $promo = $data['PromotionDemandee'];
  252. }
  253. else
  254. {
  255. $promo = 0;
  256. }
  257. array_push($rest, array("PromotionDemandee"=>$promo));
  258. return $rest;
  259. }
  260. function writePromoDemandee($database, $serveurbase, $loginbase, $passwordbase, $Email, $Password)
  261. {
  262. $link = mysql_connect($serveurbase, $loginbase, $passwordbase) or die ("Impossible de se connecter : " . mysql_error());
  263. mysql_select_db($database, $link);
  264. mysql_query("SET NAMES 'utf8'");
  265. $query = "UPDATE utilisateurs SET PromotionDemandee=1 WHERE (Email = '$Email')";
  266. $result = mysql_query($query);
  267. return 1;
  268. }
  269. function getPassword($database, $serveurbase, $loginbase, $passwordbase, $Email)
  270. {
  271. $rest = array();
  272. $link = mysql_connect($serveurbase, $loginbase, $passwordbase) or die ("Impossible de se connecter : " . mysql_error());
  273. mysql_select_db($database, $link);
  274. mysql_query("SET NAMES 'utf8'");
  275. $query="SELECT Password FROM utilisateurs WHERE (Email = '$Email') LIMIT 0,30000";
  276. $result=mysql_query($query);
  277. $result2=mysql_num_rows($result);
  278. if ($result2 >= 1)
  279. {
  280. while($data = mysql_fetch_assoc($result))
  281. {
  282. $password = $data['Password'];
  283. array_push($rest, array("Password"=>$password));
  284. }
  285. }
  286. else
  287. {
  288. $password = '';
  289. array_push($rest, array("Password"=>$password));
  290. }
  291. // on retourne le tableau
  292. return $rest;
  293. }
  294. function insertLogin($database, $serveurbase, $loginbase, $passwordbase, $Email, $Date, $Action, $AdresseIP)
  295. {
  296. $link = mysql_connect($serveurbase, $loginbase, $passwordbase) or die ("Impossible de se connecter : " . mysql_error());
  297. mysql_select_db($database, $link);
  298. mysql_query("SET NAMES 'utf8'");
  299. $query="INSERT INTO login (Email, Date, Action, AdresseIP) VALUES ('$Email', '$Date', '$Action', '$AdresseIP')";
  300. $result=mysql_query($query);
  301. return result;
  302. }
  303. function selectUpload($database, $serveurbase, $loginbase, $passwordbase)
  304. {
  305. $link = mysql_connect($serveurbase, $loginbase, $passwordbase) or die ("Impossible de se connecter : " . mysql_error());
  306. mysql_select_db($database, $link);
  307. mysql_query("SET NAMES 'utf8'");
  308. // $query = "SELECT Fichier, Situation FROM uploaded WHERE ((Situation = 'CCA Right') OR (Situation = 'CCA Left')) LIMIT 0,30000";
  309. $query = "SELECT Fichier, Situation FROM uploaded WHERE (Situation <> '') LIMIT 0,30000";
  310. $result = mysql_query($query);
  311. return $result;
  312. }
  313. function insertPatient($database, $serveurbase, $loginbase, $passwordbase, $IDUtilisateur, $Nom, $Prenom, $Sexe, $DateDeNaissance, $Taille, $UniteTaille, $Poids, $UnitePoids, $Race, $PaysNaissance, $PaysActuel, $NbAnneesPaysActuel)
  314. {
  315. $link = mysql_connect($serveurbase, $loginbase, $passwordbase) or die ("Impossible de se connecter : " . mysql_error());
  316. mysql_select_db($database, $link);
  317. mysql_query("SET NAMES 'utf8'");
  318. $patients = 'patients'.$IDUtilisateur;
  319. $query = "INSERT INTO $patients (IDUtilisateur, Nom, Prenom, Sexe, DateDeNaissance, Taille, UniteTaille, Poids, UnitePoids, Race, PaysNaissance, PaysActuel, NbAnneesPaysActuel) VALUES ('$IDUtilisateur', '$Nom', '$Prenom', '$Sexe', '$DateDeNaissance', '$Taille', '$UniteTaille', '$Poids', '$UnitePoids', '$Race', '$PaysNaissance', '$PaysActuel', '$NbAnneesPaysActuel')";
  320. $result = mysql_query($query);
  321. $result2 = mysql_insert_id();
  322. return $result2;
  323. }
  324. function saveJPEG($filename, $bytesArray)
  325. {
  326. $data = $bytesArray->data;
  327. file_put_contents("../../../uploader/myFileDir/" . $filename, $data);
  328. return '1';
  329. }
  330. function CreateDirectoryIfNotExist($dir1, $dir2, $dir3, $dir4, $dir5, $dir6)
  331. {
  332. if (!is_dir($dir1))
  333. {
  334. mkdir($dir1);
  335. chmod($dir1, 0777);
  336. }
  337. if (!is_dir($dir2))
  338. {
  339. mkdir($dir2);
  340. chmod($dir2, 0777);
  341. }
  342. if (!is_dir($dir3))
  343. {
  344. mkdir($dir3);
  345. chmod($dir3, 0777);
  346. }
  347. if (!is_dir($dir4))
  348. {
  349. mkdir($dir4);
  350. chmod($dir4, 0777);
  351. }
  352. if (!is_dir($dir5))
  353. {
  354. mkdir($dir5);
  355. chmod($dir5, 0777);
  356. }
  357. if (!is_dir($dir6))
  358. {
  359. mkdir($dir6);
  360. chmod($dir6, 0777);
  361. }
  362. return true;
  363. }
  364. // Fonction pour Ovh car chmod et filesize et file_exists fct pas sous Wamp
  365. function ArchiveImagesIntimaMedia($etude, $localhost, $clean1, $source1, $dest1, $clean2, $source2, $dest2, $clean3, $source3, $dest3, $clean4, $source4, $dest4, $clean5, $source5, $dest5, $clean6, $source6, $dest6)
  366. {
  367. /*
  368. $ret = '0';
  369. chmod($source1, 0777);
  370. chmod($source2, 0777);
  371. chmod($source3, 0777);
  372. chmod($source4, 0777);
  373. chmod($source5, 0777);
  374. chmod($source6, 0777);
  375. if (file_exists($source1) && file_exists($source2) && file_exists($source3) && file_exists($source4) && file_exists($source5) && file_exists($source6))
  376. {
  377. $s1 = filesize($source1);
  378. $s2 = filesize($source2);
  379. $s3 = filesize($source3);
  380. $s4 = filesize($source4);
  381. $s5 = filesize($source5);
  382. $s6 = filesize($source6);
  383. copy($source1, $dest1);
  384. copy($source2, $dest2);
  385. copy($source3, $dest3);
  386. copy($source4, $dest4);
  387. copy($source5, $dest5);
  388. copy($source6, $dest6);
  389. $ret = '1';
  390. // Vérification de la taille
  391. if (file_exists($dest1) && file_exists($dest2) && file_exists($dest3) && file_exists($dest4) && file_exists($dest5) && file_exists($dest6))
  392. {
  393. chmod($dest1, 0777);
  394. chmod($dest2, 0777);
  395. chmod($dest3, 0777);
  396. chmod($dest4, 0777);
  397. chmod($dest5, 0777);
  398. chmod($dest6, 0777);
  399. $d1 = filesize($dest1);
  400. $d2 = filesize($dest2);
  401. $d3 = filesize($dest3);
  402. $d4 = filesize($dest4);
  403. $d5 = filesize($dest5);
  404. $d6 = filesize($dest6);
  405. $ret = '2';
  406. if (($s1 == $d1) && ($s2 == $d2) && ($s3 == $d3) && ($s4 == $d4) && ($s5 == $d5) && ($s6 == $d6))
  407. {
  408. $ret = '3';
  409. if (($s1 > 0) && ($s2 > 0) && ($s3 > 0) && ($s4 > 0) && ($s5 > 0) && ($s6 > 0))
  410. {
  411. $ret = '4';
  412. }
  413. }
  414. }
  415. }
  416. return $ret;
  417. */
  418. $ret = '0';
  419. if ($etude == 256)
  420. {
  421. if (($dest1 != '') && ($source1 != ''))
  422. {
  423. copy($source1, $dest1);
  424. }
  425. if (($dest1 != '') && ($clean1 == 1))
  426. {
  427. unlink($dest1);
  428. }
  429. if (($dest2 != '') && ($source2 != ''))
  430. {
  431. copy($source2, $dest2);
  432. }
  433. if (($dest2 != '') && ($clean2 == 1))
  434. {
  435. unlink($dest2);
  436. }
  437. if (($dest3 != '') && ($source3 != ''))
  438. {
  439. copy($source3, $dest3);
  440. }
  441. if (($dest3 != '') && ($clean3 == 1))
  442. {
  443. unlink($dest3);
  444. }
  445. if (($dest4 != '') && ($source4 != ''))
  446. {
  447. copy($source4, $dest4);
  448. }
  449. if (($dest4 != '') && ($clean4 == 1))
  450. {
  451. unlink($dest4);
  452. }
  453. if (($dest5 != '') && ($source5 != ''))
  454. {
  455. copy($source5, $dest5);
  456. }
  457. if (($dest5 != '') && ($clean5 == 1))
  458. {
  459. unlink($dest5);
  460. }
  461. if (($dest6 != '') && ($source6 != ''))
  462. {
  463. copy($source6, $dest6);
  464. }
  465. if (($dest6 != '') && ($clean6 == 1))
  466. {
  467. unlink($dest6);
  468. }
  469. }
  470. else
  471. {
  472. // Pour Etude 0 et 1
  473. copy($source1, $dest1); // CCAR
  474. copy($source4, $dest4); // CCAL
  475. if (($etude == 1) || ($etude == 2)) // Pour Etude 1 et 2
  476. {
  477. copy($source2, $dest2);
  478. copy($source3, $dest3);
  479. copy($source5, $dest5);
  480. copy($source6, $dest6);
  481. }
  482. }
  483. $ret = '4';
  484. return $ret;
  485. }
  486. function ArchiveImagesLocalHost($source1, $dest1, $source2, $dest2, $source3, $dest3, $source4, $dest4, $source5, $dest5, $source6, $dest6)
  487. {
  488. $ret = '0';
  489. copy($source1, $dest1);
  490. copy($source2, $dest2);
  491. copy($source3, $dest3);
  492. copy($source4, $dest4);
  493. copy($source5, $dest5);
  494. copy($source6, $dest6);
  495. $ret = '4';
  496. return $ret;
  497. }
  498. function GetAdresseIP()
  499. {
  500. if (!empty($_SERVER['HTTP_CLIENT_IP'])) //check ip from share internet
  501. {
  502. $ip=$_SERVER['HTTP_CLIENT_IP'];
  503. }
  504. elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) //to check ip is pass from proxy
  505. {
  506. $ip=$_SERVER['HTTP_X_FORWARDED_FOR'];
  507. }
  508. else
  509. {
  510. $ip=$_SERVER['REMOTE_ADDR'];
  511. }
  512. return $ip;
  513. }
  514. function GetPathOvh()
  515. {
  516. return ($_SERVER['DOCUMENT_ROOT']);
  517. // return dirname(__FILE__);
  518. }
  519. function zipVisite($etude, $pdf, $img1, $img2, $img3, $img4, $img5, $img6, $zipName)
  520. {
  521. require( "ziplib/zip.lib.php" ); // librairie ZIP
  522. $zip = new zipfile () ; //on crée une instance zip
  523. // liste des fichiers à compresser
  524. // Pour Etude 0: uniquement img1 et img4
  525. $files = array ($img1, $img4, $img2, $img3, $img5, $img6 ) ;
  526. $f1 = basename($img1);
  527. $f4 = basename($img4);
  528. $f2 = basename($img2);
  529. $f3 = basename($img3);
  530. $f5 = basename($img5);
  531. $f6 = basename($img6);
  532. $filesname = array ($f1, $f4, $f2, $f3, $f5, $f6 ) ;
  533. $i = 0 ;
  534. while ( count( $files ) > $i )
  535. {
  536. if ((($etude == 0) && ($i < 2)) || ($etude == 1) || ($etude == 2) || ($etude == 256))
  537. {
  538. if ($filesname[$i] != '')
  539. {
  540. $zip->addfile(file_get_contents($files[$i]), $filesname[$i]) ; //on ajoute le fichier
  541. }
  542. }
  543. $i++; //on incrémente i
  544. }
  545. $pdfname = basename($pdf);
  546. $zip->addfile(file_get_contents($pdf), $pdfname); //on ajoute le fichier
  547. $archive = $zip->file() ; // on associe l'archive
  548. // on enregistre l'archive dans un fichier
  549. $open = fopen( $zipName , "wb");
  550. fwrite($open, $archive);
  551. fclose($open);
  552. }
  553. function zipVisite2($pdf, $img1, $img2, $img3, $img4, $img5, $img6, $zipName)
  554. {
  555. echo system("zip -P 1234 -j $zipName \"$pdf\"");
  556. }
  557. function testFilePdfCreated($pdf)
  558. {
  559. if (file_exists($pdf))
  560. {
  561. return '1';
  562. }
  563. else
  564. {
  565. return '0';
  566. }
  567. }
  568. function testFilePdfCreated2($pdf)
  569. {
  570. if (file_exists($pdf))
  571. {
  572. return '1';
  573. }
  574. else
  575. {
  576. return '0';
  577. }
  578. }
  579. function sendForgetPassword($name, $from, $subject, $emailMessage)
  580. {
  581. include_once('class.phpmailer.php');
  582. $mail = new PHPMailer();
  583. $body = $emailMessage;
  584. $body = eregi_replace("[\]",'',$body);
  585. $mail->IsSendmail(); // telling the class to use SendMail transport
  586. $mail->From = $from;
  587. $mail->FromName = $from;
  588. $mail->Subject = $subject;
  589. $mail->AltBody = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test
  590. $mail->MsgHTML($body);
  591. $mail->AddAddress($name, 'Support');
  592. if(!$mail->Send())
  593. {
  594. return '0';
  595. }
  596. else
  597. {
  598. return '1';
  599. }
  600. }
  601. function sendEmailLogin($name, $from, $subject, $emailMessage)
  602. {
  603. include_once('class.phpmailer.php');
  604. $mail = new PHPMailer();
  605. $body = $emailMessage;
  606. $body = eregi_replace("[\]",'',$body);
  607. $mail->IsSendmail(); // telling the class to use SendMail transport
  608. $mail->From = $from;
  609. $mail->FromName = $from;
  610. $mail->Subject = $subject;
  611. $mail->AltBody = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test
  612. $mail->MsgHTML($body);
  613. $mail->AddAddress($name, 'Support');
  614. if(!$mail->Send())
  615. {
  616. return '0';
  617. }
  618. else
  619. {
  620. return '1';
  621. }
  622. }
  623. function sendVisite($ndest, $zipname, $to1, $to2, $to3, $from, $subject, $emailMessage)
  624. {
  625. include_once('class.phpmailer.php');
  626. $mail = new PHPMailer();
  627. $body = $emailMessage;
  628. $body = eregi_replace("[\]",'',$body);
  629. $mail->IsSendmail(); // telling the class to use SendMail transport
  630. $mail->From = $from;
  631. $mail->FromName = $from;
  632. $mail->Subject = $subject;
  633. $mail->AltBody = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test
  634. $mail->MsgHTML($body);
  635. //$mail->AddAddress($to1, "Dest 1");
  636. if ($ndest > 1)
  637. {
  638. $mail->AddAddress($to2, "Dest 2");
  639. $mail->AddAddress($to3, "Dest 3");
  640. }
  641. $mail->AddAttachment($zipname); // attachment
  642. if (!$mail->Send())
  643. {
  644. return '0';
  645. }
  646. else
  647. {
  648. return '1';
  649. }
  650. }
  651. function sendVisiteCtrl($to1, $from, $subject, $emailMessage)
  652. {
  653. include_once('class.phpmailer.php');
  654. $mail = new PHPMailer();
  655. $body = $emailMessage;
  656. $body = eregi_replace("[\]",'',$body);
  657. $mail->IsSendmail(); // telling the class to use SendMail transport
  658. $mail->From = $from;
  659. $mail->FromName = $from;
  660. $mail->Subject = $subject;
  661. $mail->AltBody = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test
  662. $mail->MsgHTML($body);
  663. $mail->AddAddress($to1, "Dest 1");
  664. if(!$mail->Send())
  665. {
  666. return '0';
  667. }
  668. else
  669. {
  670. return '1';
  671. }
  672. }
  673. function sendInscription($to1, $to2, $from, $subject, $emailMessage)
  674. {
  675. include_once('class.phpmailer.php');
  676. $mail = new PHPMailer();
  677. $body = $emailMessage;
  678. $body = eregi_replace("[\]",'',$body);
  679. $mail->IsSendmail(); // telling the class to use SendMail transport
  680. $mail->From = $from;
  681. $mail->FromName = $from;
  682. $mail->Subject = $subject;
  683. $mail->AltBody = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test
  684. $mail->MsgHTML($body);
  685. $mail->AddAddress($to1, "Dest 1");
  686. $mail->AddAddress($to2, "Dest 2");
  687. if (!$mail->Send())
  688. {
  689. return '0';
  690. }
  691. else
  692. {
  693. return '1';
  694. }
  695. }
  696. // Fonction qui renvoie la date du serveur
  697. function GetDateServeur()
  698. {
  699. $today = date("d-m")."-20".date('y')." ".date('H:i');
  700. return ($today);
  701. }
  702. function getIDPatient($database, $serveurbase, $loginbase, $passwordbase, $prenompatient_c, $nompatient_c, $datedenaissance_c, $idutilisateur, $key, $commercial)
  703. {
  704. $rest = array();
  705. $id = 0;
  706. $tpatients = 'patients'.$idutilisateur;
  707. $link = mysql_connect($serveurbase, $loginbase, $passwordbase) or die ("Impossible de se connecter : " . mysql_error());
  708. mysql_select_db($database, $link);
  709. mysql_query("SET NAMES 'utf8'");
  710. /* $crypt = new encryption_class;
  711. if ($commercial == '1')
  712. {
  713. $nompatient = $crypt->encrypt($key, $nompatient_c);
  714. $prenompatient = $crypt->encrypt($key, $prenompatient_c);
  715. $datedenaissance = $crypt->encrypt($key, $datedenaissance_c);
  716. }
  717. else
  718. {
  719. */
  720. $nompatient = $nompatient_c;
  721. $prenompatient = $prenompatient_c;
  722. $datedenaissance = $datedenaissance_c;
  723. // }
  724. // Récupère l'ID patient
  725. // ivrs est un text
  726. $query = "SELECT ID FROM $tpatients WHERE (Nom = '$nompatient' AND Prenom = '$prenompatient' AND DateDeNaissance = '$datedenaissance') LIMIT 0,30000";
  727. $result = mysql_query($query);
  728. $result2 = mysql_num_rows($result);
  729. if ($result2 >= 1)
  730. {
  731. while($data = mysql_fetch_assoc($result))
  732. {
  733. $id = $data['ID'];
  734. array_push($rest, array("ID"=>$id));
  735. }
  736. }
  737. else
  738. {
  739. $id = 0;
  740. array_push($rest, array("ID"=>$id));
  741. }
  742. // on retourne le tableau
  743. return $rest;
  744. }
  745. function MAJPatientPhysician($database, $serveurbase, $loginbase, $passwordbase, $idrendezvous, $highbloodpressure,$hypercholesterolemia,$diabetes,$hypertriglyceridemia,$smoking,$coronaryheartdisease,$ischemicstroke,$arrhytmia,$nbhighbloodpressure,$nbhypercholesterolemia,$nbdiabetes,$nbhypertriglyceridemia,$nbcigarettesday,$nbyearsmoking,$typecoronaryheartdisease,$nbischemicstroke,$typeischemicstroke,$etiologyischemicstroke,$bloodpressurerightarm,$bloodpressureleftarm,$heartrate,$antihypertensive,$hypolipidemic,$antidiabetis,$antithrombotic,$autre,$antihypertensivename1,$antihypertensiveposology1,$antihypertensivestartingdate1,$antihypertensivenName2,$antihypertensiveposology2,$antihypertensivestartingdate2,$antihypertensivename3,$antihypertensiveposology3,$antihypertensivestartingdate3,$hypolipidemicname1,$hypolipidemicposology1,$hypolipidemicstartingDate1,$hypolipidemicname2, $hypolipidemicposology2,$hypolipidemicstartingdate2,$hypolipidemicname3,$hypolipidemicposology3,$hypolipidemicstartingdate3,$antidiabetisname1,$antidiabetisposology1,$antidiabetisstartingdate1,$antidiabetisname2,$antidiabetisposology2,$antidiabetisstartingdate2,$antidiabetisname3,$antidiabetisposology3,$antidiabetisstartingDate3,$antithromboticname1,$antithromboticposology1,$antithromboticstartingdate1,$antithromboticname2,$antithromboticposology2,$antithromboticstartingdate2,$antithromboticname3,$antithromboticposology3,$antithromboticstartingdate3, $autrename1, $autreposology1, $autrestartingdate1, $autrename2, $autreposology2, $autrestartingdate2, $autrename3, $autreposology3, $autrestartingdate3, $notespatient, $idutilisateur)
  746. {
  747. $link = mysql_connect($serveurbase, $loginbase, $passwordbase) or die ("Impossible de se connecter : " . mysql_error());
  748. mysql_select_db($database, $link);
  749. mysql_query("SET NAMES 'utf8'");
  750. $trendezvous = 'rendezvous'.$idutilisateur;
  751. $query="UPDATE $trendezvous SET HighBloodPressure='$highbloodpressure', Hypercholesterolemia='$hypercholesterolemia',Diabetes='$diabetes',Hypertriglyceridemia='$hypertriglyceridemia',Smoking='$smoking',CoronaryHeartDisease='$coronaryheartdisease',IschemicStroke='$ischemicstroke',Arrhytmia='$arrhytmia',NbHighBloodPressure='$nbhighbloodpressure',NbHypercholesterolemia='$nbhypercholesterolemia',NbDiabetes='$nbdiabetes',NbHypertriglyceridemia='$nbhypertriglyceridemia',NbCigarettesDay='$nbcigarettesday',NbYearSmoking='$nbyearsmoking',TypeCoronaryHearDisease='$typecoronaryheartdisease',NbIschemicStroke='$nbischemicstroke',TypeIschelicStroke='$typeischemicstroke',EtiologyIschemicStroke='$etiologyischemicstroke',BloodPressureRightArm='$bloodpressurerightarm',BloodPressureLeftArm='$bloodpressureleftarm',HeartRate='$heartrate',AntiHypertensive='$antihypertensive',Hypolipidemic='$hypolipidemic',Antidiabetis='$antidiabetis',AntiThrombotic='$antithrombotic',Autre='$autre',AntiHypertensiveName1='$antihypertensivename1',AntiHypertensivePosology1='$antihypertensiveposology1',AntiHypertensiveStartingDate1='$antihypertensivestartingdate1',AntiHypertensiveName2='$antihypertensivenName2',AntiHypertensivePosology2='$antihypertensiveposology2',AntiHypertensiveStartingDate2='$antihypertensivestartingdate2',AntiHypertensiveName3='$antihypertensivename3',AntiHypertensivePosology3='$antihypertensiveposology3',AntiHypertensiveStartingDate3='$antihypertensivestartingdate3',HypolipidemicName1='$hypolipidemicname1',HypolipidemicPosology1='$hypolipidemicposology1',HypolipidemicStartingDate1='$hypolipidemicstartingDate1',HypolipidemicName2='$hypolipidemicname2',HypolipidemicPosology2='$hypolipidemicposology2',HypolipidemicStartingDate2='$hypolipidemicstartingdate2',HypolipidemicName3='$hypolipidemicname3',HypolipidemicPosology3='$hypolipidemicposology3',HypolipidemicStartingDate3='$hypolipidemicstartingdate3',AntidiabetisName1='$antidiabetisname1',AntidiabetisPosology1='$antidiabetisposology1',AntidiabetisStartingDate1='$antidiabetisstartingdate1',AntidiabetisName2='$antidiabetisname2',AntidiabetisPosology2='$antidiabetisposology2',AntidiabetisStartingDate2='$antidiabetisstartingdate2',AntidiabetisName3='$antidiabetisname3',AntidiabetisPosology3='$antidiabetisposology3',AntidiabetisStartingDate3='$antidiabetisstartingDate3',AntiThromboticName1='$antithromboticname1',AntiThromboticPosology1='$antithromboticposology1',AntiThromboticStartingDate1='$antithromboticstartingdate1',AntiThromboticName2='$antithromboticname2',AntiThromboticPosology2='$antithromboticposology2',AntiThromboticStartingDate2='$antithromboticstartingdate2',AntiThromboticName3='$antithromboticname3',AntiThromboticPosology3='$antithromboticposology3',AntithromboticStartingDate3='$antithromboticstartingdate3',AutreName1='$autrename1',AutrePosology1='$autreposology1',AutreStartingDate1='$autrestartingdate1',AutreName2='$autrename2',AutrePosology2='$autreposology2',AutreStartingDate2='$autrestartingdate2',AutreName3='$autrename3',AutrePosology3='$autreposology3',AutreStartingDate3='$autrestartingdate3',NotesPatient='$notespatient' WHERE ID=$idrendezvous";
  752. $result = mysql_query($query);
  753. $id = mysql_insert_id();
  754. return $id;
  755. }
  756. function testStudyCreated($physician, $database, $serveurbase, $loginbase, $passwordbase, $prenompatient_c,$nompatient_c,$sexe, $datedenaissance_c,$ivrs,$taille,$unitetaille,$poids,$unitepoids,$race, $paysdenaissance, $paysactuel,$nbanneespaysactuel,$visitnumber,$datedevisite,$highbloodpressure,$hypercholesterolemia,$diabetes,$hypertriglyceridemia,$smoking,$coronaryheartdisease,$ischemicstroke,$arrhytmia,$nbhighbloodpressure,$nbhypercholesterolemia,$nbdiabetes,$nbhypertriglyceridemia,$nbcigarettesday,$nbyearsmoking,$typecoronaryheartdisease,$nbischemicstroke,$typeischemicstroke,$etiologyischemicstroke,$bloodpressurerightarm,$bloodpressureleftarm,$heartrate,$antihypertensive,$hypolipidemic,$antidiabetis,$antithrombotic,$autre,$antihypertensivename1,$antihypertensiveposology1,$antihypertensivestartingdate1,$antihypertensivenName2,$antihypertensiveposology2,$antihypertensivestartingdate2,$antihypertensivename3,$antihypertensiveposology3,$antihypertensivestartingdate3,$hypolipidemicname1,$hypolipidemicposology1,$hypolipidemicstartingDate1,$hypolipidemicname2, $hypolipidemicposology2,$hypolipidemicstartingdate2,$hypolipidemicname3,$hypolipidemicposology3,$hypolipidemicstartingdate3,$antidiabetisname1,$antidiabetisposology1,$antidiabetisstartingdate1,$antidiabetisname2,$antidiabetisposology2,$antidiabetisstartingdate2,$antidiabetisname3,$antidiabetisposology3,$antidiabetisstartingDate3,$antithromboticname1,$antithromboticposology1,$antithromboticstartingdate1,$antithromboticname2,$antithromboticposology2,$antithromboticstartingdate2,$antithromboticname3,$antithromboticposology3,$antithromboticstartingdate3, $autrename1, $autreposology1, $autrestartingdate1, $autrename2, $autreposology2, $autrestartingdate2, $autrename3, $autreposology3, $autrestartingdate3, $notespatient, $idutilisateur, $key, $commercial)
  757. {
  758. $rest = array();
  759. $id = 0;
  760. $idvisite = 0;
  761. $tpatients = 'patients'.$idutilisateur;
  762. $trendezvous = 'rendezvous'.$idutilisateur;
  763. /*
  764. $crypt = new encryption_class;
  765. if ($commercial == '1')
  766. {
  767. $nompatient = $crypt->encrypt($key, $nompatient_c);
  768. $prenompatient = $crypt->encrypt($key, $prenompatient_c);
  769. $datedenaissance = $crypt->encrypt($key, $datedenaissance_c);
  770. }
  771. else
  772. {
  773. */
  774. $nompatient = $nompatient_c;
  775. $prenompatient = $prenompatient_c;
  776. $datedenaissance = $datedenaissance_c;
  777. // }
  778. $link = mysql_connect($serveurbase, $loginbase, $passwordbase) or die ("Impossible de se connecter : " . mysql_error());
  779. mysql_select_db($database, $link);
  780. mysql_query("SET NAMES 'utf8'");
  781. // Récupère l'ID patient
  782. // ivrs est un text
  783. // $query = "SELECT ID FROM $tpatients WHERE (Nom = '$nompatient' AND Prenom = '$prenompatient' AND Sexe = '$sexe' AND DateDeNaissance = '$datedenaissance' AND IVRS = '$ivrs') LIMIT 0,30000";
  784. if ($physician == 1)
  785. {
  786. $query = "SELECT ID FROM $tpatients WHERE (Nom = '$nompatient' AND Prenom = '$prenompatient' AND Sexe = '$sexe' AND DateDeNaissance = '$datedenaissance' AND PaysActuel = '$paysactuel' AND PaysNaissance = '$paysdenaissance') LIMIT 0,30000";
  787. }
  788. else
  789. {
  790. $query = "SELECT ID FROM $tpatients WHERE (Nom = '$nompatient' AND Prenom = '$prenompatient' AND Sexe = '$sexe' AND DateDeNaissance = '$datedenaissance') LIMIT 0,30000";
  791. }
  792. $result = mysql_query($query);
  793. $result2 = mysql_num_rows($result);
  794. if ($result2 > 0)
  795. {
  796. while($data = mysql_fetch_assoc($result))
  797. {
  798. $id = $data['ID'];
  799. }
  800. }
  801. else
  802. {
  803. // Ecriture du patient
  804. // Sans les '' autour des variables texte, ça ne marche pas
  805. $query = "INSERT INTO $tpatients (Nom, Prenom, Sexe, DateDeNaissance, IVRS, IDUtilisateur, Taille, UniteTaille, Poids, UnitePoids, Race, PaysNaissance, PaysActuel, NBAnneesPaysActuel) VALUES ('$nompatient', '$prenompatient', '$sexe', '$datedenaissance', '$ivrs', $idutilisateur, '$taille', '$unitetaille', '$poids', '$unitepoids', '$race', '$paysdenaissance', '$paysactuel', '$nbanneespaysactuel')";
  806. $result = mysql_query($query);
  807. $id = mysql_insert_id();
  808. }
  809. if ($id > 0)
  810. {
  811. // Récupère l'ID visite
  812. $query="SELECT ID FROM $trendezvous WHERE (IDPatient = $id AND Visite = $visitnumber) LIMIT 0,30000";
  813. $result=mysql_query($query);
  814. $result2 = mysql_num_rows($result);
  815. if ($result2 == 0) // La visite n'existe pas déja
  816. {
  817. // Ecriture du rendez vous
  818. if ($physician == 1)
  819. {
  820. $query="INSERT INTO $trendezvous (IDPatient, Date, Visite, HighBloodPressure, Hypercholesterolemia, Diabetes, Hypertriglyceridemia, Smoking, CoronaryHeartDisease, IschemicStroke,Arrhytmia, NbHighBloodPressure,NbHypercholesterolemia, NbDiabetes,NbHypertriglyceridemia,NbCigarettesDay,NbYearSmoking,TypeCoronaryHearDisease,NbIschemicStroke,TypeIschelicStroke, EtiologyIschemicStroke,BloodPressureRightArm,BloodPressureLeftArm,HeartRate,AntiHypertensive,Hypolipidemic,Antidiabetis,AntiThrombotic,Autre,AntiHypertensiveName1,AntiHypertensivePosology1,AntiHypertensiveStartingDate1,AntiHypertensiveName2,AntiHypertensivePosology2,AntiHypertensiveStartingDate2,AntiHypertensiveName3,AntiHypertensivePosology3,AntiHypertensiveStartingDate3,HypolipidemicName1,HypolipidemicPosology1,HypolipidemicStartingDate1,HypolipidemicName2,HypolipidemicPosology2,HypolipidemicStartingDate2,HypolipidemicName3,HypolipidemicPosology3,HypolipidemicStartingDate3,AntidiabetisName1,AntidiabetisPosology1,AntidiabetisStartingDate1,AntidiabetisName2,AntidiabetisPosology2,AntidiabetisStartingDate2,AntidiabetisName3,AntidiabetisPosology3,AntidiabetisStartingDate3,AntiThromboticName1,AntiThromboticPosology1,AntiThromboticStartingDate1,AntiThromboticName2,AntiThromboticPosology2,AntiThromboticStartingDate2,AntiThromboticName3,AntiThromboticPosology3,AntithromboticStartingDate3, AutreName1,AutrePosology1,AutreStartingDate1,AutreName2,AutrePosology2,AutreStartingDate2,AutreName3,AutrePosology3,AutreStartingDate3,NotesPatient) VALUES ($id, '$datedevisite', $visitnumber, '$highbloodpressure','$hypercholesterolemia','$diabetes','$hypertriglyceridemia','$smoking', '$coronaryheartdisease', '$ischemicstroke','$arrhytmia', '$nbhighbloodpressure','$nbhypercholesterolemia','$nbdiabetes', '$nbhypertriglyceridemia','$nbcigarettesday','$nbyearsmoking','$typecoronaryheartdisease','$nbischemicstroke','$typeischemicstroke', '$etiologyischemicstroke', '$bloodpressurerightarm','$bloodpressureleftarm','$heartrate','$antihypertensive','$hypolipidemic','$antidiabetis','$antithrombotic','$autre','$antihypertensivename1','$antihypertensiveposology1','$antihypertensivestartingdate1','$antihypertensivenName2','$antihypertensiveposology2','$antihypertensivestartingdate2','$antihypertensivename3','$antihypertensiveposology3','$antihypertensivestartingdate3','$hypolipidemicname1','$hypolipidemicposology1','$hypolipidemicstartingDate1','$hypolipidemicname2','$hypolipidemicposology2','$hypolipidemicstartingdate2','$hypolipidemicname3','$hypolipidemicposology3','$hypolipidemicstartingdate3','$antidiabetisname1','$antidiabetisposology1','$antidiabetisstartingdate1','$antidiabetisname2','$antidiabetisposology2','$antidiabetisstartingdate2','$antidiabetisname3','$antidiabetisposology3','$antidiabetisstartingDate3','$antithromboticname1','$antithromboticposology1','$antithromboticstartingdate1','$antithromboticname2','$antithromboticposology2','$antithromboticstartingdate2','$antithromboticname3','$antithromboticposology3','$antithromboticstartingdate3','$autrename1','$autreposology1','$autrestartingdate1','$autrename2','$autreposology2','$autrestartingdate2','$autrename3','$autreposology3','$autrestartingdate3','$notespatient')";
  821. }
  822. else
  823. {
  824. $query="INSERT INTO $trendezvous (IDPatient, Date, Visite, HighBloodPressure, Hypercholesterolemia, Diabetes, Hypertriglyceridemia, Smoking, CoronaryHeartDisease, IschemicStroke,Arrhytmia, NbHighBloodPressure,NbHypercholesterolemia, NbDiabetes,NbHypertriglyceridemia,NbCigarettesDay,NbYearSmoking,TypeCoronaryHearDisease,NbIschemicStroke,TypeIschelicStroke, EtiologyIschemicStroke,BloodPressureRightArm,BloodPressureLeftArm,HeartRate,AntiHypertensive,Hypolipidemic,Antidiabetis,AntiThrombotic,AntiHypertensiveName1,AntiHypertensivePosology1,AntiHypertensiveStartingDate1,AntiHypertensiveName2,AntiHypertensivePosology2,AntiHypertensiveStartingDate2,AntiHypertensiveName3,AntiHypertensivePosology3,AntiHypertensiveStartingDate3,HypolipidemicName1,HypolipidemicPosology1,HypolipidemicStartingDate1,HypolipidemicName2,HypolipidemicPosology2,HypolipidemicStartingDate2,HypolipidemicName3,HypolipidemicPosology3,HypolipidemicStartingDate3,AntidiabetisName1,AntidiabetisPosology1,AntidiabetisStartingDate1,AntidiabetisName2,AntidiabetisPosology2,AntidiabetisStartingDate2,AntidiabetisName3,AntidiabetisPosology3,AntidiabetisStartingDate3,AntiThromboticName1,AntiThromboticPosology1,AntiThromboticStartingDate1,AntiThromboticName2,AntiThromboticPosology2,AntiThromboticStartingDate2,AntiThromboticName3,AntiThromboticPosology3,AntithromboticStartingDate3) VALUES ($id, '$datedevisite', $visitnumber, '$highbloodpressure','$hypercholesterolemia','$diabetes','$hypertriglyceridemia','$smoking', '$coronaryheartdisease', '$ischemicstroke','$arrhytmia', '$nbhighbloodpressure','$nbhypercholesterolemia','$nbdiabetes', '$nbhypertriglyceridemia','$nbcigarettesday','$nbyearsmoking','$typecoronaryheartdisease','$nbischemicstroke','$typeischemicstroke', '$etiologyischemicstroke', '$bloodpressurerightarm','$bloodpressureleftarm','$heartrate','$antihypertensive','$hypolipidemic','$antidiabetis','$antithrombotic','$antihypertensivename1','$antihypertensiveposology1','$antihypertensivestartingdate1','$antihypertensivenName2','$antihypertensiveposology2','$antihypertensivestartingdate2','$antihypertensivename3','$antihypertensiveposology3','$antihypertensivestartingdate3','$hypolipidemicname1','$hypolipidemicposology1','$hypolipidemicstartingDate1','$hypolipidemicname2','$hypolipidemicposology2','$hypolipidemicstartingdate2','$hypolipidemicname3','$hypolipidemicposology3','$hypolipidemicstartingdate3','$antidiabetisname1','$antidiabetisposology1','$antidiabetisstartingdate1','$antidiabetisname2','$antidiabetisposology2','$antidiabetisstartingdate2','$antidiabetisname3','$antidiabetisposology3','$antidiabetisstartingDate3','$antithromboticname1','$antithromboticposology1','$antithromboticstartingdate1','$antithromboticname2','$antithromboticposology2','$antithromboticstartingdate2','$antithromboticname3','$antithromboticposology3','$antithromboticstartingdate3')";
  825. }
  826. $result=mysql_query($query);
  827. $idvisite = mysql_insert_id();
  828. // Pour détecter la création d'une visite
  829. $idvisite = $idvisite * -1;
  830. }
  831. }
  832. return $idvisite;
  833. }
  834. function testStudyCreated2($physician, $database, $serveurbase, $loginbase, $passwordbase, $prenompatient_c, $nompatient_c, $sexe, $datedenaissance_c, $ivrs, $taille, $unitetaille, $poids, $unitepoids, $race, $paysdenaissance, $paysactuel, $nbanneespaysactuel, $visitnumber, $datedevisite, $highbloodpressure,$hypercholesterolemia,$diabetes,$hypertriglyceridemia,$smoking,$coronaryheartdisease,$ischemicstroke,$arrhytmia,$nbhighbloodpressure,$nbhypercholesterolemia,$nbdiabetes,$nbhypertriglyceridemia,$nbcigarettesday,$nbyearsmoking,$typecoronaryheartdisease,$nbischemicstroke,$typeischemicstroke,$etiologyischemicstroke,$bloodpressurerightarm,$bloodpressureleftarm,$heartrate,$antihypertensive,$hypolipidemic,$antidiabetis,$antithrombotic,$autre,$antihypertensivename1,$antihypertensiveposology1,$antihypertensivestartingdate1,$antihypertensivenName2,$antihypertensiveposology2,$antihypertensivestartingdate2,$antihypertensivename3,$antihypertensiveposology3,$antihypertensivestartingdate3,$hypolipidemicname1,$hypolipidemicposology1,$hypolipidemicstartingDate1,$hypolipidemicname2,$hypolipidemicposology2,$hypolipidemicstartingdate2,$hypolipidemicname3,$hypolipidemicposology3,$hypolipidemicstartingdate3,$antidiabetisname1,$antidiabetisposology1,$antidiabetisstartingdate1,$antidiabetisname2,$antidiabetisposology2,$antidiabetisstartingdate2,$antidiabetisname3,$antidiabetisposology3,$antidiabetisstartingDate3,$antithromboticname1,$antithromboticposology1,$antithromboticstartingdate1,$antithromboticname2,$antithromboticposology2,$antithromboticstartingdate2,$antithromboticname3,$antithromboticposology3,$antithromboticstartingdate3, $autrename1,$autreposology1,$autrestartingdate1,$autrename2,$autreposology2,$autrestartingdate2,$autrename3,$autreposology3,$autrestartingdate3, $notespatient, $idutilisateur, $key, $commercial)
  835. {
  836. $rest = array();
  837. $id = 0;
  838. $idvisite = 0;
  839. $tpatients = 'patients'.$idutilisateur;
  840. $trendezvous = 'rendezvous'.$idutilisateur;
  841. /* $crypt = new encryption_class;
  842. if ($commercial == '1')
  843. {
  844. $nompatient = $crypt->encrypt($key, $nompatient_c);
  845. $prenompatient = $crypt->encrypt($key, $prenompatient_c);
  846. $datedenaissance = $crypt->encrypt($key, $datedenaissance_c);
  847. }
  848. else
  849. {
  850. */
  851. $nompatient = $nompatient_c;
  852. $prenompatient = $prenompatient_c;
  853. $datedenaissance = $datedenaissance_c;
  854. // }
  855. $link = mysql_connect($serveurbase, $loginbase, $passwordbase) or die ("Impossible de se connecter : " . mysql_error());
  856. mysql_select_db($database, $link);
  857. mysql_query("SET NAMES 'utf8'");
  858. // Récupère l'ID patient
  859. // ivrs est un text
  860. $query = "SELECT ID FROM $tpatients WHERE (Nom = '$nompatient' AND Prenom = '$prenompatient' AND Sexe = '$sexe' AND IVRS = '$ivrs') LIMIT 0,30000";
  861. $result = mysql_query($query);
  862. $result2 = mysql_num_rows($result);
  863. if ($result2 > 0)
  864. {
  865. while($data = mysql_fetch_assoc($result))
  866. {
  867. $id = $data['ID'];
  868. }
  869. }
  870. else
  871. {
  872. // Ecriture du patient
  873. $query = "INSERT INTO $tpatients (Nom, Prenom, Sexe, DateDeNaissance, IVRS, IDUtilisateur, Taille, UniteTaille, Poids, UnitePoids, Race, PaysNaissance, PaysActuel, NBAnneesPaysActuel) VALUES ('$nompatient', '$prenompatient', '$sexe', '$datedenaissance', '$ivrs', $idutilisateur, '$taille', '$unitetaille', '$poids', '$unitepoids', '$race', '$paysdenaissance', '$paysactuel', '$nbanneespaysactuel')";
  874. $result = mysql_query($query);
  875. $id = mysql_insert_id();
  876. }
  877. if ($id > 0)
  878. {
  879. // Récupère l'ID visite
  880. $query="SELECT ID FROM $trendezvous WHERE (IDPatient = $id AND Visite = $visitnumber) LIMIT 0,30000";
  881. $result=mysql_query($query);
  882. $result2 = mysql_num_rows($result);
  883. // if ($result2 == 0) // La visite n'existe pas déja
  884. // {
  885. // Ecriture du rendez vous
  886. $query="INSERT INTO $trendezvous (IDPatient, Date, Visite, HighBloodPressure, Hypercholesterolemia, Diabetes, Hypertriglyceridemia, Smoking, CoronaryHeartDisease, IschemicStroke,Arrhytmia, NbHighBloodPressure,NbHypercholesterolemia, NbDiabetes,NbHypertriglyceridemia,NbCigarettesDay,NbYearSmoking,TypeCoronaryHearDisease,NbIschemicStroke,TypeIschelicStroke, EtiologyIschemicStroke,BloodPressureRightArm,BloodPressureLeftArm,HeartRate,AntiHypertensive,Hypolipidemic,Antidiabetis,AntiThrombotic,AntiHypertensiveName1,AntiHypertensivePosology1,AntiHypertensiveStartingDate1,AntiHypertensiveName2,AntiHypertensivePosology2,AntiHypertensiveStartingDate2,AntiHypertensiveName3,AntiHypertensivePosology3,AntiHypertensiveStartingDate3,HypolipidemicName1,HypolipidemicPosology1,HypolipidemicStartingDate1,HypolipidemicName2,HypolipidemicPosology2,HypolipidemicStartingDate2,HypolipidemicName3,HypolipidemicPosology3,HypolipidemicStartingDate3,AntidiabetisName1,AntidiabetisPosology1,AntidiabetisStartingDate1,AntidiabetisName2,AntidiabetisPosology2,AntidiabetisStartingDate2,AntidiabetisName3,AntidiabetisPosology3,AntidiabetisStartingDate3,AntiThromboticName1,AntiThromboticPosology1,AntiThromboticStartingDate1,AntiThromboticName2,AntiThromboticPosology2,AntiThromboticStartingDate2,AntiThromboticName3,AntiThromboticPosology3,AntithromboticStartingDate3) VALUES ($id, '$datedevisite', $visitnumber, '$highbloodpressure','$hypercholesterolemia','$diabetes','$hypertriglyceridemia','$smoking', '$coronaryheartdisease', '$ischemicstroke','$arrhytmia', '$nbhighbloodpressure','$nbhypercholesterolemia','$nbdiabetes', '$nbhypertriglyceridemia','$nbcigarettesday','$nbyearsmoking','$typecoronaryheartdisease','$nbischemicstroke','$typeischemicstroke', '$etiologyischemicstroke', '$bloodpressurerightarm','$bloodpressureleftarm','$heartrate','$antihypertensive','$hypolipidemic','$antidiabetis','$antithrombotic','$antihypertensivename1','$antihypertensiveposology1','$antihypertensivestartingdate1','$antihypertensivenName2','$antihypertensiveposology2','$antihypertensivestartingdate2','$antihypertensivename3','$antihypertensiveposology3','$antihypertensivestartingdate3','$hypolipidemicname1','$hypolipidemicposology1','$hypolipidemicstartingDate1','$hypolipidemicname2','$hypolipidemicposology2','$hypolipidemicstartingdate2','$hypolipidemicname3','$hypolipidemicposology3','$hypolipidemicstartingdate3','$antidiabetisname1','$antidiabetisposology1','$antidiabetisstartingdate1','$antidiabetisname2','$antidiabetisposology2','$antidiabetisstartingdate2','$antidiabetisname3','$antidiabetisposology3','$antidiabetisstartingDate3','$antithromboticname1','$antithromboticposology1','$antithromboticstartingdate1','$antithromboticname2','$antithromboticposology2','$antithromboticstartingdate2','$antithromboticname3','$antithromboticposology3','$antithromboticstartingdate3')";
  887. $result=mysql_query($query);
  888. $idvisite = mysql_insert_id();
  889. // Pour détecter la création d'une visite
  890. $idvisite = $idvisite * -1;
  891. // }
  892. }
  893. return $idvisite;
  894. }
  895. // Test si une mesure existe pour la même situation et le même type de mesure
  896. function testMeasureCreated($database, $serveurbase, $loginbase, $passwordbase, $idrendezvous, $typemesure, $situation, $side, $idutilisateur)
  897. {
  898. $mesures = 'mesures'.$idutilisateur;
  899. $link = mysql_connect($serveurbase, $loginbase, $passwordbase) or die ("Impossible de se connecter : " . mysql_error());
  900. mysql_select_db($database, $link);
  901. mysql_query("SET NAMES 'utf8'");
  902. // Récupère l'ID patient
  903. $query = "SELECT ID FROM $mesures WHERE (IDRendezVous = $idrendezvous AND TypeMesure = $typemesure AND Situation = '$situation' AND Side = '$side') LIMIT 0,30000";
  904. $result = mysql_query($query);
  905. $result2 = mysql_num_rows($result);
  906. return $result2;
  907. }
  908. function deleteMeasure($database, $serveurbase, $loginbase, $passwordbase, $idrendezvous, $typemesure, $situation, $side, $idutilisateur)
  909. {
  910. $mesures = 'mesures'.$idutilisateur;
  911. $link = mysql_connect($serveurbase, $loginbase, $passwordbase) or die ("Impossible de se connecter : " . mysql_error());
  912. mysql_select_db($database, $link);
  913. mysql_query("SET NAMES 'utf8'");
  914. // Récupère l'ID patient
  915. $query = "DELETE FROM $mesures WHERE (IDRendezVous = $idrendezvous AND TypeMesure = $typemesure AND Situation = '$situation' AND Side = '$side')";
  916. $result = mysql_query($query);
  917. $result2 = mysql_num_rows($result);
  918. return $result2;
  919. }
  920. // Mise à jour ou insertion d'une nouvelle mesure
  921. function insertMeasure($database, $serveurbase, $loginbase, $passwordbase, $idrendezvous, $typemesure, $situation, $side, $echelle, $nomechelle, $longueurechelle, $x1echelle, $y1echelle, $x2echelle, $y2echelle, $etendue, $min, $moy, $max, $iq_densite, $standartdeviation, $numberofpoints, $x1, $y1, $x2, $y2, $numberofplaques, $numberofstenosis, $stenosisangle, $numberofocclusions, $idutilisateur)
  922. {
  923. $idmesure = 0;
  924. $mesures = 'mesures'.$idutilisateur;
  925. $link = mysql_connect($serveurbase, $loginbase, $passwordbase) or die ("Impossible de se connecter : " . mysql_error());
  926. mysql_select_db($database, $link);
  927. mysql_query("SET NAMES 'utf8'");
  928. // Test si la mesure existe déja
  929. // Pour SELECT Sur des int, ne pas mettre les ' '
  930. $query = "SELECT ID FROM $mesures WHERE (IDRendezVous = $idrendezvous AND TypeMesure = $typemesure AND Situation = '$situation' AND Side = '$side') LIMIT 0,30000";
  931. $result = mysql_query($query);
  932. $result2 = mysql_num_rows($result);
  933. if ($result2 == 1)
  934. {
  935. while($data = mysql_fetch_assoc($result))
  936. {
  937. $idmesure = $data['ID'];
  938. }
  939. }
  940. if ($idmesure > 0) // Si la ligne existe déja on la modifie
  941. {
  942. $query = "UPDATE $mesures SET IDRendezVous='$idrendezvous', TypeMesure='$typemesure', Situation='$situation', Side='$side', Echelle='$echelle', NomEchelle='$nomechelle', LongueurEchelle = '$longueurechelle', x1Echelle = '$x1echelle', y1Echelle = '$y1echelle', x2Echelle = '$x2echelle', y2Echelle = '$y2echelle', Etendue='$etendue', Min='$min', Moy='$moy', Max='$max', IQ_Densite='$iq_densite', StandartDeviation='$standartdeviation', NumberOfPoints='$numberofpoints', x1='$x1', y1='$y1', x2='$x2', y2='$y2', NumberOfplaques='$numberofplaques', NumberOfStenosis='$numberofstenosis', StenosisAngle='$stenosisangle', NumberOfOcclusions='$numberofocclusions' WHERE ID=$idmesure";
  943. $result = mysql_query($query);
  944. }
  945. else // Sinon on l'insert
  946. {
  947. $query = "INSERT INTO $mesures (IDRendezVous, TypeMesure, Situation, Side, Echelle, NomEchelle, LongueurEchelle, x1Echelle, y1Echelle, x2Echelle, y2Echelle, Etendue, Min, Moy, Max, IQ_Densite, StandartDeviation, NumberOfPoints, x1, y1, x2, y2, NumberOfplaques, NumberOfStenosis, StenosisAngle, NumberOfOcclusions) VALUES ('$idrendezvous', '$typemesure', '$situation', '$side', '$echelle', '$nomechelle', '$longueurechelle', '$x1echelle', '$y1echelle', '$x2echelle', '$y2echelle', '$etendue', '$min', '$moy', '$max', '$iq_densite', '$standartdeviation', '$numberofpoints', '$x1', '$y1', '$x2', '$y2', '$numberofplaques', '$numberofstenosis', '$stenosisangle', '$numberofocclusions')";
  948. $result = mysql_query($query);
  949. $idmesure = mysql_insert_id();
  950. }
  951. return $idmesure;
  952. }
  953. // Supprime les graphiques pour un rendez vous donné
  954. function cleanGraphiques($database, $serveurbase, $loginbase, $passwordbase, $idrendezvous, $idutilisateur)
  955. {
  956. $link = mysql_connect($serveurbase, $loginbase, $passwordbase) or die ("Impossible de se connecter : " . mysql_error());
  957. mysql_select_db($database, $link);
  958. mysql_query("SET NAMES 'utf8'");
  959. $tgraphiques = 'graphiques'.$idutilisateur;
  960. $query = "DELETE FROM $tgraphiques WHERE (IDRendezVous = $idrendezvous)";
  961. $result = mysql_query($query);
  962. return true;
  963. }
  964. // Insertion d'un nouveau graphique
  965. function insertGraphique($database, $serveurbase, $loginbase, $passwordbase, $idrendezvous, $typegraphique, $situation, $side, $x, $y, $idutilisateur)
  966. {
  967. $link = mysql_connect($serveurbase, $loginbase, $passwordbase) or die ("Impossible de se connecter : " . mysql_error());
  968. mysql_select_db($database, $link);
  969. mysql_query("SET NAMES 'utf8'");
  970. $tgraphiques = 'graphiques'.$idutilisateur;
  971. $query = "INSERT INTO $tgraphiques (IDRendezVous, TypeGraphique, Situation, Side, x, y) VALUES ('$idrendezvous', '$typegraphique', '$situation', '$side', '$x', '$y')";
  972. $result = mysql_query($query);
  973. $idgraphique = mysql_insert_id();
  974. return $idgraphique;
  975. }
  976. // Création des Tables Pour un utilisateur donné
  977. // Pour les instructions de création, exporter la base, puis copier/coller
  978. function createTables($database, $serveurbase, $loginbase, $passwordbase, $idutiliseur)
  979. {
  980. $link = mysql_connect($serveurbase, $loginbase, $passwordbase) or die ("Impossible de se connecter : " . mysql_error());
  981. mysql_select_db($database, $link);
  982. mysql_query("SET NAMES 'utf8'");
  983. // Création de la table Patients
  984. $tpatients = 'patients'.$idutiliseur;
  985. $query="CREATE TABLE IF NOT EXISTS $tpatients (
  986. `ID` int(11) NOT NULL AUTO_INCREMENT,
  987. `IDUtilisateur` int(11) NOT NULL,
  988. `IVRS` varchar(30) character set utf8 collate utf8_unicode_ci NOT NULL,
  989. `Nom` varchar(30) character set utf8 collate utf8_unicode_ci NOT NULL,
  990. `Prenom` varchar(30) character set utf8 collate utf8_unicode_ci NOT NULL,
  991. `Sexe` varchar(10) character set utf8 collate utf8_unicode_ci NOT NULL,
  992. `DateDeNaissance` varchar(30) character set utf8 collate utf8_unicode_ci NOT NULL,
  993. `Taille` int(11) NOT NULL,
  994. `UniteTaille` varchar(10) character set utf8 collate utf8_unicode_ci NOT NULL,
  995. `Poids` int(11) NOT NULL,
  996. `UnitePoids` varchar(10) character set utf8 collate utf8_unicode_ci NOT NULL,
  997. `Race` varchar(30) character set utf8 collate utf8_unicode_ci NOT NULL,
  998. `PaysNaissance` varchar(30) character set utf8 collate utf8_unicode_ci NOT NULL,
  999. `PaysActuel` varchar(30) character set utf8 collate utf8_unicode_ci NOT NULL,
  1000. `NBAnneesPaysActuel` int(11) NOT NULL,
  1001. PRIMARY KEY (`ID`)
  1002. ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE = utf8_unicode_ci AUTO_INCREMENT=355 ;";
  1003. $result = mysql_query($query);
  1004. // Création de la table Mesures
  1005. $tmesures = 'mesures'.$idutiliseur;
  1006. $query = "CREATE TABLE IF NOT EXISTS $tmesures (
  1007. `ID` int(11) NOT NULL AUTO_INCREMENT,
  1008. `IDRendezVous` int(11) NOT NULL,
  1009. `TypeMesure` int(11) NOT NULL,
  1010. `Situation` varchar(30) character set utf8 collate utf8_unicode_ci NOT NULL,
  1011. `Side` varchar(30) character set utf8 collate utf8_unicode_ci NOT NULL,
  1012. `Echelle` double NOT NULL,
  1013. `NomEchelle` varchar(30) character set utf8 collate utf8_unicode_ci NOT NULL,
  1014. `LongueurEchelle` int(11) NOT NULL,
  1015. `x1Echelle` int(11) NOT NULL,
  1016. `y1Echelle` int(11) NOT NULL,
  1017. `x2Echelle` int(11) NOT NULL,
  1018. `y2Echelle` int(11) NOT NULL,
  1019. `Etendue` double NOT NULL,
  1020. `Min` double NOT NULL,
  1021. `Moy` double NOT NULL,
  1022. `Max` double NOT NULL,
  1023. `IQ_Densite` double NOT NULL,
  1024. `StandartDeviation` double NOT NULL,
  1025. `NumberOfPoints` int(11) NOT NULL,
  1026. `x1` int(11) NOT NULL,
  1027. `y1` int(11) NOT NULL,
  1028. `x2` int(11) NOT NULL,
  1029. `y2` int(11) NOT NULL,
  1030. `NumberOfPlaques` int(11) NOT NULL,
  1031. `NumberOfStenosis` int(11) NOT NULL,
  1032. `StenosisAngle` int(11) NOT NULL,
  1033. `NumberOfOcclusions` int(11) NOT NULL,
  1034. PRIMARY KEY (`ID`)
  1035. ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE = utf8_unicode_ci AUTO_INCREMENT=291 ;";
  1036. $result = mysql_query($query);
  1037. // Création de la table Patients
  1038. $rendezvous = 'rendezvous'.$idutiliseur;
  1039. $query="CREATE TABLE IF NOT EXISTS $rendezvous (
  1040. `ID` int(11) NOT NULL AUTO_INCREMENT,
  1041. `IDPatient` int(11) NOT NULL,
  1042. `Visite` int(11) NOT NULL,
  1043. `Mesures` int(11) NOT NULL,
  1044. `Images` int(11) NOT NULL,
  1045. `Sequences` int(11) NOT NULL,
  1046. `Date` varchar(30) character set utf8 collate utf8_unicode_ci NOT NULL,
  1047. `HighBloodPressure` varchar(10) character set utf8 collate utf8_unicode_ci NOT NULL,
  1048. `NbHighBloodPressure` int(11) NOT NULL,
  1049. `Hypercholesterolemia` varchar(10) character set utf8 collate utf8_unicode_ci NOT NULL,
  1050. `NbHypercholesterolemia` int(11) NOT NULL,
  1051. `Diabetes` varchar(10) character set utf8 collate utf8_unicode_ci NOT NULL,
  1052. `NbDiabetes` int(11) NOT NULL,
  1053. `Hypertriglyceridemia` varchar(10) character set utf8 collate utf8_unicode_ci NOT NULL,
  1054. `NbHypertriglyceridemia` int(11) NOT NULL,
  1055. `Smoking` varchar(10) character set utf8 collate utf8_unicode_ci NOT NULL,
  1056. `NbCigarettesDay` int(11) NOT NULL,
  1057. `NbYearSmoking` int(11) NOT NULL,
  1058. `CoronaryHeartDisease` varchar(10) character set utf8 collate utf8_unicode_ci NOT NULL,
  1059. `TypeCoronaryHearDisease` varchar(30) character set utf8 collate utf8_unicode_ci NOT NULL,
  1060. `IschemicStroke` varchar(10) character set utf8 collate utf8_unicode_ci NOT NULL,
  1061. `NbIschemicStroke` int(11) NOT NULL,
  1062. `TypeIschelicStroke` varchar(30) character set utf8 collate utf8_unicode_ci NOT NULL,
  1063. `EtiologyIschemicStroke` varchar(30) character set utf8 collate utf8_unicode_ci NOT NULL,
  1064. `BloodPressureRightArm` int(11) NOT NULL,
  1065. `BloodPressureLeftArm` int(11) NOT NULL,
  1066. `HeartRate` int(11) NOT NULL,
  1067. `Arrhytmia` varchar(10) character set utf8 collate utf8_unicode_ci NOT NULL,
  1068. `AntiHypertensive` varchar(10) character set utf8 collate utf8_unicode_ci NOT NULL,
  1069. `AntiHypertensiveName1` varchar(30) character set utf8 collate utf8_unicode_ci NOT NULL,
  1070. `AntiHypertensivePosology1` varchar(30) character set utf8 collate utf8_unicode_ci NOT NULL,
  1071. `AntiHypertensiveStartingDate1` varchar(30) character set utf8 collate utf8_unicode_ci NOT NULL,
  1072. `AntiHypertensiveName2` varchar(30) character set utf8 collate utf8_unicode_ci NOT NULL,
  1073. `AntiHypertensivePosology2` varchar(30) character set utf8 collate utf8_unicode_ci NOT NULL,
  1074. `AntiHypertensiveStartingDate2` varchar(30) character set utf8 collate utf8_unicode_ci NOT NULL,
  1075. `AntiHypertensiveName3` varchar(30) character set utf8 collate utf8_unicode_ci NOT NULL,
  1076. `AntiHypertensivePosology3` varchar(30) character set utf8 collate utf8_unicode_ci NOT NULL,
  1077. `AntiHypertensiveStartingDate3` varchar(30) character set utf8 collate utf8_unicode_ci NOT NULL,
  1078. `Hypolipidemic` varchar(10) character set utf8 collate utf8_unicode_ci NOT NULL,
  1079. `HypolipidemicName1` varchar(30) character set utf8 collate utf8_unicode_ci NOT NULL,
  1080. `HypolipidemicPosology1` varchar(30) character set utf8 collate utf8_unicode_ci NOT NULL,
  1081. `HypolipidemicStartingDate1` varchar(30) character set utf8 collate utf8_unicode_ci NOT NULL,
  1082. `HypolipidemicName2` varchar(30) character set utf8 collate utf8_unicode_ci NOT NULL,
  1083. `HypolipidemicPosology2` varchar(30) character set utf8 collate utf8_unicode_ci NOT NULL,
  1084. `HypolipidemicStartingDate2` varchar(30) character set utf8 collate utf8_unicode_ci NOT NULL,
  1085. `HypolipidemicName3` varchar(30) character set utf8 collate utf8_unicode_ci NOT NULL,
  1086. `HypolipidemicPosology3` varchar(30) character set utf8 collate utf8_unicode_ci NOT NULL,
  1087. `HypolipidemicStartingDate3` varchar(30) character set utf8 collate utf8_unicode_ci NOT NULL,
  1088. `Antidiabetis` varchar(10) character set utf8 collate utf8_unicode_ci NOT NULL,
  1089. `AntidiabetisName1` varchar(30) character set utf8 collate utf8_unicode_ci NOT NULL,
  1090. `AntidiabetisPosology1` varchar(30) character set utf8 collate utf8_unicode_ci NOT NULL,
  1091. `AntidiabetisStartingDate1` varchar(30) character set utf8 collate utf8_unicode_ci NOT NULL,
  1092. `AntidiabetisName2` varchar(30) character set utf8 collate utf8_unicode_ci NOT NULL,
  1093. `AntidiabetisPosology2` varchar(30) character set utf8 collate utf8_unicode_ci NOT NULL,
  1094. `AntidiabetisStartingDate2` varchar(30) character set utf8 collate utf8_unicode_ci NOT NULL,
  1095. `AntidiabetisName3` varchar(30) character set utf8 collate utf8_unicode_ci NOT NULL,
  1096. `AntidiabetisPosology3` varchar(30) character set utf8 collate utf8_unicode_ci NOT NULL,
  1097. `AntidiabetisStartingDate3` varchar(30) character set utf8 collate utf8_unicode_ci NOT NULL,
  1098. `AntiThrombotic` varchar(10) character set utf8 collate utf8_unicode_ci NOT NULL,
  1099. `AntiThromboticName1` varchar(30) character set utf8 collate utf8_unicode_ci NOT NULL,
  1100. `AntiThromboticPosology1` varchar(30) character set utf8 collate utf8_unicode_ci NOT NULL,
  1101. `AntiThromboticStartingDate1` varchar(30) character set utf8 collate utf8_unicode_ci NOT NULL,
  1102. `AntiThromboticName2` varchar(30) character set utf8 collate utf8_unicode_ci NOT NULL,
  1103. `AntiThromboticPosology2` varchar(30) character set utf8 collate utf8_unicode_ci NOT NULL,
  1104. `AntiThromboticStartingDate2` varchar(30) character set utf8 collate utf8_unicode_ci NOT NULL,
  1105. `AntiThromboticName3` varchar(30) character set utf8 collate utf8_unicode_ci NOT NULL,
  1106. `AntiThromboticPosology3` varchar(30) character set utf8 collate utf8_unicode_ci NOT NULL,
  1107. `AntithromboticStartingDate3` varchar(30) character set utf8 collate utf8_unicode_ci NOT NULL,
  1108. `Autre` varchar(10) character set utf8 collate utf8_unicode_ci NOT NULL,
  1109. `AutreName1` varchar(30) character set utf8 collate utf8_unicode_ci NOT NULL,
  1110. `AutrePosology1` varchar(30) character set utf8 collate utf8_unicode_ci NOT NULL,
  1111. `AutreStartingDate1` varchar(30) character set utf8 collate utf8_unicode_ci NOT NULL,
  1112. `AutreName2` varchar(30) character set utf8 collate utf8_unicode_ci NOT NULL,
  1113. `AutrePosology2` varchar(30) character set utf8 collate utf8_unicode_ci NOT NULL,
  1114. `AutreStartingDate2` varchar(30) character set utf8 collate utf8_unicode_ci NOT NULL,
  1115. `AutreName3` varchar(30) character set utf8 collate utf8_unicode_ci NOT NULL,
  1116. `AutrePosology3` varchar(30) character set utf8 collate utf8_unicode_ci NOT NULL,
  1117. `AutreStartingDate3` varchar(30) character set utf8 collate utf8_unicode_ci NOT NULL,
  1118. `NotesPatient` varchar(1024) character set utf8 collate utf8_unicode_ci NOT NULL,
  1119. PRIMARY KEY (`ID`)
  1120. )ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE = utf8_unicode_ci AUTO_INCREMENT=437 ;";
  1121. $result = mysql_query($query);
  1122. // Création de la table Graphiques
  1123. $tgraphiques = 'graphiques'.$idutiliseur;
  1124. $query="CREATE TABLE IF NOT EXISTS $tgraphiques (
  1125. `ID` int(11) NOT NULL AUTO_INCREMENT,
  1126. `IDRendezVous` int(11) NOT NULL,
  1127. `TypeGraphique` int(11) NOT NULL,
  1128. `Situation` varchar(30) character set utf8 collate utf8_unicode_ci NOT NULL,
  1129. `Side` varchar(30) character set utf8 collate utf8_unicode_ci NOT NULL,
  1130. `x` int(11) NOT NULL,
  1131. `y` int(11) NOT NULL,
  1132. PRIMARY KEY (`ID`)
  1133. ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE = utf8_unicode_ci AUTO_INCREMENT=1 ;";
  1134. $result = mysql_query($query);
  1135. // Création de la table Crédits
  1136. $tcredits = 'credits'.$idutiliseur;
  1137. $query="CREATE TABLE IF NOT EXISTS $tcredits (
  1138. `ID` int(11) NOT NULL AUTO_INCREMENT,
  1139. `Date` varchar(30) collate utf8_unicode_ci NOT NULL,
  1140. `AdresseIP` varchar(30) collate utf8_unicode_ci NOT NULL,
  1141. `TypeCredit` varchar(30) collate utf8_unicode_ci NOT NULL,
  1142. `IDPatient` int(11) NOT NULL,
  1143. `IDRendezVous` int(11) NOT NULL,
  1144. `IDMesure` int(11) NOT NULL,
  1145. PRIMARY KEY (`ID`)
  1146. ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE = utf8_unicode_ci AUTO_INCREMENT=1 ;";
  1147. $result = mysql_query($query);
  1148. }
  1149. // Recherche de tous les patients pour un utilisateur donné
  1150. function searchPatients($database, $serveurbase, $loginbase, $passwordbase, $idutilisateur, $key, $commercial)
  1151. {
  1152. $rest = array();
  1153. // $crypt = new encryption_class;
  1154. $link = mysql_connect($serveurbase, $loginbase, $passwordbase) or die ("Impossible de se connecter : " . mysql_error());
  1155. mysql_select_db($database, $link);
  1156. mysql_query("SET NAMES 'utf8'");
  1157. $tpatients = 'patients'.$idutilisateur;
  1158. $trendezvous = 'rendezvous'.$idutilisateur;
  1159. $query = "SELECT ID, IVRS, Nom, Prenom, Sexe, DateDeNaissance, (SELECT Date FROM $trendezvous WHERE ($trendezvous.IDPatient = $tpatients.ID) ORDER BY Visite DESC LIMIT 1) as myDate FROM $tpatients WHERE (IDUtilisateur = '$idutilisateur') ORDER BY Nom LIMIT 0,30000";
  1160. $result = mysql_query($query);
  1161. $result2 = mysql_num_rows($result);
  1162. if ($result2 >= 1)
  1163. {
  1164. while($data = mysql_fetch_assoc($result))
  1165. {
  1166. $id = $data['ID'];
  1167. $ivrs = $data['IVRS'];
  1168. $nom_c = $data['Nom'];
  1169. $prenom_c = $data['Prenom'];
  1170. $sexe = $data['Sexe'];
  1171. $datedenaissance_c = $data['DateDeNaissance'];
  1172. $dateLastVisite = $data['myDate'];
  1173. // $searchIndex = $data['Nom'].', '.$data['Prenom'];
  1174. $searchIndex = $data['Nom'].$data['Prenom'];
  1175. /* if ($commercial == '1')
  1176. {
  1177. $nom = $crypt->decrypt($key, $nom_c);
  1178. $prenom = $crypt->decrypt($key, $prenom_c);
  1179. $datedenaissance = $crypt->decrypt($key, $datedenaissance_c);
  1180. }
  1181. else
  1182. {
  1183. */
  1184. $nom = $nom_c;
  1185. $prenom = $prenom_c;
  1186. $datedenaissance = $datedenaissance_c;
  1187. // }
  1188. array_push($rest, array("ID"=>$id, "IVRS"=>$ivrs, "Nom"=>$nom, "Prenom"=>$prenom, "Sexe"=>$sexe, "DateDeNaissance"=>$datedenaissance, "DateLastVisite"=>$dateLastVisite, "SearchIndex"=>$searchIndex));
  1189. }
  1190. }
  1191. else
  1192. {
  1193. $id = 0;
  1194. $ivrs = '';
  1195. $nom = '';
  1196. $prenom = '';
  1197. $sexe = '';
  1198. $datedenaissance = '';
  1199. $dateLastVisite = '';
  1200. $searchIndex = '';
  1201. array_push($rest, array("ID"=>$id, "IVRS"=>$ivrs, "Nom"=>$nom, "Prenom"=>$prenom, "Sexe"=>$sexe, "DateDeNaissance"=>$datedenaissance, "DateLastVisite"=>$dateLastVisite, "SearchIndex"=>$searchIndex));
  1202. }
  1203. // on retourne le tableau
  1204. return $rest;
  1205. }
  1206. // Recherche de tous les visites d'un patient pour un utilisateur donné
  1207. function searchVisites($database, $serveurbase, $loginbase, $passwordbase, $idpatient, $idutiliseur)
  1208. {
  1209. $rest = array();
  1210. $link = mysql_connect($serveurbase, $loginbase, $passwordbase) or die ("Impossible de se connecter : " . mysql_error());
  1211. mysql_select_db($database, $link);
  1212. mysql_query("SET NAMES 'utf8'");
  1213. $rendezvous = 'rendezvous'.$idutiliseur;
  1214. $query = "SELECT ID, Visite, Date FROM $rendezvous WHERE (IDPatient = $idpatient) ORDER BY Visite DESC LIMIT 0,30000";
  1215. $result = mysql_query($query);
  1216. $result2 = mysql_num_rows($result);
  1217. if ($result2 >= 1)
  1218. {
  1219. while($data = mysql_fetch_assoc($result))
  1220. {
  1221. $id = $data['ID'];
  1222. $visite = $data['Visite'];
  1223. $date = $data['Date'];
  1224. array_push($rest, array("ID"=>$id, "Visite"=>$visite, "Date"=>$date));
  1225. }
  1226. }
  1227. else
  1228. {
  1229. $id = 0;
  1230. $visite = '';
  1231. $date = '';
  1232. array_push($rest, array("ID"=>$id, "Visite"=>$visite, "Date"=>$date));
  1233. }
  1234. // on retourne le tableau
  1235. return $rest;
  1236. }
  1237. // Récupère toutes les données pour un patient sélectionné
  1238. function getPatient($database, $serveurbase, $loginbase, $passwordbase, $idpatient, $idutiliseur, $key, $commercial)
  1239. {
  1240. $rest = array();
  1241. $link = mysql_connect($serveurbase, $loginbase, $passwordbase) or die ("Impossible de se connecter : " . mysql_error());
  1242. mysql_select_db($database, $link);
  1243. mysql_query("SET NAMES 'utf8'");
  1244. $patients = 'patients'.$idutiliseur;
  1245. $query = "SELECT IVRS, Nom, Prenom, Sexe, DateDeNaissance, Taille, UniteTaille, Poids, UnitePoids, Race, PaysNaissance, PaysActuel, NBAnneesPaysActuel FROM $patients WHERE (ID = $idpatient) LIMIT 0,30000";
  1246. $result = mysql_query($query);
  1247. $result2 = mysql_num_rows($result);
  1248. // $crypt = new encryption_class;
  1249. if ($result2 >= 1)
  1250. {
  1251. while($data = mysql_fetch_assoc($result))
  1252. {
  1253. $ivrs = $data['IVRS'];
  1254. $nom_c = $data['Nom'];
  1255. $prenom_c = $data['Prenom'];
  1256. $sexe = $data['Sexe'];
  1257. $datedenaissance_c = $data['DateDeNaissance'];
  1258. $taille = $data['Taille'];
  1259. $unitetaille = $data['UniteTaille'];
  1260. $poids = $data['Poids'];
  1261. $unitepoids = $data['UnitePoids'];
  1262. $race = $data['Race'];
  1263. $paysnaissance = $data['PaysNaissance'];
  1264. $paysactuel = $data['PaysActuel'];
  1265. $nbanneespaysactuel = $data['NBAnneesPaysActuel'];
  1266. /* if ($commercial == '1')
  1267. {
  1268. $nom = $crypt->decrypt($key, $nom_c);
  1269. $prenom = $crypt->decrypt($key, $prenom_c);
  1270. $datedenaissance = $crypt->decrypt($key, $datedenaissance_c);
  1271. }
  1272. else
  1273. {
  1274. */
  1275. $nom = $nom_c;
  1276. $prenom = $prenom_c;
  1277. $datedenaissance = $datedenaissance_c;
  1278. // }
  1279. array_push($rest, array("IVRS"=>$ivrs,
  1280. "Nom"=>$nom,
  1281. "Prenom"=>$prenom,
  1282. "Sexe"=>$sexe,
  1283. "DateDeNaissance"=>$datedenaissance,
  1284. "Taille"=>$taille,
  1285. "UniteTaille"=>$unitetaille,
  1286. "Poids"=>$poids,
  1287. "UnitePoids"=>$unitepoids,
  1288. "Race"=>$race,
  1289. "PaysNaissance"=>$paysnaissance,
  1290. "PaysActuel"=>$paysactuel,
  1291. "NBAnneesPaysActuel"=>$nbanneespaysactuel));
  1292. }
  1293. }
  1294. else
  1295. {
  1296. $ivrs = '';
  1297. $nom = '';
  1298. $prenom = '';
  1299. $sexe = '';
  1300. $datedenaissance = '';
  1301. $taille = '';
  1302. $unitetaille = '';
  1303. $poids = '';
  1304. $unitepoids = '';
  1305. $race = '';
  1306. $paysnaissance = '';
  1307. $paysactuel = '';
  1308. $nbanneespaysactuel = '';
  1309. array_push($rest, array("IVRS"=>$ivrs, "Nom"=>$nom, "Prenom"=>$prenom, "Sexe"=>$sexe, "DateDeNaissance"=>$datedenaissance, "Taille"=>$taille, "UniteTaille"=>$unitetaille, "Poids"=>$poids, "UnitePoids"=>$unitepoids, "Race"=>$race, "PaysNaissance"=>$paysnaissance, "PaysActuel"=>$paysactuel, "NBAnneesPaysActuel"=>$nbanneespaysactuel));
  1310. }
  1311. // on retourne le tableau
  1312. return $rest;
  1313. }
  1314. // Récupère toutes les données pour un rendez-vous sélectionné
  1315. function getRendezVous($database, $serveurbase, $loginbase, $passwordbase, $idrendezvous, $idutiliseur)
  1316. {
  1317. $rest = array();
  1318. $link = mysql_connect($serveurbase, $loginbase, $passwordbase) or die ("Impossible de se connecter : " . mysql_error());
  1319. mysql_select_db($database, $link);
  1320. mysql_query("SET NAMES 'utf8'");
  1321. $rendezvous = 'rendezvous'.$idutiliseur;
  1322. $query = "SELECT
  1323. IDPatient,
  1324. Visite,
  1325. Date,
  1326. HighBloodPressure,
  1327. NbHighBloodPressure,
  1328. Hypercholesterolemia,
  1329. NbHypercholesterolemia,
  1330. Diabetes,
  1331. NbDiabetes,
  1332. Hypertriglyceridemia,
  1333. NbHypertriglyceridemia,
  1334. Smoking,
  1335. NbCigarettesDay,
  1336. NbYearSmoking,
  1337. CoronaryHeartDisease,
  1338. TypeCoronaryHearDisease,
  1339. IschemicStroke,
  1340. NbIschemicStroke,
  1341. TypeIschelicStroke,
  1342. EtiologyIschemicStroke,
  1343. BloodPressureRightArm,
  1344. BloodPressureLeftArm,
  1345. HeartRate,
  1346. Arrhytmia,
  1347. AntiHypertensive,
  1348. AntiHypertensiveName1,
  1349. AntiHypertensivePosology1,
  1350. AntiHypertensiveStartingDate1,
  1351. AntiHypertensiveName2,
  1352. AntiHypertensivePosology2,
  1353. AntiHypertensiveStartingDate2,
  1354. AntiHypertensiveName3,
  1355. AntiHypertensivePosology3,
  1356. AntiHypertensiveStartingDate3,
  1357. Hypolipidemic,
  1358. HypolipidemicName1,
  1359. HypolipidemicPosology1,
  1360. HypolipidemicStartingDate1,
  1361. HypolipidemicName2,
  1362. HypolipidemicPosology2,
  1363. HypolipidemicStartingDate2,
  1364. HypolipidemicName3,
  1365. HypolipidemicPosology3,
  1366. HypolipidemicStartingDate3,
  1367. Antidiabetis,
  1368. AntidiabetisName1,
  1369. AntidiabetisPosology1,
  1370. AntidiabetisStartingDate1,
  1371. AntidiabetisName2,
  1372. AntidiabetisPosology2,
  1373. AntidiabetisStartingDate2,
  1374. AntidiabetisName3,
  1375. AntidiabetisPosology3,
  1376. AntidiabetisStartingDate3,
  1377. AntiThrombotic,
  1378. AntiThromboticName1,
  1379. AntiThromboticPosology1,
  1380. AntiThromboticStartingDate1,
  1381. AntiThromboticName2,
  1382. AntiThromboticPosology2,
  1383. AntiThromboticStartingDate2,
  1384. AntiThromboticName3,
  1385. AntiThromboticPosology3,
  1386. AntithromboticStartingDate3 FROM $rendezvous WHERE (ID = $idrendezvous) LIMIT 0,30000";
  1387. $result = mysql_query($query);
  1388. $result2 = mysql_num_rows($result);
  1389. if ($result2 >= 1)
  1390. {
  1391. while($data = mysql_fetch_assoc($result))
  1392. {
  1393. $idpatient = $data['IDPatient'];
  1394. $visite = $data['Visite'];
  1395. $date = $data['Date'];
  1396. $highbloodpressure = $data['HighBloodPressure'];
  1397. $nbhighbloodpressure = $data['NbHighBloodPressure'];
  1398. $hypercholesterolemia = $data['Hypercholesterolemia'];
  1399. $nbhypercholesterolemia = $data['NbHypercholesterolemia'];
  1400. $diabetes = $data['Diabetes'];
  1401. $nbdiabetes = $data['NbDiabetes'];
  1402. $hypertriglyceridemia = $data['Hypertriglyceridemia'];
  1403. $nbhypertriglyceridemia = $data['NbHypertriglyceridemia'];
  1404. $smoking = $data['Smoking'];
  1405. $nbcigarettesday = $data['NbCigarettesDay'];
  1406. $nbyearsmoking = $data['NbYearSmoking'];
  1407. $coronaryheartdisease = $data['CoronaryHeartDisease'];
  1408. $typecoronaryheardisease = $data['TypeCoronaryHearDisease'];
  1409. $ischemicstroke = $data['IschemicStroke'];
  1410. $nbischemicstroke = $data['NbIschemicStroke'];
  1411. $typeischelicstroke = $data['TypeIschelicStroke'];
  1412. $etiologyischemicstroke = $data['EtiologyIschemicStroke'];
  1413. $bloodpressurerightarm = $data['BloodPressureRightArm'];
  1414. $bloodpressureleftarm = $data['BloodPressureLeftArm'];
  1415. $heartrate = $data['HeartRate'];
  1416. $arrhytmia = $data['Arrhytmia'];
  1417. $antihypertensive = $data['AntiHypertensive'];
  1418. $antihypertensivename1 = $data['AntiHypertensiveName1'];
  1419. $antihypertensiveposology1 = $data['AntiHypertensivePosology1'];
  1420. $antihypertensivestartingdate1 = $data['AntiHypertensiveStartingDate1'];
  1421. $antihypertensivename2 = $data['AntiHypertensiveName2'];
  1422. $antihypertensiveposology2 = $data['AntiHypertensivePosology2'];
  1423. $antihypertensivestartingdate2 = $data['AntiHypertensiveStartingDate2'];
  1424. $antihypertensivename3 = $data['AntiHypertensiveName3'];
  1425. $antihypertensiveposology3 = $data['AntiHypertensivePosology3'];
  1426. $antihypertensivestartingdate3 = $data['AntiHypertensiveStartingDate3'];
  1427. $hypolipidemic = $data['Hypolipidemic'];
  1428. $hypolipidemicname1 = $data['HypolipidemicName1'];
  1429. $hypolipidemicposology1 = $data['HypolipidemicPosology1'];
  1430. $hypolipidemicstartingdate1 = $data['HypolipidemicStartingDate1'];
  1431. $hypolipidemicname2 = $data['HypolipidemicName2'];
  1432. $hypolipidemicposology2 = $data['HypolipidemicPosology2'];
  1433. $hypolipidemicstartingdate2 = $data['HypolipidemicStartingDate2'];
  1434. $hypolipidemicname3 = $data['HypolipidemicName3'];
  1435. $hypolipidemicposology3 = $data['HypolipidemicPosology3'];
  1436. $hypolipidemicstartingdate3 = $data['HypolipidemicStartingDate3'];
  1437. $antidiabetis = $data['Antidiabetis'];
  1438. $antidiabetisname1 = $data['AntidiabetisName1'];
  1439. $antidiabetisposology1 = $data['AntidiabetisPosology1'];
  1440. $antidiabetisstartingdate1 = $data['AntidiabetisStartingDate1'];
  1441. $antidiabetisname2 = $data['AntidiabetisName2'];
  1442. $antidiabetisposology2 = $data['AntidiabetisPosology2'];
  1443. $antidiabetisstartingdate2 = $data['AntidiabetisStartingDate2'];
  1444. $antidiabetisname3 = $data['AntidiabetisName3'];
  1445. $antidiabetisposology3 = $data['AntidiabetisPosology3'];
  1446. $antidiabetisstartingdate3 = $data['AntidiabetisStartingDate3'];
  1447. $antithrombotic = $data['AntiThrombotic'];
  1448. $antithromboticname1 = $data['AntiThromboticName1'];
  1449. $antithromboticposology1 = $data['AntiThromboticPosology1'];
  1450. $antithromboticstartingdate1 = $data['AntiThromboticStartingDate1'];
  1451. $antithromboticname2 = $data['AntiThromboticName2'];
  1452. $antithromboticposology2 = $data['AntiThromboticPosology2'];
  1453. $antithromboticstartingdate2 = $data['AntiThromboticStartingDate2'];
  1454. $antithromboticname3 = $data['AntiThromboticName3'];
  1455. $antithromboticposology3 = $data['AntiThromboticPosology3'];
  1456. $antithromboticstartingdate3 = $data['AntiThromboticStartingDate3'];
  1457. array_push($rest, array("IDPatient"=>$idpatient,
  1458. "Visite"=>$visite,
  1459. "Date"=>$date,
  1460. "HighBloodPressure"=>$highbloodpressure,
  1461. "NbHighBloodPressure"=>$highbloodpressure,
  1462. "Hypercholesterolemia"=>$hypercholesterolemia,
  1463. "NbHypercholesterolemia"=>$nbhypercholesterolemia,
  1464. "Diabetes"=>$diabetes,
  1465. "NbDiabetes"=>$nbdiabetes,
  1466. "Hypertriglyceridemia"=>$hypertriglyceridemia,
  1467. "NbHypertriglyceridemia"=>$nbhypertriglyceridemia,
  1468. "Smoking"=>$smoking,
  1469. "NbCigarettesDay"=>$nbcigarettesday,
  1470. "NbYearSmoking"=>$nbyearsmoking,
  1471. "CoronaryHeartDisease"=>$coronaryheartdisease,
  1472. "TypeCoronaryHearDisease"=>$typecoronaryheardisease,
  1473. "IschemicStroke"=>$ischemicstroke,
  1474. "NbIschemicStroke"=>$nbischemicstroke,
  1475. "BloodPressureRightArm"=>$bloodpressurerightarm,
  1476. "BloodPressureLeftArm"=>$bloodpressureleftarm,
  1477. "HeartRate"=>$heartrate,
  1478. "Arrhytmia"=>$arrhytmia,
  1479. "AntiHypertensive"=>$antihypertensive,
  1480. "AntiHypertensiveName1"=>$antihypertensivename1,
  1481. "AntiHypertensivePosology1"=>$antihypertensiveposology1,
  1482. "AntiHypertensiveStartingDate1"=>$antihypertensivestartingdate1,
  1483. "AntiHypertensiveName2"=>$antihypertensivename2,
  1484. "AntiHypertensivePosology2"=>$antihypertensiveposology2,
  1485. "AntiHypertensiveStartingDate2"=>$antihypertensivestartingdate2,
  1486. "AntiHypertensiveName3"=>$antihypertensivename3,
  1487. "AntiHypertensivePosology3"=>$antihypertensiveposology3,
  1488. "AntiHypertensiveStartingDate3"=>$antihypertensivestartingdate3,
  1489. "Hypolipidemic"=>$hypolipidemic,
  1490. "HypolipidemicName1"=>$hypolipidemicname1,
  1491. "HypolipidemicPosology1"=>$hypolipidemicposology1,
  1492. "HypolipidemicStartingDate1"=>$hypolipidemicstartingdate1,
  1493. "HypolipidemicName2"=>$hypolipidemicname2,
  1494. "HypolipidemicPosology2"=>$hypolipidemicposology2,
  1495. "HypolipidemicStartingDate2"=>$hypolipidemicstartingdate2,
  1496. "HypolipidemicName3"=>$hypolipidemicname3,
  1497. "HypolipidemicPosology3"=>$hypolipidemicposology3,
  1498. "HypolipidemicStartingDate3"=>$hypolipidemicstartingdate3,
  1499. "Antidiabetis"=>$antidiabetis,
  1500. "AntidiabetisName1"=>$antidiabetisname1,
  1501. "AntidiabetisPosology1"=>$antidiabetisposology1,
  1502. "AntidiabetisStartingDate1"=>$antidiabetisstartingdate1,
  1503. "AntidiabetisName2"=>$antidiabetisname2,
  1504. "AntidiabetisPosology2"=>$antidiabetisposology2,
  1505. "AntidiabetisStartingDate2"=>$antidiabetisstartingdate2,
  1506. "AntidiabetisName3"=>$antidiabetisname3,
  1507. "AntidiabetisPosology3"=>$antidiabetisposology3,
  1508. "AntidiabetisStartingDate3"=>$antidiabetisstartingdate3,
  1509. "AntiThrombotic"=>$antithrombotic,
  1510. "AntiThromboticName1"=>$antithromboticname1,
  1511. "AntiThromboticPosology1"=>$antithromboticposology1,
  1512. "AntiThromboticStartingDate1"=>$antithromboticstartingdate1,
  1513. "AntiThromboticName2"=>$antithromboticname2,
  1514. "AntiThromboticPosology2"=>$antithromboticposology2,
  1515. "AntiThromboticStartingDate2"=>$antithromboticstartingdate2,
  1516. "AntiThromboticName3"=>$antithromboticname3,
  1517. "AntiThromboticPosology3"=>$antithromboticposology3,
  1518. "AntiThromboticStartingDate3"=>$antithromboticstartingdate3));
  1519. }
  1520. }
  1521. else
  1522. {
  1523. $idpatient = '';
  1524. $visite = '';
  1525. $date = '';
  1526. $highbloodpressure = '';
  1527. $nbhighbloodpressure = '';
  1528. $hypercholesterolemia = '';
  1529. $nbhypercholesterolemia = '';
  1530. $diabetes = '';
  1531. $nbdiabetes = '';
  1532. $hypertriglyceridemia = '';
  1533. $nbhypertriglyceridemia = '';
  1534. $smoking = '';
  1535. $nbcigarettesday = '';
  1536. $nbyearsmoking = '';
  1537. $coronaryheartdisease = '';
  1538. $typecoronaryheardisease = '';
  1539. $ischemicstroke = '';
  1540. $nbischemicstroke = '';
  1541. $typeischelicstroke = '';
  1542. $etiologyischemicstroke = '';
  1543. $bloodpressurerightarm = '';
  1544. $bloodpressureleftarm = '';
  1545. $heartrate = '';
  1546. $arrhytmia = '';
  1547. $antihypertensive = '';
  1548. $antihypertensivename1 = '';
  1549. $antihypertensiveposology1 = '';
  1550. $antihypertensivestartingdate1 = '';
  1551. $antihypertensivename2 = '';
  1552. $antihypertensiveposology2 = '';
  1553. $antihypertensivestartingdate2 = '';
  1554. $antihypertensivename3 = '';
  1555. $antihypertensiveposology3 = '';
  1556. $antihypertensivestartingdate3 = '';
  1557. $hypolipidemic = '';
  1558. $hypolipidemicname1 = '';
  1559. $hypolipidemicposology1 = '';
  1560. $hypolipidemicstartingdate1 = '';
  1561. $hypolipidemicname2 = '';
  1562. $hypolipidemicposology2 = '';
  1563. $hypolipidemicstartingdate2 = '';
  1564. $hypolipidemicname3 = '';
  1565. $hypolipidemicposology3 = '';
  1566. $hypolipidemicstartingdate3 = '';
  1567. $antidiabetis = '';
  1568. $antidiabetisname1 = '';
  1569. $antidiabetisposology1 = '';
  1570. $antidiabetisstartingdate1 = '';
  1571. $antidiabetisname2 = '';
  1572. $antidiabetisposology2 = '';
  1573. $antidiabetisstartingdate2 = '';
  1574. $antidiabetisname3 = '';
  1575. $antidiabetisposology3 = '';
  1576. $antidiabetisstartingdate3 = '';
  1577. $antithrombotic = '';
  1578. $antithromboticname1 = '';
  1579. $antithromboticposology1 = '';
  1580. $antithromboticstartingdate1 = '';
  1581. $antithromboticname2 = '';
  1582. $antithromboticposology2 = '';
  1583. $antithromboticstartingdate2 = '';
  1584. $antithromboticname3 = '';
  1585. $antithromboticposology3 = '';
  1586. $antithromboticstartingdate3 = '';
  1587. array_push($rest, array("IDPatient"=>$idpatient,
  1588. "Visite"=>$visite,
  1589. "Date"=>$date,
  1590. "HighBloodPressure"=>$highbloodpressure,
  1591. "NbHighBloodPressure"=>$highbloodpressure,
  1592. "Hypercholesterolemia"=>$hypercholesterolemia,
  1593. "NbHypercholesterolemia"=>$nbhypercholesterolemia,
  1594. "Diabetes"=>$diabetes,
  1595. "NbDiabetes"=>$nbdiabetes,
  1596. "Hypertriglyceridemia"=>$hypertriglyceridemia,
  1597. "NbHypertriglyceridemia"=>$nbhypertriglyceridemia,
  1598. "Smoking"=>$smoking,
  1599. "NbCigarettesDay"=>$nbcigarettesday,
  1600. "NbYearSmoking"=>$nbyearsmoking,
  1601. "CoronaryHeartDisease"=>$coronaryheartdisease,
  1602. "TypeCoronaryHearDisease"=>$typecoronaryheardisease,
  1603. "IschemicStroke"=>$ischemicstroke,
  1604. "NbIschemicStroke"=>$nbischemicstroke,
  1605. "EtiologyIlchemicStroke"=>$etiologyischemicstroke,
  1606. "BloodPressureRightArm"=>$bloodpressurerightarm,
  1607. "BloodPressureLeftArm"=>$bloodpressureleftarm,
  1608. "HeartRate"=>$heartrate,
  1609. "Arrhytmia"=>$arrhytmia,
  1610. "AntiHypertensive"=>$antihypertensive,
  1611. "AntiHypertensiveName1"=>$antihypertensivename1,
  1612. "AntiHypertensivePosology1"=>$antihypertensiveposology1,
  1613. "AntiHypertensiveStartingDate1"=>$antihypertensivestartingdate1,
  1614. "AntiHypertensiveName2"=>$antihypertensivename2,
  1615. "AntiHypertensivePosology2"=>$antihypertensiveposology2,
  1616. "AntiHypertensiveStartingDate2"=>$antihypertensivestartingdate2,
  1617. "AntiHypertensiveName3"=>$antihypertensivename3,
  1618. "AntiHypertensivePosology3"=>$antihypertensiveposology3,
  1619. "AntiHypertensiveStartingDate3"=>$antihypertensivestartingdate3,
  1620. "Hypolipidemic"=>$hypolipidemic,
  1621. "HypolipidemicName1"=>$hypolipidemicname1,
  1622. "HypolipidemicPosology1"=>$hypolipidemicposology1,
  1623. "HypolipidemicStartingDate1"=>$hypolipidemicstartingdate1,
  1624. "HypolipidemicName2"=>$hypolipidemicname2,
  1625. "HypolipidemicPosology2"=>$hypolipidemicposology2,
  1626. "HypolipidemicStartingDate2"=>$hypolipidemicstartingdate2,
  1627. "HypolipidemicName3"=>$hypolipidemicname3,
  1628. "HypolipidemicPosology3"=>$hypolipidemicposology3,
  1629. "HypolipidemicStartingDate3"=>$hypolipidemicstartingdate3,
  1630. "Antidiabetis"=>$antidiabetis,
  1631. "AntidiabetisName1"=>$antidiabetisname1,
  1632. "AntidiabetisPosology1"=>$antidiabetisposology1,
  1633. "AntidiabetisStartingDate1"=>$antidiabetisstartingdate1,
  1634. "AntidiabetisName2"=>$antidiabetisname2,
  1635. "AntidiabetisPosology2"=>$antidiabetisposology2,
  1636. "AntidiabetisStartingDate2"=>$antidiabetisstartingdate2,
  1637. "AntidiabetisName3"=>$antidiabetisname3,
  1638. "AntidiabetisPosology3"=>$antidiabetisposology3,
  1639. "AntidiabetisStartingDate3"=>$antidiabetisstartingdate3,
  1640. "AntiThrombotic"=>$antithrombotic,
  1641. "AntiThromboticName1"=>$antithromboticname1,
  1642. "AntiThromboticPosology1"=>$antithromboticposology1,
  1643. "AntiThromboticStartingDate1"=>$antithromboticstartingdate1,
  1644. "AntiThromboticName2"=>$antithromboticname2,
  1645. "AntiThromboticPosology2"=>$antithromboticposology2,
  1646. "AntiThromboticStartingDate2"=>$antithromboticstartingdate2,
  1647. "AntiThromboticName3"=>$antithromboticname3,
  1648. "AntiThromboticPosology3"=>$antithromboticposology3,
  1649. "AntiThromboticStartingDate3"=>$antithromboticstartingdate3));
  1650. }
  1651. // on retourne le tableau
  1652. return $rest;
  1653. }
  1654. // Récupère toutes les mesures pour un rendez-vous sélectionné
  1655. function getMesures($database, $serveurbase, $loginbase, $passwordbase, $idrendezvous, $idutiliseur)
  1656. {
  1657. $rest = array();
  1658. $link = mysql_connect($serveurbase, $loginbase, $passwordbase) or die ("Impossible de se connecter : " . mysql_error());
  1659. mysql_select_db($database, $link);
  1660. mysql_query("SET NAMES 'utf8'");
  1661. $mesures = 'mesures'.$idutiliseur;
  1662. $query = "SELECT
  1663. TypeMesure,
  1664. Situation,
  1665. Side,
  1666. Echelle,
  1667. NomEchelle,
  1668. LongueurEchelle,
  1669. x1Echelle,
  1670. y1Echelle,
  1671. x2Echelle,
  1672. y2Echelle,
  1673. Etendue,
  1674. Min,
  1675. Moy,
  1676. Max,
  1677. IQ_Densite,
  1678. StandartDeviation,
  1679. NumberOfPoints,
  1680. x1,
  1681. y1,
  1682. x2,
  1683. y2,
  1684. NumberOfPlaques,
  1685. NumberOfStenosis,
  1686. StenosisAngle,
  1687. NumberOfOcclusions FROM $mesures WHERE (IDRendezVous = $idrendezvous) LIMIT 0,30000";
  1688. $result = mysql_query($query);
  1689. $result2 = mysql_num_rows($result);
  1690. if ($result2 >= 1)
  1691. {
  1692. while($data = mysql_fetch_assoc($result))
  1693. {
  1694. $typemesure = $data['TypeMesure'];
  1695. $situation = $data['Situation'];
  1696. $side = $data['Side'];
  1697. $echelle = $data['Echelle'];
  1698. $nomechelle = $data['NomEchelle'];
  1699. $longueurechelle = $data['LongueurEchelle'];
  1700. $x1echelle = $data['x1Echelle'];
  1701. $y1echelle = $data['y1Echelle'];
  1702. $x2echelle = $data['x2Echelle'];
  1703. $y2echelle = $data['y2Echelle'];
  1704. $etendue = $data['Etendue'];
  1705. $min = $data['Min'];
  1706. $moy = $data['Moy'];
  1707. $max = $data['Max'];
  1708. $iq_densite = $data['IQ_Densite'];
  1709. $standartdeviation = $data['StandartDeviation'];
  1710. $numberofpoints = $data['NumberOfPoints'];
  1711. $x1 = $data['x1'];
  1712. $y1 = $data['y1'];
  1713. $x2 = $data['x2'];
  1714. $y2 = $data['y2'];
  1715. $numberofplaques = $data['NumberOfPlaques'];
  1716. $numberofstenosis = $data['NumberOfStenosis'];
  1717. $stenosisangle = $data['StenosisAngle'];
  1718. $numberofocclusions = $data['NumberOfOcclusions'];
  1719. array_push($rest, array("TypeMesure"=>$typemesure,
  1720. "Situation"=>$situation,
  1721. "Side"=>$side,
  1722. "Echelle"=>$echelle,
  1723. "NomEchelle"=>$nomechelle,
  1724. "LongueurEchelle"=>$longueurechelle,
  1725. "x1Echelle"=>$x1echelle,
  1726. "y1Echelle"=>$y1echelle,
  1727. "x2Echelle"=>$x2echelle,
  1728. "y2Echelle"=>$y2echelle,
  1729. "Etendue"=>$etendue,
  1730. "Min"=>$min,
  1731. "Moy"=>$moy,
  1732. "Max"=>$max,
  1733. "IQ_Densite"=>$iq_densite,
  1734. "StandartDeviation"=>$standartdeviation,
  1735. "NumberOfPoints"=>$numberofpoints,
  1736. "x1"=>$x1,
  1737. "y1"=>$y1,
  1738. "x2"=>$x2,
  1739. "y2"=>$y2,
  1740. "NumberOfPlaques"=>$numberofplaques,
  1741. "NumberOfStenosis"=>$numberofstenosis,
  1742. "StenosisAngle"=>$stenosisangle,
  1743. "NumberOfOcclusions"=>$numberofocclusions));
  1744. }
  1745. }
  1746. else
  1747. {
  1748. $typemesure = '';
  1749. $situation = '';
  1750. $side = '';
  1751. $echelle = '';
  1752. $nomechelle = '';
  1753. $longueurechelle = '';
  1754. $x1echelle = '';
  1755. $y1echelle = '';
  1756. $x2echelle = '';
  1757. $y2echelle = '';
  1758. $etendue = '';
  1759. $min = '';
  1760. $moy = '';
  1761. $max = '';
  1762. $iq_densite = '';
  1763. $standartdeviation = '';
  1764. $numberofpoints = '';
  1765. $x1 = '';
  1766. $y1 = '';
  1767. $x2 = '';
  1768. $y2 = '';
  1769. $numberofplaques = '';
  1770. $numberofstenosis = '';
  1771. $stenosisangle = '';
  1772. $numberofocclusions = '';
  1773. array_push($rest, array("TypeMesure"=>$typemesure,
  1774. "Situation"=>$situation,
  1775. "Side"=>$side,
  1776. "Echelle"=>$echelle,
  1777. "NomEchelle"=>$nomechelle,
  1778. "LongueurEchelle"=>$longueurechelle,
  1779. "x1Echelle"=>$x1echelle,
  1780. "y1Echelle"=>$y1echelle,
  1781. "x2Echelle"=>$x2echelle,
  1782. "y2Echelle"=>$y2echelle,
  1783. "Etendue"=>$etendue,
  1784. "Min"=>$min,
  1785. "Moy"=>$moy,
  1786. "Max"=>$max,
  1787. "IQ_Densite"=>$iq_densite,
  1788. "StandartDeviation"=>$standartdeviation,
  1789. "NumberOfPoints"=>$numberofpoints,
  1790. "x1"=>$x1,
  1791. "y1"=>$y1,
  1792. "x2"=>$x2,
  1793. "y2"=>$y2,
  1794. "NumberOfPlaques"=>$numberofplaques,
  1795. "NumberOfStenosis"=>$numberofstenosis,
  1796. "StenosisAngle"=>$stenosisangle,
  1797. "NumberOfOcclusions"=>$numberofocclusions));
  1798. }
  1799. // on retourne le tableau
  1800. return $rest;
  1801. }
  1802. // Récupère toutes les graphiques pour un rendez-vous sélectionné
  1803. function getGraphiques($database, $serveurbase, $loginbase, $passwordbase, $idrendezvous, $idutiliseur)
  1804. {
  1805. $rest = array();
  1806. $link = mysql_connect($serveurbase, $loginbase, $passwordbase) or die ("Impossible de se connecter : " . mysql_error());
  1807. mysql_select_db($database, $link);
  1808. mysql_query("SET NAMES 'utf8'");
  1809. $tgraphiques = 'graphiques'.$idutiliseur;
  1810. $query = "SELECT
  1811. TypeGraphique,
  1812. Situation,
  1813. Side,
  1814. x,
  1815. y FROM $tgraphiques WHERE (IDRendezVous = $idrendezvous) LIMIT 0,30000";
  1816. $result = mysql_query($query);
  1817. $result2 = mysql_num_rows($result);
  1818. if ($result2 >= 1)
  1819. {
  1820. while($data = mysql_fetch_assoc($result))
  1821. {
  1822. $typegraphique = $data['TypeGraphique'];
  1823. $situation = $data['Situation'];
  1824. $side = $data['Side'];
  1825. $x = $data['x'];
  1826. $y = $data['y'];
  1827. array_push($rest, array("TypeGraphique"=>$typegraphique,
  1828. "Situation"=>$situation,
  1829. "Side"=>$side,
  1830. "x"=>$x,
  1831. "y"=>$y));
  1832. }
  1833. }
  1834. else
  1835. {
  1836. $typegraphique = '';
  1837. $situation = '';
  1838. $side = '';
  1839. $x = '';
  1840. $y = '';
  1841. array_push($rest, array("TypeGraphique"=>$typegraphique,
  1842. "Situation"=>$situation,
  1843. "Side"=>$side,
  1844. "x"=>$x,
  1845. "y"=>$y));
  1846. }
  1847. // on retourne le tableau
  1848. return $rest;
  1849. }
  1850. function updateInfosPatient($database, $serveurbase, $loginbase, $passwordbase, $idpatient, $ivrs, $nom, $prenom, $sexe, $datedenaissance, $idutilisateur)
  1851. {
  1852. $tpatients = 'patients'.$idutilisateur;
  1853. $link = mysql_connect($serveurbase, $loginbase, $passwordbase) or die ("Impossible de se connecter : " . mysql_error());
  1854. mysql_select_db($database, $link);
  1855. mysql_query("SET NAMES 'utf8'");
  1856. $query = "UPDATE $tpatients SET IVRS='$ivrs', Nom='$nom', Prenom='$prenom', Sexe='$sexe', DateDeNaissance='$datedenaissance' WHERE ID=$idpatient";
  1857. $result = mysql_query($query);
  1858. return true;
  1859. }
  1860. // Copie des fichiers
  1861. function copyFile($etude, $source1, $dest1, $source2, $dest2, $source3, $dest3, $source4, $dest4, $source5, $dest5, $source6, $dest6)
  1862. {
  1863. if ($etude == 256)
  1864. {
  1865. if (($source1 != '') && ($dest1 != ''))
  1866. {
  1867. copy($source1, $dest1);
  1868. chmod($dest1, 0755);
  1869. }
  1870. if (($source2 != '') && ($dest2 != ''))
  1871. {
  1872. copy($source2, $dest2);
  1873. chmod($dest2, 0755);
  1874. }
  1875. if (($source3 != '') && ($dest3 != ''))
  1876. {
  1877. copy($source3, $dest3);
  1878. chmod($dest3, 0755);
  1879. }
  1880. if (($source4 != '') && ($dest4 != ''))
  1881. {
  1882. copy($source4, $dest4);
  1883. chmod($dest4, 0755);
  1884. }
  1885. if (($source5 != '') && ($dest5 != ''))
  1886. {
  1887. copy($source5, $dest5);
  1888. chmod($dest5, 0755);
  1889. }
  1890. if (($source6 != '') && ($dest6 != ''))
  1891. {
  1892. copy($source6, $dest6);
  1893. chmod($dest6, 0755);
  1894. }
  1895. }
  1896. else
  1897. {
  1898. if (($source1 != '') && ($dest1 != ''))
  1899. {
  1900. copy($source1, $dest1);
  1901. chmod($dest1, 0755);
  1902. }
  1903. if (($source4 != '') && ($dest4 != ''))
  1904. {
  1905. copy($source4, $dest4);
  1906. chmod($dest4, 0755);
  1907. }
  1908. if (($etude == 1) || ($etude == 2))
  1909. {
  1910. if (($source2 != '') && ($dest2 != ''))
  1911. {
  1912. copy($source2, $dest2);
  1913. chmod($dest2, 0755);
  1914. }
  1915. if (($source3 != '') && ($dest3 != ''))
  1916. {
  1917. copy($source3, $dest3);
  1918. chmod($dest3, 0755);
  1919. }
  1920. if (($source5 != '') && ($dest5 != ''))
  1921. {
  1922. copy($source5, $dest5);
  1923. chmod($dest5, 0755);
  1924. }
  1925. if (($source6 != '') && ($dest6 != ''))
  1926. {
  1927. copy($source6, $dest6);
  1928. chmod($dest6, 0755);
  1929. }
  1930. }
  1931. }
  1932. }
  1933. // Détruit des fichiers
  1934. function deleteFile($etude, $filename1, $filename2, $filename3, $filename4, $filename5, $filename6)
  1935. {
  1936. // Si le chemin contient Temp
  1937. if (strpos($filename1, 'Temp'))
  1938. {
  1939. unlink($filename1);
  1940. }
  1941. if (strpos($filename4, 'Temp'))
  1942. {
  1943. unlink($filename4);
  1944. }
  1945. if (($etude == 1) || ($etude == 2))
  1946. {
  1947. if (strpos($filename2, 'Temp'))
  1948. {
  1949. unlink($filename2);
  1950. }
  1951. if (strpos($filename3, 'Temp'))
  1952. {
  1953. unlink($filename3);
  1954. }
  1955. if (strpos($filename5, 'Temp'))
  1956. {
  1957. unlink($filename5);
  1958. }
  1959. if (strpos($filename6, 'Temp'))
  1960. {
  1961. unlink($filename6);
  1962. }
  1963. }
  1964. }
  1965. // Nettoyage des répertoires temporaires
  1966. function cleanDir($captchaFolder, $fileTypes)
  1967. {
  1968. // Filetypes to check (you can also use *.*)
  1969. // Here you can define after how many
  1970. // minutes the files should get deleted
  1971. // Durée max connecion : 24 heures
  1972. $expire_time = 1440;
  1973. // Find all files of the given file type
  1974. foreach (glob($captchaFolder.$fileTypes) as $Filename)
  1975. {
  1976. // Read file creation time
  1977. $FileCreationTime = filectime($Filename);
  1978. // Calculate file age in seconds
  1979. $FileAge = time() - $FileCreationTime;
  1980. // Is the file older than the given time span?
  1981. if ($FileAge > ($expire_time * 60))
  1982. {
  1983. // Now do something with the olders files...
  1984. // print "The file $Filename is older than $expire_time minutes\n";
  1985. // For example deleting files:
  1986. unlink($Filename);
  1987. }
  1988. }
  1989. }
  1990. // Nettoyage des répertoires temporaires
  1991. function cleanTempDir()
  1992. {
  1993. // Define the folder to clean
  1994. $rep1 = $_SERVER['DOCUMENT_ROOT'].'/TempMP/';
  1995. $this->cleanDir($rep1, '*.JPG');
  1996. $this->cleanDir($rep1, '*.jpg');
  1997. $this->cleanDir($rep1, '*.dcm');
  1998. $this->cleanDir($rep1, '*.DCM');
  1999. $rep2 = $_SERVER['DOCUMENT_ROOT'].'/TempMPDemo/';
  2000. $this->cleanDir($rep2, '*.JPG');
  2001. $this->cleanDir($rep2, '*.jpg');
  2002. $this->cleanDir($rep2, '*.dcm');
  2003. $this->cleanDir($rep2, '*.DCM');
  2004. $rep3 = $_SERVER['DOCUMENT_ROOT'].'/TempCS0/';
  2005. $this->cleanDir($rep3, '*.JPG');
  2006. $this->cleanDir($rep3, '*.jpg');
  2007. $this->cleanDir($rep3, '*.dcm');
  2008. $this->cleanDir($rep3, '*.DCM');
  2009. $rep4 = $_SERVER['DOCUMENT_ROOT'].'/TempCS1/';
  2010. $this->cleanDir($rep4, '*.JPG');
  2011. $this->cleanDir($rep4, '*.jpg');
  2012. $this->cleanDir($rep4, '*.dcm');
  2013. $this->cleanDir($rep4, '*.DCM');
  2014. $rep5 = $_SERVER['DOCUMENT_ROOT'].'/TempCS2/';
  2015. $this->cleanDir($rep5, '*.JPG');
  2016. $this->cleanDir($rep5, '*.jpg');
  2017. $this->cleanDir($rep5, '*.dcm');
  2018. $this->cleanDir($rep5, '*.DCM');
  2019. $rep6 = $_SERVER['DOCUMENT_ROOT'].'/uploader/myFileDir/';
  2020. $this->cleanDir($rep6, '*.JPG');
  2021. $this->cleanDir($rep6, '*.jpg');
  2022. $this->cleanDir($rep6, '*.dcm');
  2023. $this->cleanDir($rep6, '*.DCM');
  2024. return '1';
  2025. }
  2026. function testFilesCopied($etude, $filename1, $filename2, $filename3, $filename4, $filename5, $filename6)
  2027. {
  2028. if ($etude == 256)
  2029. {
  2030. $erreur = false;
  2031. if ($filename1 != '')
  2032. {
  2033. if (!file_exists($filename1))
  2034. {
  2035. $erreur = true;
  2036. }
  2037. }
  2038. if ($filename2 != '')
  2039. {
  2040. if (!file_exists($filename2))
  2041. {
  2042. $erreur = true;
  2043. }
  2044. }
  2045. if ($filename3 != '')
  2046. {
  2047. if (!file_exists($filename3))
  2048. {
  2049. $erreur = true;
  2050. }
  2051. }
  2052. if ($filename4 != '')
  2053. {
  2054. if (!file_exists($filename4))
  2055. {
  2056. $erreur = true;
  2057. }
  2058. }
  2059. if ($filename5 != '')
  2060. {
  2061. if (!file_exists($filename5))
  2062. {
  2063. $erreur = true;
  2064. }
  2065. }
  2066. if ($filename6 != '')
  2067. {
  2068. if (!file_exists($filename6))
  2069. {
  2070. $erreur = true;
  2071. }
  2072. }
  2073. if ($erreur == true)
  2074. {
  2075. return '0';
  2076. }
  2077. else
  2078. {
  2079. return '1';
  2080. }
  2081. }
  2082. else if ($etude == 0)
  2083. {
  2084. if (file_exists($filename1) && file_exists($filename4))
  2085. {
  2086. return '1';
  2087. }
  2088. else
  2089. {
  2090. return '0';
  2091. }
  2092. }
  2093. else if (($etude == 1) || ($etude == 2))
  2094. {
  2095. if (file_exists($filename1) && file_exists($filename2) && file_exists($filename3) && file_exists($filename4) && file_exists($filename5) && file_exists($filename6))
  2096. {
  2097. return '1';
  2098. }
  2099. else
  2100. {
  2101. return '0';
  2102. }
  2103. }
  2104. }
  2105. function SaveAsJPEG($etude, $file1, $bytesArray1, $file2, $bytesArray2, $file3, $bytesArray3, $file4, $bytesArray4, $file5, $bytesArray5, $file6, $bytesArray6)
  2106. {
  2107. $data1 = $bytesArray1->data;
  2108. file_put_contents($file1, $data1);
  2109. $data4 = $bytesArray4->data;
  2110. file_put_contents($file4, $data4);
  2111. if (($etude == 1) || ($etude == 2))
  2112. {
  2113. $data2 = $bytesArray2->data;
  2114. file_put_contents($file2, $data2);
  2115. $data3 = $bytesArray3->data;
  2116. file_put_contents($file3, $data3);
  2117. $data5 = $bytesArray5->data;
  2118. file_put_contents($file5, $data5);
  2119. $data6 = $bytesArray6->data;
  2120. file_put_contents($file6, $data6);
  2121. }
  2122. return '1';
  2123. }
  2124. function SaveAsJPEG2($file1, $bytesArray1, $idpatient, $nom, $prenom, $sexe, $datenaissance)
  2125. {
  2126. // chmod($file1, 0777);
  2127. $data1 = $bytesArray1->data;
  2128. file_put_contents($file1, $data1);
  2129. chmod($file1, 0755);
  2130. // Cryptage de l'image
  2131. header("Content-type:image/jpeg");
  2132. $image = imagecreatefromjpeg($file1);
  2133. $dimh = imagesx($image);
  2134. $dimv = imagesy($image);
  2135. $ncol = ($dimv * 12) / 100;
  2136. $rouge = 0;
  2137. $vert = 0;
  2138. $bleu = 0;
  2139. $fond = imagecolorallocate($image, $rouge, $vert, $bleu);
  2140. $blanc = imagecolorallocate($image, 255, 255, 255);
  2141. ImageFilledRectangle($image, 0, 0, $dimh, $ncol, $fond);
  2142. ImageFilledRectangle($image, 0, ($dimv - $ncol), $dimh, $dimv, $fond);
  2143. $texte_h = $dimv - imagefontheight(12) - 20;
  2144. $texte_v = 20;
  2145. imagestring($image, 12, $texte_v, $texte_h, $nom.' '.$prenom.' '.$datenaissance.' ('.$sexe.') '.$idpatient, $blanc);
  2146. // Enregistrement de l'image
  2147. imagejpeg($image, $file1, 100);
  2148. chmod($file1, 0755);
  2149. return '1';
  2150. }
  2151. function sendReportMail($pdfname, $to1, $from, $subject, $emailMessage)
  2152. {
  2153. include_once('class.phpmailer.php');
  2154. $mail = new PHPMailer();
  2155. $body = $emailMessage;
  2156. $body = eregi_replace("[\]",'',$body);
  2157. $mail->IsSendmail(); // telling the class to use SendMail transport
  2158. $mail->From = $from;
  2159. $mail->FromName = $from;
  2160. $mail->Subject = $subject;
  2161. $mail->AltBody = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test
  2162. $mail->MsgHTML($body);
  2163. $mail->AddAddress($to1, "Dest 1");
  2164. $mail->AddAttachment($pdfname);
  2165. if(!$mail->Send())
  2166. {
  2167. return '0';
  2168. }
  2169. else
  2170. {
  2171. return '1';
  2172. }
  2173. }
  2174. function testFileUploadCreated($filename)
  2175. {
  2176. if (file_exists($filename))
  2177. {
  2178. chmod($filename, 0755);
  2179. return '1';
  2180. }
  2181. else
  2182. {
  2183. return '0';
  2184. }
  2185. }
  2186. function sendContactForm($to1, $subject, $emailMessage)
  2187. {
  2188. include_once('class.phpmailer.php');
  2189. $mail = new PHPMailer();
  2190. $body = $emailMessage;
  2191. $body = eregi_replace("[\]",'',$body);
  2192. $mail->IsSendmail(); // telling the class to use SendMail transport
  2193. $mail->From = "j.deppe@evolucare.com";
  2194. $mail->FromName = $from;
  2195. $mail->Subject = $subject;
  2196. $mail->AltBody = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test
  2197. $mail->MsgHTML($body);
  2198. $mail->AddAddress($to1, "Dest 1");
  2199. if(!$mail->Send())
  2200. {
  2201. return '0';
  2202. }
  2203. else
  2204. {
  2205. return '1';
  2206. }
  2207. }
  2208. function sendImageGalerie($to1, $subject, $emailMessage, $myimage)
  2209. {
  2210. include_once('class.phpmailer.php');
  2211. $mail = new PHPMailer();
  2212. $body = $emailMessage;
  2213. $body = eregi_replace("[\]",'',$body);
  2214. $mail->IsSendmail(); // telling the class to use SendMail transport
  2215. $mail->From = "j.deppe@evolucare.com";
  2216. $mail->FromName = $from;
  2217. $mail->Subject = $subject;
  2218. $mail->AltBody = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test
  2219. $mail->MsgHTML($body);
  2220. $mail->AddAddress($to1, "Dest 1");
  2221. $mail->AddAttachment($myimage); // attachment
  2222. if(!$mail->Send())
  2223. {
  2224. return '0';
  2225. }
  2226. else
  2227. {
  2228. return '1';
  2229. }
  2230. }
  2231. // Récupère en une fois toutes les infos
  2232. function GetStartInfos()
  2233. {
  2234. $rest = array();
  2235. if (!empty($_SERVER['HTTP_CLIENT_IP'])) //check ip from share internet
  2236. {
  2237. $ip=$_SERVER['HTTP_CLIENT_IP'];
  2238. }
  2239. elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) //to check ip is pass from proxy
  2240. {
  2241. $ip=$_SERVER['HTTP_X_FORWARDED_FOR'];
  2242. }
  2243. else
  2244. {
  2245. $ip=$_SERVER['REMOTE_ADDR'];
  2246. }
  2247. $today = date("d-m")."-20".date('y')." ".date('H:i');
  2248. /*
  2249. $gi = geoip_open(DIR_LOCALISE."GeoLiteCity.dat",GEOIP_STANDARD);
  2250. $record = geoip_record_by_addr($gi, $ip);
  2251. $pays = $record->country_code;
  2252. */
  2253. $pathovh = $_SERVER['DOCUMENT_ROOT'];
  2254. array_push($rest, array("AdresseIP"=>$ip,
  2255. "DateServeur"=>$today,
  2256. "PathOvh"=>$pathovh));
  2257. // on retourne le tableau
  2258. return $rest;
  2259. }
  2260. function pdfEncrypt($origFile, $password, $destFile)
  2261. {
  2262. $pdf =& new FPDI_Protection();
  2263. // set the format of the destinaton file, in our case 6×9 inch
  2264. $pdf->FPDF('P', 'in', 'A4');
  2265. //calculate the number of pages from the original document
  2266. $pagecount = $pdf->setSourceFile($origFile);
  2267. // copy all pages from the old unprotected pdf in the new one
  2268. for ($loop = 1; $loop <= $pagecount; $loop++)
  2269. {
  2270. $tplidx = $pdf->importPage($loop);
  2271. $pdf->addPage();
  2272. $pdf->useTemplate($tplidx);
  2273. }
  2274. // protect the new pdf file, and allow no printing, copy etc and leave only reading allowed
  2275. $pdf->SetProtection(array('print', 'copy'), $password, '');
  2276. $pdf->Output($destFile, 'F');
  2277. return $destFile;
  2278. }
  2279. function sendEnvoyerAUnAmi($from, $to1, $subject, $emailMessage)
  2280. {
  2281. include_once('class.phpmailer.php');
  2282. $mail = new PHPMailer();
  2283. $body = $emailMessage;
  2284. $body = eregi_replace("[\]",'',$body);
  2285. $mail->IsSendmail(); // telling the class to use SendMail transport
  2286. $mail->From = $from;
  2287. $mail->FromName = $from;
  2288. $mail->Subject = $subject;
  2289. $mail->AltBody = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test
  2290. $mail->MsgHTML($body);
  2291. $mail->AddAddress($to1, "Dest 1");
  2292. if(!$mail->Send())
  2293. {
  2294. return '0';
  2295. }
  2296. else
  2297. {
  2298. return '1';
  2299. }
  2300. }
  2301. function upload($level, $id_cont, $fileName, $byteArray)
  2302. {
  2303. $adata = $byteArray->data;
  2304. // Les millisecondes
  2305. $m = explode(' ', microtime());
  2306. list($totalSeconds, $extraMilliseconds) = array($m[1], (int)round($m[0]*1000,3));
  2307. if ((substr_count($fileName,'.dcm') > 0) || (substr_count($fileName, '.DCM') > 0))
  2308. {
  2309. $fname = date('Y_m_d_H_i_s', $totalSeconds).'_'.$extraMilliseconds.'.dcm';
  2310. }
  2311. else
  2312. {
  2313. $fname = date('Y_m_d_H_i_s', $totalSeconds).'_'.$extraMilliseconds.'.jpg';
  2314. }
  2315. if (file_put_contents("../../../uploader/myFileDir/" . $fname, $adata))
  2316. {
  2317. chmod("../../../uploader/myFileDir/" . $fname, 0755);
  2318. return ($fname);
  2319. }
  2320. else
  2321. {
  2322. return '0';
  2323. }
  2324. }
  2325. /*
  2326. // Générateur aléatoire
  2327. function getran()
  2328. {
  2329. $k = (int)($seed1 % 53668);
  2330. $l = (int)(($seed1 - $k) / 53668);
  2331. $seed1 = (int)(40014 * $k - $l * 12211);
  2332. if ($seed1 < 0)
  2333. {
  2334. $seed1 = (int)($seed1 + 2147483563);
  2335. }
  2336. $k = (int)($seed2 % 52774);
  2337. $l = (int)(($seed2 - $k) / 52774);
  2338. $seed2 = (int)(40692 * $k - $l * 3791);
  2339. if ($seed2 < 0)
  2340. {
  2341. $seed2 = (int)($seed2 + 2147483399);
  2342. }
  2343. $iz = (int)($seed1 - $seed2);
  2344. if ($iz < 1)
  2345. {
  2346. $iz = (int)($iz + 2147483562);
  2347. }
  2348. $res = (real) ($iz * 4.656613e-10);
  2349. // $res = $iz * 0.0000000004656613;
  2350. if ($res < 0.0)
  2351. {
  2352. $res = 0.0;
  2353. }
  2354. if ($res > 1.0)
  2355. {
  2356. $res = 1.0;
  2357. }
  2358. return $res;
  2359. }
  2360. */
  2361. function crypteImage($fileNameIn, $fileNameOut, $pseed1, $pseed2, $colmin, $colmax, $dimh, $max)
  2362. {
  2363. header("Content-type:image/jpeg");
  2364. // global $seed1;
  2365. // global $seed2;
  2366. $seed1 = $pseed1;
  2367. $seed2 = $pseed2;
  2368. $image = imagecreatefromjpeg($fileNameIn);
  2369. $col2 = imagecolorallocate($image, 0, 0, 0);
  2370. for ($y = $colmin; $y < $colmax; $y++)
  2371. {
  2372. for ($x = 0; $x < $dimh; $x++)
  2373. {
  2374. $col = imagecolorat($image, $x, $y);
  2375. $rouge = ($col >> 16) & 0xFF;
  2376. $vert = ($col >> 8) & 0xFF;
  2377. $bleu = $col & 0xFF;
  2378. $colh = $bleu + ($rouge << 16) + ($vert << 8);
  2379. // $rd = (int) ($this->getran($seed1, $seed2) * PHP_INT_MAX);
  2380. $k = (int)($seed1 % 53668);
  2381. $l = (int)(($seed1 - $k) / 53668);
  2382. $seed1 = (int)(40014 * $k - $l * 12211);
  2383. if ($seed1 < 0)
  2384. {
  2385. $seed1 = (int)($seed1 + 2147483563);
  2386. }
  2387. $k = (int)($seed2 % 52774);
  2388. $l = (int)(($seed2 - $k) / 52774);
  2389. $seed2 = (int)(40692 * $k - $l * 3791);
  2390. if ($seed2 < 0)
  2391. {
  2392. $seed2 = (int)($seed2 + 2147483399);
  2393. }
  2394. $iz = (int)($seed1 - $seed2);
  2395. if ($iz < 1)
  2396. {
  2397. $iz = (int)($iz + 2147483562);
  2398. }
  2399. $res = (real) ($iz * 4.656613e-10);
  2400. if ($res < 0.0)
  2401. {
  2402. $res = 0.0;
  2403. }
  2404. if ($res > 1.0)
  2405. {
  2406. $res = 1.0;
  2407. }
  2408. $rd = (int) (($res * $max) * 10000) / 10000;
  2409. $col2h = (int) ($colh ^ $rd) & 0x00FFFFFF;
  2410. $rouge = ($col2h >> 16) & 0xFF;
  2411. $vert = ($col2h >> 8) & 0xFF;
  2412. $bleu = $col2h & 0xFF;
  2413. $col2 = imagecolorallocate($image, $rouge, $vert, $bleu);
  2414. ImageSetPixel($image, $x, $y, $col2);
  2415. }
  2416. }
  2417. // Enregistrement de l'image
  2418. imagejpeg($image, $fileNameOut, 100);
  2419. }
  2420. function updateCredit($database, $serveurbase, $loginbase, $passwordbase, $credits, $idutilisateur, $date, $adresseip, $typecredit, $idpatient, $idrendezvous, $idmesure)
  2421. {
  2422. $link = mysql_connect($serveurbase, $loginbase, $passwordbase) or die ("Impossible de se connecter : " . mysql_error());
  2423. mysql_select_db($database, $link);
  2424. mysql_query("SET NAMES 'utf8'");
  2425. $tcredits = 'credits'.$idutilisateur;
  2426. $query="UPDATE utilisateurs SET Credits=$credits WHERE (ID = '$idutilisateur')";
  2427. // Ajout du crédit dans la base
  2428. $result = mysql_query($query);
  2429. $query2 = "INSERT INTO $tcredits (Date, AdresseIP, TypeCredit, IDPatient, IDRendezVous, IDMesure) VALUES ('$date', '$adresseip', '$typecredit', $idpatient, $idrendezvous, $idmesure)";
  2430. $result2 = mysql_query($query2);
  2431. return true;
  2432. }
  2433. }
  2434. ?>