| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956 |
- <?php
- //require 'std.encryption.class.inc';
- // Pour cryptage du Rapport de visite Pdf
- require_once('fpdi/FPDI_Protection.php');
- class Uploaded
- {
- function updateUploaded($database, $serveurbase, $loginbase, $passwordbase, $Fichier, $Situation, $ID)
- {
- $link = mysql_connect($serveurbase, $loginbase, $passwordbase) or die ("Impossible de se connecter : " . mysql_error());
-
- mysql_select_db($database, $link);
- mysql_query("SET NAMES 'utf8'");
-
- $query="UPDATE uploaded SET Fichier='$Fichier', Situation='$Situation' WHERE ID=$ID";
-
- $result=mysql_query($query);
-
- return result;
- }
-
- function updateRdvImages($database, $serveurbase, $loginbase, $passwordbase, $images, $ID, $idutilisateur)
- {
- $link = mysql_connect($serveurbase, $loginbase, $passwordbase) or die ("Impossible de se connecter : " . mysql_error());
-
- mysql_select_db($database, $link);
- mysql_query("SET NAMES 'utf8'");
-
- $rendezvous = 'rendezvous'.$idutilisateur;
-
- $query="UPDATE $rendezvous SET Images=$images WHERE ID=$ID";
-
- $result=mysql_query($query);
-
- return result;
- }
-
- function getUploaded($database, $serveurbase, $loginbase, $passwordbase)
- {
- $rest = array();
-
- // on se connecte
- $link = mysql_connect($serveurbase, $loginbase, $passwordbase) or die ("Impossible de se connecter : " . mysql_error());
- mysql_select_db($database, $link);
- mysql_query("SET NAMES 'utf8'");
-
- $sql = "SELECT * FROM `Uploaded`";
-
- // on envoie la requête
- $req = mysql_query($sql) or die('Erreur SQL !'.$sql.''.mysql_error());
-
- // on fait une boucle qui va faire un tour pour chaque enregistrement
- while($data = mysql_fetch_assoc($req))
- {
- $ID = $data['ID'];
- $Fichier= $data['Fichier'];
- $Situation = $data['Situation'];
-
- array_push($rest, array("ID"=>$ID, "Fichier"=>$Fichier, "Situation"=>$Situation, "Vignette"=>''));
- }
- // on retourne le tableau
- return $rest;
- }
-
- 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)
- {
- $link = mysql_connect($serveurbase, $loginbase, $passwordbase) or die ("Impossible de se connecter : " . mysql_error());
- mysql_select_db($database, $link);
- mysql_query("SET NAMES 'utf8'");
-
- $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' )";
-
- $result=mysql_query($query);
-
- $result2=mysql_insert_id();
-
- return $result2;
- }
-
- function testPassword($User)
- {
- $rest = array();
-
- $database = "mathphysician";
- $serveurbase = "localhost";
- $loginbase = "mathphysician";
- $passwordbase = "imt09";
-
- $link = mysql_connect($serveurbase, $loginbase, $passwordbase) or die ("Impossible de se connecter : " . mysql_error());
- mysql_select_db($database, $link);
- mysql_query("SET NAMES 'utf8'");
-
- $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";
-
- $result=mysql_query($query);
-
- $result2=mysql_num_rows($result);
-
- if ($result2 == 1)
- {
- $data = mysql_fetch_assoc($result);
-
- $id = $data['ID'];
- $nom = $data['Nom'];
- $prenom= $data['Prenom'];
- $administrateur= $data['Administrateur'];
- $dateecheance = $data['DateEcheance'];
- $tentatives = $data['Tentatives'];
- $Email2 = $data['Email'];
- $prenom = $data['Prenom'];
- $hospital = $data['Hospital'];
- $adresse = $data['Adresse'];
- $cp = $data['CP'];
- $ville = $data['Ville'];
- $telephone = $data['Telephone'];
- $credits = $data['Credits'];
- $question1 = $data['indiceQuestion1'];
- $question2 = $data['indiceQuestion2'];
- $reponse1 = $data['Reponse1'];
- $reponse2 = $data['Reponse2'];
- $active = $data['Active'];
- /*
- if ($tentatives >= 5)
- {
- $id = 0;
- $nom = 'blockedaccount';
- $prenom= '';
- $administrateur= 0;
- $dateecheance = '';
- }
- else
- {
- */
- 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));
- /*
- if ($Email2 == $Email)
- {
- $tentatives = 0;
- $query="UPDATE utilisateurs SET Tentatives=$tentatives WHERE (Email = '$Email')";
- }
-
- $result5=mysql_query($query);
- }
- */
- }
- /* else
- {
- // Le login et le mot de passe ne correspondent pas
- $query = "SELECT Tentatives FROM utilisateurs WHERE (Email = '$Email') LIMIT 0,30000";
-
- $result3 = mysql_query($query);
- $result4 = mysql_num_rows($result3);
-
- if ($result4 >= 1)
- {
- $data3 = mysql_fetch_assoc($result3);
- $tentatives = $data3['Tentatives'];
- if ($tentatives >= 5)
- {
- $id = 0;
- $nom = 'maxtentatives';
- $prenom= '';
- $administrateur= 0;
- $dateecheance = '';
- }
- else
- {
- $tentatives++;
- $query="UPDATE utilisateurs SET Tentatives=$tentatives WHERE (Email = '$Email')";
- $result5=mysql_query($query);
-
- $id = 0;
- $nom = 'unknown';
- $prenom= '';
- $administrateur= 0;
- $dateecheance = '';
- }
- }
- */
- else
- {
- $id = 0;
- $nom = 'unknown';
- $prenom= '';
- $administrateur= 0;
- $dateecheance = '';
- $hospital = '';
- $adresse = '';
- $cp = '';
- $ville = '';
- $telephone = '';
- $credits = 0;
- $question1 = 0;
- $question2 = 0;
- $reponse1 = '';
- $reponse2 = '';
- $active = 0;
-
- 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));
- }
- // on retourne le tableau
- return $rest;
- }
-
- function getReponses($database, $serveurbase, $loginbase, $passwordbase, $Email)
- {
- $rest = array();
-
- $link = mysql_connect($serveurbase, $loginbase, $passwordbase) or die ("Impossible de se connecter : " . mysql_error());
- mysql_select_db($database, $link);
- mysql_query("SET NAMES 'utf8'");
-
- $query="SELECT ID, indiceQuestion1, indiceQuestion2, Reponse1, Reponse2 FROM utilisateurs WHERE (Email = '$Email') LIMIT 0,30000";
-
- $result=mysql_query($query);
-
- $result2=mysql_num_rows($result);
-
- if ($result2 == 1)
- {
- $data = mysql_fetch_assoc($result);
-
- $id = $data['ID'];
- $question1 = $data['indiceQuestion1'];
- $question2 = $data['indiceQuestion2'];
- $reponse1 = $data['Reponse1'];
- $reponse2 = $data['Reponse2'];
- }
- else
- {
- $id = 0;
- $question1 = 0;
- $question2 = 0;
- $reponse1 = '';
- $reponse2 = '';
- }
-
- array_push($rest, array("ID"=>$id, "Question1"=>$question1, "Question2"=>$question2, "Reponse1"=>$reponse1, "Reponse2"=>$reponse2));
-
- // on retourne le tableau
- return $rest;
- }
-
- function testEmail($database, $serveurbase, $loginbase, $passwordbase, $Email)
- {
- $link = mysql_connect($serveurbase, $loginbase, $passwordbase) or die ("Impossible de se connecter : " . mysql_error());
- mysql_select_db($database, $link);
- mysql_query("SET NAMES 'utf8'");
-
- $query = "SELECT Nom, Prenom FROM utilisateurs WHERE (Email = '$Email' AND Password <> '') LIMIT 0,30000";
-
- $result = mysql_query($query);
-
- $result2 = mysql_num_rows($result);
-
- return $result2;
- }
-
- function verifDemoDemandee($database, $serveurbase, $loginbase, $passwordbase, $Email, $Password)
- {
- $rest = array();
-
- $link = mysql_connect($serveurbase, $loginbase, $passwordbase) or die ("Impossible de se connecter : " . mysql_error());
- mysql_select_db($database, $link);
- mysql_query("SET NAMES 'utf8'");
-
- $query = "SELECT DemoDemandee FROM utilisateurs WHERE (Email = '$Email') LIMIT 0,30000";
-
- $result = mysql_query($query);
-
- $result2 = mysql_num_rows($result);
-
- if ($result2 > 0)
- {
- $data = mysql_fetch_assoc($result);
-
- $demo = $data['DemoDemandee'];
- }
- else
- {
- $demo = 0;
- }
-
- array_push($rest, array("DemoDemandee"=>$demo));
-
- return $rest;
- }
-
- function writeDemoDemandee($database, $serveurbase, $loginbase, $passwordbase, $Email, $Password)
- {
- $link = mysql_connect($serveurbase, $loginbase, $passwordbase) or die ("Impossible de se connecter : " . mysql_error());
- mysql_select_db($database, $link);
- mysql_query("SET NAMES 'utf8'");
-
- $query = "UPDATE utilisateurs SET DemoDemandee=1 WHERE (Email = '$Email')";
-
- $result = mysql_query($query);
-
- return 1;
- }
-
- function verifPromoDemandee($database, $serveurbase, $loginbase, $passwordbase, $Email, $Password)
- {
- $rest = array();
-
- $link = mysql_connect($serveurbase, $loginbase, $passwordbase) or die ("Impossible de se connecter : " . mysql_error());
- mysql_select_db($database, $link);
- mysql_query("SET NAMES 'utf8'");
-
- $query = "SELECT PromotionDemandee FROM utilisateurs WHERE (Email = '$Email') LIMIT 0,30000";
-
- $result = mysql_query($query);
-
- $result2 = mysql_num_rows($result);
-
- if ($result2 > 0)
- {
- $data = mysql_fetch_assoc($result);
-
- $promo = $data['PromotionDemandee'];
- }
- else
- {
- $promo = 0;
- }
-
- array_push($rest, array("PromotionDemandee"=>$promo));
-
- return $rest;
- }
-
- function writePromoDemandee($database, $serveurbase, $loginbase, $passwordbase, $Email, $Password)
- {
- $link = mysql_connect($serveurbase, $loginbase, $passwordbase) or die ("Impossible de se connecter : " . mysql_error());
- mysql_select_db($database, $link);
- mysql_query("SET NAMES 'utf8'");
-
- $query = "UPDATE utilisateurs SET PromotionDemandee=1 WHERE (Email = '$Email')";
-
- $result = mysql_query($query);
-
- return 1;
- }
-
- function getPassword($database, $serveurbase, $loginbase, $passwordbase, $Email)
- {
- $rest = array();
-
- $link = mysql_connect($serveurbase, $loginbase, $passwordbase) or die ("Impossible de se connecter : " . mysql_error());
- mysql_select_db($database, $link);
- mysql_query("SET NAMES 'utf8'");
-
- $query="SELECT Password FROM utilisateurs WHERE (Email = '$Email') LIMIT 0,30000";
-
- $result=mysql_query($query);
- $result2=mysql_num_rows($result);
-
- if ($result2 >= 1)
- {
- while($data = mysql_fetch_assoc($result))
- {
- $password = $data['Password'];
-
- array_push($rest, array("Password"=>$password));
- }
- }
- else
- {
- $password = '';
-
- array_push($rest, array("Password"=>$password));
- }
-
- // on retourne le tableau
- return $rest;
- }
-
- function insertLogin($database, $serveurbase, $loginbase, $passwordbase, $Email, $Date, $Action, $AdresseIP)
- {
- $link = mysql_connect($serveurbase, $loginbase, $passwordbase) or die ("Impossible de se connecter : " . mysql_error());
-
- mysql_select_db($database, $link);
- mysql_query("SET NAMES 'utf8'");
-
- $query="INSERT INTO login (Email, Date, Action, AdresseIP) VALUES ('$Email', '$Date', '$Action', '$AdresseIP')";
-
- $result=mysql_query($query);
- return result;
- }
-
- function selectUpload($database, $serveurbase, $loginbase, $passwordbase)
- {
- $link = mysql_connect($serveurbase, $loginbase, $passwordbase) or die ("Impossible de se connecter : " . mysql_error());
-
- mysql_select_db($database, $link);
- mysql_query("SET NAMES 'utf8'");
-
- // $query = "SELECT Fichier, Situation FROM uploaded WHERE ((Situation = 'CCA Right') OR (Situation = 'CCA Left')) LIMIT 0,30000";
- $query = "SELECT Fichier, Situation FROM uploaded WHERE (Situation <> '') LIMIT 0,30000";
-
- $result = mysql_query($query);
-
- return $result;
- }
-
- function insertPatient($database, $serveurbase, $loginbase, $passwordbase, $IDUtilisateur, $Nom, $Prenom, $Sexe, $DateDeNaissance, $Taille, $UniteTaille, $Poids, $UnitePoids, $Race, $PaysNaissance, $PaysActuel, $NbAnneesPaysActuel)
- {
- $link = mysql_connect($serveurbase, $loginbase, $passwordbase) or die ("Impossible de se connecter : " . mysql_error());
- mysql_select_db($database, $link);
- mysql_query("SET NAMES 'utf8'");
-
- $patients = 'patients'.$IDUtilisateur;
-
- $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')";
-
- $result = mysql_query($query);
-
- $result2 = mysql_insert_id();
-
- return $result2;
- }
-
- function saveJPEG($filename, $bytesArray)
- {
- $data = $bytesArray->data;
-
- file_put_contents("../../../uploader/myFileDir/" . $filename, $data);
-
- return '1';
- }
-
- function CreateDirectoryIfNotExist($dir1, $dir2, $dir3, $dir4, $dir5, $dir6)
- {
- if (!is_dir($dir1))
- {
- mkdir($dir1);
- chmod($dir1, 0777);
- }
-
- if (!is_dir($dir2))
- {
- mkdir($dir2);
- chmod($dir2, 0777);
- }
- if (!is_dir($dir3))
- {
- mkdir($dir3);
- chmod($dir3, 0777);
- }
-
- if (!is_dir($dir4))
- {
- mkdir($dir4);
- chmod($dir4, 0777);
- }
-
- if (!is_dir($dir5))
- {
- mkdir($dir5);
- chmod($dir5, 0777);
- }
-
- if (!is_dir($dir6))
- {
- mkdir($dir6);
- chmod($dir6, 0777);
- }
-
- return true;
- }
-
- // Fonction pour Ovh car chmod et filesize et file_exists fct pas sous Wamp
- function ArchiveImagesIntimaMedia($etude, $localhost, $clean1, $source1, $dest1, $clean2, $source2, $dest2, $clean3, $source3, $dest3, $clean4, $source4, $dest4, $clean5, $source5, $dest5, $clean6, $source6, $dest6)
- {
- /*
- $ret = '0';
- chmod($source1, 0777);
- chmod($source2, 0777);
- chmod($source3, 0777);
- chmod($source4, 0777);
- chmod($source5, 0777);
- chmod($source6, 0777);
-
- if (file_exists($source1) && file_exists($source2) && file_exists($source3) && file_exists($source4) && file_exists($source5) && file_exists($source6))
- {
- $s1 = filesize($source1);
- $s2 = filesize($source2);
- $s3 = filesize($source3);
- $s4 = filesize($source4);
- $s5 = filesize($source5);
- $s6 = filesize($source6);
-
- copy($source1, $dest1);
- copy($source2, $dest2);
- copy($source3, $dest3);
- copy($source4, $dest4);
- copy($source5, $dest5);
- copy($source6, $dest6);
- $ret = '1';
-
- // Vérification de la taille
- if (file_exists($dest1) && file_exists($dest2) && file_exists($dest3) && file_exists($dest4) && file_exists($dest5) && file_exists($dest6))
- {
- chmod($dest1, 0777);
- chmod($dest2, 0777);
- chmod($dest3, 0777);
- chmod($dest4, 0777);
- chmod($dest5, 0777);
- chmod($dest6, 0777);
-
- $d1 = filesize($dest1);
- $d2 = filesize($dest2);
- $d3 = filesize($dest3);
- $d4 = filesize($dest4);
- $d5 = filesize($dest5);
- $d6 = filesize($dest6);
-
- $ret = '2';
- if (($s1 == $d1) && ($s2 == $d2) && ($s3 == $d3) && ($s4 == $d4) && ($s5 == $d5) && ($s6 == $d6))
- {
- $ret = '3';
- if (($s1 > 0) && ($s2 > 0) && ($s3 > 0) && ($s4 > 0) && ($s5 > 0) && ($s6 > 0))
- {
- $ret = '4';
- }
- }
- }
- }
-
- return $ret;
- */
- $ret = '0';
- if ($etude == 256)
- {
- if (($dest1 != '') && ($source1 != ''))
- {
- copy($source1, $dest1);
- }
-
- if (($dest1 != '') && ($clean1 == 1))
- {
- unlink($dest1);
- }
-
- if (($dest2 != '') && ($source2 != ''))
- {
- copy($source2, $dest2);
- }
- if (($dest2 != '') && ($clean2 == 1))
- {
- unlink($dest2);
- }
-
- if (($dest3 != '') && ($source3 != ''))
- {
- copy($source3, $dest3);
- }
- if (($dest3 != '') && ($clean3 == 1))
- {
- unlink($dest3);
- }
-
- if (($dest4 != '') && ($source4 != ''))
- {
- copy($source4, $dest4);
- }
- if (($dest4 != '') && ($clean4 == 1))
- {
- unlink($dest4);
- }
-
- if (($dest5 != '') && ($source5 != ''))
- {
- copy($source5, $dest5);
- }
- if (($dest5 != '') && ($clean5 == 1))
- {
- unlink($dest5);
- }
-
- if (($dest6 != '') && ($source6 != ''))
- {
- copy($source6, $dest6);
- }
- if (($dest6 != '') && ($clean6 == 1))
- {
- unlink($dest6);
- }
- }
- else
- {
- // Pour Etude 0 et 1
- copy($source1, $dest1); // CCAR
- copy($source4, $dest4); // CCAL
-
- if (($etude == 1) || ($etude == 2)) // Pour Etude 1 et 2
- {
- copy($source2, $dest2);
- copy($source3, $dest3);
- copy($source5, $dest5);
- copy($source6, $dest6);
- }
- }
- $ret = '4';
-
- return $ret;
- }
-
- function ArchiveImagesLocalHost($source1, $dest1, $source2, $dest2, $source3, $dest3, $source4, $dest4, $source5, $dest5, $source6, $dest6)
- {
- $ret = '0';
- copy($source1, $dest1);
- copy($source2, $dest2);
- copy($source3, $dest3);
- copy($source4, $dest4);
- copy($source5, $dest5);
- copy($source6, $dest6);
-
- $ret = '4';
-
- return $ret;
- }
-
- function GetAdresseIP()
- {
- if (!empty($_SERVER['HTTP_CLIENT_IP'])) //check ip from share internet
- {
- $ip=$_SERVER['HTTP_CLIENT_IP'];
- }
- elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) //to check ip is pass from proxy
- {
- $ip=$_SERVER['HTTP_X_FORWARDED_FOR'];
- }
- else
- {
- $ip=$_SERVER['REMOTE_ADDR'];
- }
- return $ip;
- }
- function GetPathOvh()
- {
- return ($_SERVER['DOCUMENT_ROOT']);
- // return dirname(__FILE__);
- }
- function zipVisite($etude, $pdf, $img1, $img2, $img3, $img4, $img5, $img6, $zipName)
- {
- require( "ziplib/zip.lib.php" ); // librairie ZIP
-
- $zip = new zipfile () ; //on crée une instance zip
- // liste des fichiers à compresser
- // Pour Etude 0: uniquement img1 et img4
- $files = array ($img1, $img4, $img2, $img3, $img5, $img6 ) ;
- $f1 = basename($img1);
- $f4 = basename($img4);
- $f2 = basename($img2);
- $f3 = basename($img3);
- $f5 = basename($img5);
- $f6 = basename($img6);
-
- $filesname = array ($f1, $f4, $f2, $f3, $f5, $f6 ) ;
-
- $i = 0 ;
- while ( count( $files ) > $i )
- {
- if ((($etude == 0) && ($i < 2)) || ($etude == 1) || ($etude == 2) || ($etude == 256))
- {
- if ($filesname[$i] != '')
- {
- $zip->addfile(file_get_contents($files[$i]), $filesname[$i]) ; //on ajoute le fichier
- }
- }
- $i++; //on incrémente i
- }
- $pdfname = basename($pdf);
- $zip->addfile(file_get_contents($pdf), $pdfname); //on ajoute le fichier
-
- $archive = $zip->file() ; // on associe l'archive
-
- // on enregistre l'archive dans un fichier
- $open = fopen( $zipName , "wb");
- fwrite($open, $archive);
- fclose($open);
- }
-
- function zipVisite2($pdf, $img1, $img2, $img3, $img4, $img5, $img6, $zipName)
- {
- echo system("zip -P 1234 -j $zipName \"$pdf\"");
- }
-
- function testFilePdfCreated($pdf)
- {
- if (file_exists($pdf))
- {
- return '1';
- }
- else
- {
- return '0';
- }
- }
- function testFilePdfCreated2($pdf)
- {
- if (file_exists($pdf))
- {
- return '1';
- }
- else
- {
- return '0';
- }
- }
-
- function sendForgetPassword($name, $from, $subject, $emailMessage)
- {
- include_once('class.phpmailer.php');
-
- $mail = new PHPMailer();
- $body = $emailMessage;
- $body = eregi_replace("[\]",'',$body);
- $mail->IsSendmail(); // telling the class to use SendMail transport
- $mail->From = $from;
- $mail->FromName = $from;
- $mail->Subject = $subject;
- $mail->AltBody = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test
- $mail->MsgHTML($body);
- $mail->AddAddress($name, 'Support');
-
- if(!$mail->Send())
- {
- return '0';
- }
- else
- {
- return '1';
- }
- }
-
- function sendEmailLogin($name, $from, $subject, $emailMessage)
- {
- include_once('class.phpmailer.php');
-
- $mail = new PHPMailer();
- $body = $emailMessage;
- $body = eregi_replace("[\]",'',$body);
- $mail->IsSendmail(); // telling the class to use SendMail transport
- $mail->From = $from;
- $mail->FromName = $from;
- $mail->Subject = $subject;
- $mail->AltBody = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test
- $mail->MsgHTML($body);
- $mail->AddAddress($name, 'Support');
-
- if(!$mail->Send())
- {
- return '0';
- }
- else
- {
- return '1';
- }
- }
-
- function sendVisite($ndest, $zipname, $to1, $to2, $to3, $from, $subject, $emailMessage)
- {
- include_once('class.phpmailer.php');
- $mail = new PHPMailer();
- $body = $emailMessage;
- $body = eregi_replace("[\]",'',$body);
- $mail->IsSendmail(); // telling the class to use SendMail transport
- $mail->From = $from;
- $mail->FromName = $from;
- $mail->Subject = $subject;
- $mail->AltBody = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test
- $mail->MsgHTML($body);
- //$mail->AddAddress($to1, "Dest 1");
- if ($ndest > 1)
- {
- $mail->AddAddress($to2, "Dest 2");
- $mail->AddAddress($to3, "Dest 3");
- }
-
- $mail->AddAttachment($zipname); // attachment
-
- if (!$mail->Send())
- {
- return '0';
- }
- else
- {
- return '1';
- }
- }
-
- function sendVisiteCtrl($to1, $from, $subject, $emailMessage)
- {
- include_once('class.phpmailer.php');
- $mail = new PHPMailer();
- $body = $emailMessage;
- $body = eregi_replace("[\]",'',$body);
- $mail->IsSendmail(); // telling the class to use SendMail transport
- $mail->From = $from;
- $mail->FromName = $from;
- $mail->Subject = $subject;
- $mail->AltBody = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test
- $mail->MsgHTML($body);
- $mail->AddAddress($to1, "Dest 1");
-
- if(!$mail->Send())
- {
- return '0';
- }
- else
- {
- return '1';
- }
- }
-
- function sendInscription($to1, $to2, $from, $subject, $emailMessage)
- {
- include_once('class.phpmailer.php');
- $mail = new PHPMailer();
- $body = $emailMessage;
- $body = eregi_replace("[\]",'',$body);
- $mail->IsSendmail(); // telling the class to use SendMail transport
- $mail->From = $from;
- $mail->FromName = $from;
- $mail->Subject = $subject;
- $mail->AltBody = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test
- $mail->MsgHTML($body);
- $mail->AddAddress($to1, "Dest 1");
- $mail->AddAddress($to2, "Dest 2");
-
- if (!$mail->Send())
- {
- return '0';
- }
- else
- {
- return '1';
- }
- }
-
- // Fonction qui renvoie la date du serveur
- function GetDateServeur()
- {
- $today = date("d-m")."-20".date('y')." ".date('H:i');
-
- return ($today);
- }
-
- function getIDPatient($database, $serveurbase, $loginbase, $passwordbase, $prenompatient_c, $nompatient_c, $datedenaissance_c, $idutilisateur, $key, $commercial)
- {
- $rest = array();
-
- $id = 0;
- $tpatients = 'patients'.$idutilisateur;
-
- $link = mysql_connect($serveurbase, $loginbase, $passwordbase) or die ("Impossible de se connecter : " . mysql_error());
- mysql_select_db($database, $link);
- mysql_query("SET NAMES 'utf8'");
-
- /* $crypt = new encryption_class;
-
- if ($commercial == '1')
- {
- $nompatient = $crypt->encrypt($key, $nompatient_c);
- $prenompatient = $crypt->encrypt($key, $prenompatient_c);
- $datedenaissance = $crypt->encrypt($key, $datedenaissance_c);
- }
- else
- {
- */
- $nompatient = $nompatient_c;
- $prenompatient = $prenompatient_c;
- $datedenaissance = $datedenaissance_c;
- // }
- // Récupère l'ID patient
- // ivrs est un text
- $query = "SELECT ID FROM $tpatients WHERE (Nom = '$nompatient' AND Prenom = '$prenompatient' AND DateDeNaissance = '$datedenaissance') LIMIT 0,30000";
-
- $result = mysql_query($query);
-
- $result2 = mysql_num_rows($result);
- if ($result2 >= 1)
- {
- while($data = mysql_fetch_assoc($result))
- {
- $id = $data['ID'];
-
- array_push($rest, array("ID"=>$id));
- }
- }
- else
- {
- $id = 0;
-
- array_push($rest, array("ID"=>$id));
- }
- // on retourne le tableau
- return $rest;
- }
- 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)
- {
- $link = mysql_connect($serveurbase, $loginbase, $passwordbase) or die ("Impossible de se connecter : " . mysql_error());
- mysql_select_db($database, $link);
- mysql_query("SET NAMES 'utf8'");
-
- $trendezvous = 'rendezvous'.$idutilisateur;
- $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";
-
- $result = mysql_query($query);
-
- $id = mysql_insert_id();
-
- return $id;
- }
-
- 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)
- {
- $rest = array();
- $id = 0;
-
- $idvisite = 0;
-
- $tpatients = 'patients'.$idutilisateur;
- $trendezvous = 'rendezvous'.$idutilisateur;
-
- /*
- $crypt = new encryption_class;
- if ($commercial == '1')
- {
- $nompatient = $crypt->encrypt($key, $nompatient_c);
- $prenompatient = $crypt->encrypt($key, $prenompatient_c);
- $datedenaissance = $crypt->encrypt($key, $datedenaissance_c);
- }
- else
- {
- */
- $nompatient = $nompatient_c;
- $prenompatient = $prenompatient_c;
- $datedenaissance = $datedenaissance_c;
- // }
-
- $link = mysql_connect($serveurbase, $loginbase, $passwordbase) or die ("Impossible de se connecter : " . mysql_error());
- mysql_select_db($database, $link);
- mysql_query("SET NAMES 'utf8'");
-
- // Récupère l'ID patient
- // ivrs est un text
-
- // $query = "SELECT ID FROM $tpatients WHERE (Nom = '$nompatient' AND Prenom = '$prenompatient' AND Sexe = '$sexe' AND DateDeNaissance = '$datedenaissance' AND IVRS = '$ivrs') LIMIT 0,30000";
- if ($physician == 1)
- {
- $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";
- }
- else
- {
- $query = "SELECT ID FROM $tpatients WHERE (Nom = '$nompatient' AND Prenom = '$prenompatient' AND Sexe = '$sexe' AND DateDeNaissance = '$datedenaissance') LIMIT 0,30000";
- }
-
- $result = mysql_query($query);
-
- $result2 = mysql_num_rows($result);
- if ($result2 > 0)
- {
- while($data = mysql_fetch_assoc($result))
- {
- $id = $data['ID'];
- }
- }
- else
- {
- // Ecriture du patient
- // Sans les '' autour des variables texte, ça ne marche pas
- $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')";
-
- $result = mysql_query($query);
-
- $id = mysql_insert_id();
- }
-
- if ($id > 0)
- {
- // Récupère l'ID visite
- $query="SELECT ID FROM $trendezvous WHERE (IDPatient = $id AND Visite = $visitnumber) LIMIT 0,30000";
-
- $result=mysql_query($query);
-
- $result2 = mysql_num_rows($result);
-
- if ($result2 == 0) // La visite n'existe pas déja
- {
- // Ecriture du rendez vous
- if ($physician == 1)
- {
- $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')";
- }
- else
- {
- $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')";
- }
-
- $result=mysql_query($query);
- $idvisite = mysql_insert_id();
-
- // Pour détecter la création d'une visite
- $idvisite = $idvisite * -1;
- }
- }
-
- return $idvisite;
- }
- 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)
- {
- $rest = array();
-
- $id = 0;
-
- $idvisite = 0;
-
- $tpatients = 'patients'.$idutilisateur;
- $trendezvous = 'rendezvous'.$idutilisateur;
-
- /* $crypt = new encryption_class;
-
- if ($commercial == '1')
- {
- $nompatient = $crypt->encrypt($key, $nompatient_c);
- $prenompatient = $crypt->encrypt($key, $prenompatient_c);
- $datedenaissance = $crypt->encrypt($key, $datedenaissance_c);
- }
- else
- {
- */
- $nompatient = $nompatient_c;
- $prenompatient = $prenompatient_c;
- $datedenaissance = $datedenaissance_c;
- // }
-
- $link = mysql_connect($serveurbase, $loginbase, $passwordbase) or die ("Impossible de se connecter : " . mysql_error());
- mysql_select_db($database, $link);
- mysql_query("SET NAMES 'utf8'");
-
- // Récupère l'ID patient
- // ivrs est un text
- $query = "SELECT ID FROM $tpatients WHERE (Nom = '$nompatient' AND Prenom = '$prenompatient' AND Sexe = '$sexe' AND IVRS = '$ivrs') LIMIT 0,30000";
-
- $result = mysql_query($query);
-
- $result2 = mysql_num_rows($result);
- if ($result2 > 0)
- {
- while($data = mysql_fetch_assoc($result))
- {
- $id = $data['ID'];
- }
- }
- else
- {
- // Ecriture du patient
- $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')";
-
- $result = mysql_query($query);
-
- $id = mysql_insert_id();
- }
-
- if ($id > 0)
- {
- // Récupère l'ID visite
- $query="SELECT ID FROM $trendezvous WHERE (IDPatient = $id AND Visite = $visitnumber) LIMIT 0,30000";
-
- $result=mysql_query($query);
-
- $result2 = mysql_num_rows($result);
-
- // if ($result2 == 0) // La visite n'existe pas déja
- // {
- // Ecriture du rendez vous
- $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')";
- $result=mysql_query($query);
- $idvisite = mysql_insert_id();
-
- // Pour détecter la création d'une visite
- $idvisite = $idvisite * -1;
- // }
- }
-
- return $idvisite;
- }
-
- // Test si une mesure existe pour la même situation et le même type de mesure
- function testMeasureCreated($database, $serveurbase, $loginbase, $passwordbase, $idrendezvous, $typemesure, $situation, $side, $idutilisateur)
- {
- $mesures = 'mesures'.$idutilisateur;
-
- $link = mysql_connect($serveurbase, $loginbase, $passwordbase) or die ("Impossible de se connecter : " . mysql_error());
- mysql_select_db($database, $link);
- mysql_query("SET NAMES 'utf8'");
-
- // Récupère l'ID patient
- $query = "SELECT ID FROM $mesures WHERE (IDRendezVous = $idrendezvous AND TypeMesure = $typemesure AND Situation = '$situation' AND Side = '$side') LIMIT 0,30000";
-
- $result = mysql_query($query);
-
- $result2 = mysql_num_rows($result);
-
- return $result2;
- }
- function deleteMeasure($database, $serveurbase, $loginbase, $passwordbase, $idrendezvous, $typemesure, $situation, $side, $idutilisateur)
- {
- $mesures = 'mesures'.$idutilisateur;
-
- $link = mysql_connect($serveurbase, $loginbase, $passwordbase) or die ("Impossible de se connecter : " . mysql_error());
- mysql_select_db($database, $link);
- mysql_query("SET NAMES 'utf8'");
-
- // Récupère l'ID patient
- $query = "DELETE FROM $mesures WHERE (IDRendezVous = $idrendezvous AND TypeMesure = $typemesure AND Situation = '$situation' AND Side = '$side')";
-
- $result = mysql_query($query);
-
- $result2 = mysql_num_rows($result);
-
- return $result2;
- }
-
- // Mise à jour ou insertion d'une nouvelle mesure
- 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)
- {
- $idmesure = 0;
- $mesures = 'mesures'.$idutilisateur;
-
- $link = mysql_connect($serveurbase, $loginbase, $passwordbase) or die ("Impossible de se connecter : " . mysql_error());
- mysql_select_db($database, $link);
- mysql_query("SET NAMES 'utf8'");
-
- // Test si la mesure existe déja
- // Pour SELECT Sur des int, ne pas mettre les ' '
- $query = "SELECT ID FROM $mesures WHERE (IDRendezVous = $idrendezvous AND TypeMesure = $typemesure AND Situation = '$situation' AND Side = '$side') LIMIT 0,30000";
-
- $result = mysql_query($query);
-
- $result2 = mysql_num_rows($result);
-
- if ($result2 == 1)
- {
- while($data = mysql_fetch_assoc($result))
- {
- $idmesure = $data['ID'];
- }
- }
- if ($idmesure > 0) // Si la ligne existe déja on la modifie
- {
- $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";
-
- $result = mysql_query($query);
- }
- else // Sinon on l'insert
- {
- $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')";
-
- $result = mysql_query($query);
- $idmesure = mysql_insert_id();
- }
-
- return $idmesure;
- }
-
- // Supprime les graphiques pour un rendez vous donné
- function cleanGraphiques($database, $serveurbase, $loginbase, $passwordbase, $idrendezvous, $idutilisateur)
- {
- $link = mysql_connect($serveurbase, $loginbase, $passwordbase) or die ("Impossible de se connecter : " . mysql_error());
- mysql_select_db($database, $link);
- mysql_query("SET NAMES 'utf8'");
-
- $tgraphiques = 'graphiques'.$idutilisateur;
-
- $query = "DELETE FROM $tgraphiques WHERE (IDRendezVous = $idrendezvous)";
-
- $result = mysql_query($query);
- return true;
- }
- // Insertion d'un nouveau graphique
- function insertGraphique($database, $serveurbase, $loginbase, $passwordbase, $idrendezvous, $typegraphique, $situation, $side, $x, $y, $idutilisateur)
- {
- $link = mysql_connect($serveurbase, $loginbase, $passwordbase) or die ("Impossible de se connecter : " . mysql_error());
- mysql_select_db($database, $link);
- mysql_query("SET NAMES 'utf8'");
-
- $tgraphiques = 'graphiques'.$idutilisateur;
-
- $query = "INSERT INTO $tgraphiques (IDRendezVous, TypeGraphique, Situation, Side, x, y) VALUES ('$idrendezvous', '$typegraphique', '$situation', '$side', '$x', '$y')";
-
- $result = mysql_query($query);
- $idgraphique = mysql_insert_id();
-
- return $idgraphique;
- }
-
- // Création des Tables Pour un utilisateur donné
- // Pour les instructions de création, exporter la base, puis copier/coller
- function createTables($database, $serveurbase, $loginbase, $passwordbase, $idutiliseur)
- {
- $link = mysql_connect($serveurbase, $loginbase, $passwordbase) or die ("Impossible de se connecter : " . mysql_error());
- mysql_select_db($database, $link);
- mysql_query("SET NAMES 'utf8'");
-
- // Création de la table Patients
- $tpatients = 'patients'.$idutiliseur;
-
- $query="CREATE TABLE IF NOT EXISTS $tpatients (
- `ID` int(11) NOT NULL AUTO_INCREMENT,
- `IDUtilisateur` int(11) NOT NULL,
- `IVRS` varchar(30) character set utf8 collate utf8_unicode_ci NOT NULL,
- `Nom` varchar(30) character set utf8 collate utf8_unicode_ci NOT NULL,
- `Prenom` varchar(30) character set utf8 collate utf8_unicode_ci NOT NULL,
- `Sexe` varchar(10) character set utf8 collate utf8_unicode_ci NOT NULL,
- `DateDeNaissance` varchar(30) character set utf8 collate utf8_unicode_ci NOT NULL,
- `Taille` int(11) NOT NULL,
- `UniteTaille` varchar(10) character set utf8 collate utf8_unicode_ci NOT NULL,
- `Poids` int(11) NOT NULL,
- `UnitePoids` varchar(10) character set utf8 collate utf8_unicode_ci NOT NULL,
- `Race` varchar(30) character set utf8 collate utf8_unicode_ci NOT NULL,
- `PaysNaissance` varchar(30) character set utf8 collate utf8_unicode_ci NOT NULL,
- `PaysActuel` varchar(30) character set utf8 collate utf8_unicode_ci NOT NULL,
- `NBAnneesPaysActuel` int(11) NOT NULL,
- PRIMARY KEY (`ID`)
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE = utf8_unicode_ci AUTO_INCREMENT=355 ;";
- $result = mysql_query($query);
-
- // Création de la table Mesures
- $tmesures = 'mesures'.$idutiliseur;
-
- $query = "CREATE TABLE IF NOT EXISTS $tmesures (
- `ID` int(11) NOT NULL AUTO_INCREMENT,
- `IDRendezVous` int(11) NOT NULL,
- `TypeMesure` int(11) NOT NULL,
- `Situation` varchar(30) character set utf8 collate utf8_unicode_ci NOT NULL,
- `Side` varchar(30) character set utf8 collate utf8_unicode_ci NOT NULL,
- `Echelle` double NOT NULL,
- `NomEchelle` varchar(30) character set utf8 collate utf8_unicode_ci NOT NULL,
- `LongueurEchelle` int(11) NOT NULL,
- `x1Echelle` int(11) NOT NULL,
- `y1Echelle` int(11) NOT NULL,
- `x2Echelle` int(11) NOT NULL,
- `y2Echelle` int(11) NOT NULL,
- `Etendue` double NOT NULL,
- `Min` double NOT NULL,
- `Moy` double NOT NULL,
- `Max` double NOT NULL,
- `IQ_Densite` double NOT NULL,
- `StandartDeviation` double NOT NULL,
- `NumberOfPoints` int(11) NOT NULL,
- `x1` int(11) NOT NULL,
- `y1` int(11) NOT NULL,
- `x2` int(11) NOT NULL,
- `y2` int(11) NOT NULL,
- `NumberOfPlaques` int(11) NOT NULL,
- `NumberOfStenosis` int(11) NOT NULL,
- `StenosisAngle` int(11) NOT NULL,
- `NumberOfOcclusions` int(11) NOT NULL,
- PRIMARY KEY (`ID`)
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE = utf8_unicode_ci AUTO_INCREMENT=291 ;";
-
- $result = mysql_query($query);
-
- // Création de la table Patients
- $rendezvous = 'rendezvous'.$idutiliseur;
-
- $query="CREATE TABLE IF NOT EXISTS $rendezvous (
- `ID` int(11) NOT NULL AUTO_INCREMENT,
- `IDPatient` int(11) NOT NULL,
- `Visite` int(11) NOT NULL,
- `Mesures` int(11) NOT NULL,
- `Images` int(11) NOT NULL,
- `Sequences` int(11) NOT NULL,
- `Date` varchar(30) character set utf8 collate utf8_unicode_ci NOT NULL,
- `HighBloodPressure` varchar(10) character set utf8 collate utf8_unicode_ci NOT NULL,
- `NbHighBloodPressure` int(11) NOT NULL,
- `Hypercholesterolemia` varchar(10) character set utf8 collate utf8_unicode_ci NOT NULL,
- `NbHypercholesterolemia` int(11) NOT NULL,
- `Diabetes` varchar(10) character set utf8 collate utf8_unicode_ci NOT NULL,
- `NbDiabetes` int(11) NOT NULL,
- `Hypertriglyceridemia` varchar(10) character set utf8 collate utf8_unicode_ci NOT NULL,
- `NbHypertriglyceridemia` int(11) NOT NULL,
- `Smoking` varchar(10) character set utf8 collate utf8_unicode_ci NOT NULL,
- `NbCigarettesDay` int(11) NOT NULL,
- `NbYearSmoking` int(11) NOT NULL,
- `CoronaryHeartDisease` varchar(10) character set utf8 collate utf8_unicode_ci NOT NULL,
- `TypeCoronaryHearDisease` varchar(30) character set utf8 collate utf8_unicode_ci NOT NULL,
- `IschemicStroke` varchar(10) character set utf8 collate utf8_unicode_ci NOT NULL,
- `NbIschemicStroke` int(11) NOT NULL,
- `TypeIschelicStroke` varchar(30) character set utf8 collate utf8_unicode_ci NOT NULL,
- `EtiologyIschemicStroke` varchar(30) character set utf8 collate utf8_unicode_ci NOT NULL,
- `BloodPressureRightArm` int(11) NOT NULL,
- `BloodPressureLeftArm` int(11) NOT NULL,
- `HeartRate` int(11) NOT NULL,
- `Arrhytmia` varchar(10) character set utf8 collate utf8_unicode_ci NOT NULL,
- `AntiHypertensive` varchar(10) character set utf8 collate utf8_unicode_ci NOT NULL,
- `AntiHypertensiveName1` varchar(30) character set utf8 collate utf8_unicode_ci NOT NULL,
- `AntiHypertensivePosology1` varchar(30) character set utf8 collate utf8_unicode_ci NOT NULL,
- `AntiHypertensiveStartingDate1` varchar(30) character set utf8 collate utf8_unicode_ci NOT NULL,
- `AntiHypertensiveName2` varchar(30) character set utf8 collate utf8_unicode_ci NOT NULL,
- `AntiHypertensivePosology2` varchar(30) character set utf8 collate utf8_unicode_ci NOT NULL,
- `AntiHypertensiveStartingDate2` varchar(30) character set utf8 collate utf8_unicode_ci NOT NULL,
- `AntiHypertensiveName3` varchar(30) character set utf8 collate utf8_unicode_ci NOT NULL,
- `AntiHypertensivePosology3` varchar(30) character set utf8 collate utf8_unicode_ci NOT NULL,
- `AntiHypertensiveStartingDate3` varchar(30) character set utf8 collate utf8_unicode_ci NOT NULL,
- `Hypolipidemic` varchar(10) character set utf8 collate utf8_unicode_ci NOT NULL,
- `HypolipidemicName1` varchar(30) character set utf8 collate utf8_unicode_ci NOT NULL,
- `HypolipidemicPosology1` varchar(30) character set utf8 collate utf8_unicode_ci NOT NULL,
- `HypolipidemicStartingDate1` varchar(30) character set utf8 collate utf8_unicode_ci NOT NULL,
- `HypolipidemicName2` varchar(30) character set utf8 collate utf8_unicode_ci NOT NULL,
- `HypolipidemicPosology2` varchar(30) character set utf8 collate utf8_unicode_ci NOT NULL,
- `HypolipidemicStartingDate2` varchar(30) character set utf8 collate utf8_unicode_ci NOT NULL,
- `HypolipidemicName3` varchar(30) character set utf8 collate utf8_unicode_ci NOT NULL,
- `HypolipidemicPosology3` varchar(30) character set utf8 collate utf8_unicode_ci NOT NULL,
- `HypolipidemicStartingDate3` varchar(30) character set utf8 collate utf8_unicode_ci NOT NULL,
- `Antidiabetis` varchar(10) character set utf8 collate utf8_unicode_ci NOT NULL,
- `AntidiabetisName1` varchar(30) character set utf8 collate utf8_unicode_ci NOT NULL,
- `AntidiabetisPosology1` varchar(30) character set utf8 collate utf8_unicode_ci NOT NULL,
- `AntidiabetisStartingDate1` varchar(30) character set utf8 collate utf8_unicode_ci NOT NULL,
- `AntidiabetisName2` varchar(30) character set utf8 collate utf8_unicode_ci NOT NULL,
- `AntidiabetisPosology2` varchar(30) character set utf8 collate utf8_unicode_ci NOT NULL,
- `AntidiabetisStartingDate2` varchar(30) character set utf8 collate utf8_unicode_ci NOT NULL,
- `AntidiabetisName3` varchar(30) character set utf8 collate utf8_unicode_ci NOT NULL,
- `AntidiabetisPosology3` varchar(30) character set utf8 collate utf8_unicode_ci NOT NULL,
- `AntidiabetisStartingDate3` varchar(30) character set utf8 collate utf8_unicode_ci NOT NULL,
- `AntiThrombotic` varchar(10) character set utf8 collate utf8_unicode_ci NOT NULL,
- `AntiThromboticName1` varchar(30) character set utf8 collate utf8_unicode_ci NOT NULL,
- `AntiThromboticPosology1` varchar(30) character set utf8 collate utf8_unicode_ci NOT NULL,
- `AntiThromboticStartingDate1` varchar(30) character set utf8 collate utf8_unicode_ci NOT NULL,
- `AntiThromboticName2` varchar(30) character set utf8 collate utf8_unicode_ci NOT NULL,
- `AntiThromboticPosology2` varchar(30) character set utf8 collate utf8_unicode_ci NOT NULL,
- `AntiThromboticStartingDate2` varchar(30) character set utf8 collate utf8_unicode_ci NOT NULL,
- `AntiThromboticName3` varchar(30) character set utf8 collate utf8_unicode_ci NOT NULL,
- `AntiThromboticPosology3` varchar(30) character set utf8 collate utf8_unicode_ci NOT NULL,
- `AntithromboticStartingDate3` varchar(30) character set utf8 collate utf8_unicode_ci NOT NULL,
- `Autre` varchar(10) character set utf8 collate utf8_unicode_ci NOT NULL,
- `AutreName1` varchar(30) character set utf8 collate utf8_unicode_ci NOT NULL,
- `AutrePosology1` varchar(30) character set utf8 collate utf8_unicode_ci NOT NULL,
- `AutreStartingDate1` varchar(30) character set utf8 collate utf8_unicode_ci NOT NULL,
- `AutreName2` varchar(30) character set utf8 collate utf8_unicode_ci NOT NULL,
- `AutrePosology2` varchar(30) character set utf8 collate utf8_unicode_ci NOT NULL,
- `AutreStartingDate2` varchar(30) character set utf8 collate utf8_unicode_ci NOT NULL,
- `AutreName3` varchar(30) character set utf8 collate utf8_unicode_ci NOT NULL,
- `AutrePosology3` varchar(30) character set utf8 collate utf8_unicode_ci NOT NULL,
- `AutreStartingDate3` varchar(30) character set utf8 collate utf8_unicode_ci NOT NULL,
- `NotesPatient` varchar(1024) character set utf8 collate utf8_unicode_ci NOT NULL,
- PRIMARY KEY (`ID`)
- )ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE = utf8_unicode_ci AUTO_INCREMENT=437 ;";
-
- $result = mysql_query($query);
-
- // Création de la table Graphiques
- $tgraphiques = 'graphiques'.$idutiliseur;
-
- $query="CREATE TABLE IF NOT EXISTS $tgraphiques (
- `ID` int(11) NOT NULL AUTO_INCREMENT,
- `IDRendezVous` int(11) NOT NULL,
- `TypeGraphique` int(11) NOT NULL,
- `Situation` varchar(30) character set utf8 collate utf8_unicode_ci NOT NULL,
- `Side` varchar(30) character set utf8 collate utf8_unicode_ci NOT NULL,
- `x` int(11) NOT NULL,
- `y` int(11) NOT NULL,
- PRIMARY KEY (`ID`)
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE = utf8_unicode_ci AUTO_INCREMENT=1 ;";
-
- $result = mysql_query($query);
- // Création de la table Crédits
- $tcredits = 'credits'.$idutiliseur;
-
- $query="CREATE TABLE IF NOT EXISTS $tcredits (
- `ID` int(11) NOT NULL AUTO_INCREMENT,
- `Date` varchar(30) collate utf8_unicode_ci NOT NULL,
- `AdresseIP` varchar(30) collate utf8_unicode_ci NOT NULL,
- `TypeCredit` varchar(30) collate utf8_unicode_ci NOT NULL,
- `IDPatient` int(11) NOT NULL,
- `IDRendezVous` int(11) NOT NULL,
- `IDMesure` int(11) NOT NULL,
- PRIMARY KEY (`ID`)
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE = utf8_unicode_ci AUTO_INCREMENT=1 ;";
-
- $result = mysql_query($query);
- }
-
- // Recherche de tous les patients pour un utilisateur donné
- function searchPatients($database, $serveurbase, $loginbase, $passwordbase, $idutilisateur, $key, $commercial)
- {
- $rest = array();
- // $crypt = new encryption_class;
- $link = mysql_connect($serveurbase, $loginbase, $passwordbase) or die ("Impossible de se connecter : " . mysql_error());
- mysql_select_db($database, $link);
- mysql_query("SET NAMES 'utf8'");
-
- $tpatients = 'patients'.$idutilisateur;
- $trendezvous = 'rendezvous'.$idutilisateur;
- $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";
- $result = mysql_query($query);
- $result2 = mysql_num_rows($result);
- if ($result2 >= 1)
- {
- while($data = mysql_fetch_assoc($result))
- {
- $id = $data['ID'];
- $ivrs = $data['IVRS'];
- $nom_c = $data['Nom'];
- $prenom_c = $data['Prenom'];
- $sexe = $data['Sexe'];
- $datedenaissance_c = $data['DateDeNaissance'];
- $dateLastVisite = $data['myDate'];
- // $searchIndex = $data['Nom'].', '.$data['Prenom'];
- $searchIndex = $data['Nom'].$data['Prenom'];
-
- /* if ($commercial == '1')
- {
- $nom = $crypt->decrypt($key, $nom_c);
- $prenom = $crypt->decrypt($key, $prenom_c);
- $datedenaissance = $crypt->decrypt($key, $datedenaissance_c);
-
- }
- else
- {
- */
- $nom = $nom_c;
- $prenom = $prenom_c;
- $datedenaissance = $datedenaissance_c;
-
- // }
-
- array_push($rest, array("ID"=>$id, "IVRS"=>$ivrs, "Nom"=>$nom, "Prenom"=>$prenom, "Sexe"=>$sexe, "DateDeNaissance"=>$datedenaissance, "DateLastVisite"=>$dateLastVisite, "SearchIndex"=>$searchIndex));
- }
- }
- else
- {
- $id = 0;
- $ivrs = '';
- $nom = '';
- $prenom = '';
- $sexe = '';
- $datedenaissance = '';
- $dateLastVisite = '';
- $searchIndex = '';
-
- array_push($rest, array("ID"=>$id, "IVRS"=>$ivrs, "Nom"=>$nom, "Prenom"=>$prenom, "Sexe"=>$sexe, "DateDeNaissance"=>$datedenaissance, "DateLastVisite"=>$dateLastVisite, "SearchIndex"=>$searchIndex));
- }
- // on retourne le tableau
- return $rest;
- }
- // Recherche de tous les visites d'un patient pour un utilisateur donné
- function searchVisites($database, $serveurbase, $loginbase, $passwordbase, $idpatient, $idutiliseur)
- {
- $rest = array();
-
- $link = mysql_connect($serveurbase, $loginbase, $passwordbase) or die ("Impossible de se connecter : " . mysql_error());
- mysql_select_db($database, $link);
- mysql_query("SET NAMES 'utf8'");
-
- $rendezvous = 'rendezvous'.$idutiliseur;
-
- $query = "SELECT ID, Visite, Date FROM $rendezvous WHERE (IDPatient = $idpatient) ORDER BY Visite DESC LIMIT 0,30000";
-
- $result = mysql_query($query);
-
- $result2 = mysql_num_rows($result);
- if ($result2 >= 1)
- {
- while($data = mysql_fetch_assoc($result))
- {
- $id = $data['ID'];
- $visite = $data['Visite'];
- $date = $data['Date'];
-
- array_push($rest, array("ID"=>$id, "Visite"=>$visite, "Date"=>$date));
- }
- }
- else
- {
- $id = 0;
- $visite = '';
- $date = '';
- array_push($rest, array("ID"=>$id, "Visite"=>$visite, "Date"=>$date));
- }
- // on retourne le tableau
- return $rest;
- }
-
- // Récupère toutes les données pour un patient sélectionné
- function getPatient($database, $serveurbase, $loginbase, $passwordbase, $idpatient, $idutiliseur, $key, $commercial)
- {
- $rest = array();
-
- $link = mysql_connect($serveurbase, $loginbase, $passwordbase) or die ("Impossible de se connecter : " . mysql_error());
- mysql_select_db($database, $link);
- mysql_query("SET NAMES 'utf8'");
-
- $patients = 'patients'.$idutiliseur;
- $query = "SELECT IVRS, Nom, Prenom, Sexe, DateDeNaissance, Taille, UniteTaille, Poids, UnitePoids, Race, PaysNaissance, PaysActuel, NBAnneesPaysActuel FROM $patients WHERE (ID = $idpatient) LIMIT 0,30000";
- $result = mysql_query($query);
-
- $result2 = mysql_num_rows($result);
- // $crypt = new encryption_class;
- if ($result2 >= 1)
- {
- while($data = mysql_fetch_assoc($result))
- {
- $ivrs = $data['IVRS'];
- $nom_c = $data['Nom'];
- $prenom_c = $data['Prenom'];
- $sexe = $data['Sexe'];
- $datedenaissance_c = $data['DateDeNaissance'];
- $taille = $data['Taille'];
- $unitetaille = $data['UniteTaille'];
- $poids = $data['Poids'];
- $unitepoids = $data['UnitePoids'];
- $race = $data['Race'];
- $paysnaissance = $data['PaysNaissance'];
- $paysactuel = $data['PaysActuel'];
- $nbanneespaysactuel = $data['NBAnneesPaysActuel'];
- /* if ($commercial == '1')
- {
- $nom = $crypt->decrypt($key, $nom_c);
- $prenom = $crypt->decrypt($key, $prenom_c);
- $datedenaissance = $crypt->decrypt($key, $datedenaissance_c);
- }
- else
- {
- */
- $nom = $nom_c;
- $prenom = $prenom_c;
- $datedenaissance = $datedenaissance_c;
- // }
- 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));
- }
- }
- else
- {
- $ivrs = '';
- $nom = '';
- $prenom = '';
- $sexe = '';
- $datedenaissance = '';
- $taille = '';
- $unitetaille = '';
- $poids = '';
- $unitepoids = '';
- $race = '';
- $paysnaissance = '';
- $paysactuel = '';
- $nbanneespaysactuel = '';
-
- 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));
- }
-
- // on retourne le tableau
- return $rest;
- }
-
- // Récupère toutes les données pour un rendez-vous sélectionné
- function getRendezVous($database, $serveurbase, $loginbase, $passwordbase, $idrendezvous, $idutiliseur)
- {
- $rest = array();
-
- $link = mysql_connect($serveurbase, $loginbase, $passwordbase) or die ("Impossible de se connecter : " . mysql_error());
- mysql_select_db($database, $link);
- mysql_query("SET NAMES 'utf8'");
-
- $rendezvous = 'rendezvous'.$idutiliseur;
-
- $query = "SELECT
- IDPatient,
- Visite,
- Date,
- HighBloodPressure,
- NbHighBloodPressure,
- Hypercholesterolemia,
- NbHypercholesterolemia,
- Diabetes,
- NbDiabetes,
- Hypertriglyceridemia,
- NbHypertriglyceridemia,
- Smoking,
- NbCigarettesDay,
- NbYearSmoking,
- CoronaryHeartDisease,
- TypeCoronaryHearDisease,
- IschemicStroke,
- NbIschemicStroke,
- TypeIschelicStroke,
- EtiologyIschemicStroke,
- BloodPressureRightArm,
- BloodPressureLeftArm,
- HeartRate,
- Arrhytmia,
- AntiHypertensive,
- AntiHypertensiveName1,
- AntiHypertensivePosology1,
- AntiHypertensiveStartingDate1,
- AntiHypertensiveName2,
- AntiHypertensivePosology2,
- AntiHypertensiveStartingDate2,
- AntiHypertensiveName3,
- AntiHypertensivePosology3,
- AntiHypertensiveStartingDate3,
- Hypolipidemic,
- HypolipidemicName1,
- HypolipidemicPosology1,
- HypolipidemicStartingDate1,
- HypolipidemicName2,
- HypolipidemicPosology2,
- HypolipidemicStartingDate2,
- HypolipidemicName3,
- HypolipidemicPosology3,
- HypolipidemicStartingDate3,
- Antidiabetis,
- AntidiabetisName1,
- AntidiabetisPosology1,
- AntidiabetisStartingDate1,
- AntidiabetisName2,
- AntidiabetisPosology2,
- AntidiabetisStartingDate2,
- AntidiabetisName3,
- AntidiabetisPosology3,
- AntidiabetisStartingDate3,
- AntiThrombotic,
- AntiThromboticName1,
- AntiThromboticPosology1,
- AntiThromboticStartingDate1,
- AntiThromboticName2,
- AntiThromboticPosology2,
- AntiThromboticStartingDate2,
- AntiThromboticName3,
- AntiThromboticPosology3,
- AntithromboticStartingDate3 FROM $rendezvous WHERE (ID = $idrendezvous) LIMIT 0,30000";
-
- $result = mysql_query($query);
-
- $result2 = mysql_num_rows($result);
- if ($result2 >= 1)
- {
- while($data = mysql_fetch_assoc($result))
- {
- $idpatient = $data['IDPatient'];
- $visite = $data['Visite'];
- $date = $data['Date'];
- $highbloodpressure = $data['HighBloodPressure'];
- $nbhighbloodpressure = $data['NbHighBloodPressure'];
- $hypercholesterolemia = $data['Hypercholesterolemia'];
- $nbhypercholesterolemia = $data['NbHypercholesterolemia'];
- $diabetes = $data['Diabetes'];
- $nbdiabetes = $data['NbDiabetes'];
- $hypertriglyceridemia = $data['Hypertriglyceridemia'];
- $nbhypertriglyceridemia = $data['NbHypertriglyceridemia'];
- $smoking = $data['Smoking'];
- $nbcigarettesday = $data['NbCigarettesDay'];
- $nbyearsmoking = $data['NbYearSmoking'];
- $coronaryheartdisease = $data['CoronaryHeartDisease'];
- $typecoronaryheardisease = $data['TypeCoronaryHearDisease'];
- $ischemicstroke = $data['IschemicStroke'];
- $nbischemicstroke = $data['NbIschemicStroke'];
- $typeischelicstroke = $data['TypeIschelicStroke'];
- $etiologyischemicstroke = $data['EtiologyIschemicStroke'];
- $bloodpressurerightarm = $data['BloodPressureRightArm'];
- $bloodpressureleftarm = $data['BloodPressureLeftArm'];
- $heartrate = $data['HeartRate'];
- $arrhytmia = $data['Arrhytmia'];
- $antihypertensive = $data['AntiHypertensive'];
- $antihypertensivename1 = $data['AntiHypertensiveName1'];
- $antihypertensiveposology1 = $data['AntiHypertensivePosology1'];
- $antihypertensivestartingdate1 = $data['AntiHypertensiveStartingDate1'];
- $antihypertensivename2 = $data['AntiHypertensiveName2'];
- $antihypertensiveposology2 = $data['AntiHypertensivePosology2'];
- $antihypertensivestartingdate2 = $data['AntiHypertensiveStartingDate2'];
- $antihypertensivename3 = $data['AntiHypertensiveName3'];
- $antihypertensiveposology3 = $data['AntiHypertensivePosology3'];
- $antihypertensivestartingdate3 = $data['AntiHypertensiveStartingDate3'];
- $hypolipidemic = $data['Hypolipidemic'];
- $hypolipidemicname1 = $data['HypolipidemicName1'];
- $hypolipidemicposology1 = $data['HypolipidemicPosology1'];
- $hypolipidemicstartingdate1 = $data['HypolipidemicStartingDate1'];
- $hypolipidemicname2 = $data['HypolipidemicName2'];
- $hypolipidemicposology2 = $data['HypolipidemicPosology2'];
- $hypolipidemicstartingdate2 = $data['HypolipidemicStartingDate2'];
- $hypolipidemicname3 = $data['HypolipidemicName3'];
- $hypolipidemicposology3 = $data['HypolipidemicPosology3'];
- $hypolipidemicstartingdate3 = $data['HypolipidemicStartingDate3'];
- $antidiabetis = $data['Antidiabetis'];
- $antidiabetisname1 = $data['AntidiabetisName1'];
- $antidiabetisposology1 = $data['AntidiabetisPosology1'];
- $antidiabetisstartingdate1 = $data['AntidiabetisStartingDate1'];
- $antidiabetisname2 = $data['AntidiabetisName2'];
- $antidiabetisposology2 = $data['AntidiabetisPosology2'];
- $antidiabetisstartingdate2 = $data['AntidiabetisStartingDate2'];
- $antidiabetisname3 = $data['AntidiabetisName3'];
- $antidiabetisposology3 = $data['AntidiabetisPosology3'];
- $antidiabetisstartingdate3 = $data['AntidiabetisStartingDate3'];
- $antithrombotic = $data['AntiThrombotic'];
- $antithromboticname1 = $data['AntiThromboticName1'];
- $antithromboticposology1 = $data['AntiThromboticPosology1'];
- $antithromboticstartingdate1 = $data['AntiThromboticStartingDate1'];
- $antithromboticname2 = $data['AntiThromboticName2'];
- $antithromboticposology2 = $data['AntiThromboticPosology2'];
- $antithromboticstartingdate2 = $data['AntiThromboticStartingDate2'];
- $antithromboticname3 = $data['AntiThromboticName3'];
- $antithromboticposology3 = $data['AntiThromboticPosology3'];
- $antithromboticstartingdate3 = $data['AntiThromboticStartingDate3'];
-
- array_push($rest, array("IDPatient"=>$idpatient,
- "Visite"=>$visite,
- "Date"=>$date,
- "HighBloodPressure"=>$highbloodpressure,
- "NbHighBloodPressure"=>$highbloodpressure,
- "Hypercholesterolemia"=>$hypercholesterolemia,
- "NbHypercholesterolemia"=>$nbhypercholesterolemia,
- "Diabetes"=>$diabetes,
- "NbDiabetes"=>$nbdiabetes,
- "Hypertriglyceridemia"=>$hypertriglyceridemia,
- "NbHypertriglyceridemia"=>$nbhypertriglyceridemia,
- "Smoking"=>$smoking,
- "NbCigarettesDay"=>$nbcigarettesday,
- "NbYearSmoking"=>$nbyearsmoking,
- "CoronaryHeartDisease"=>$coronaryheartdisease,
- "TypeCoronaryHearDisease"=>$typecoronaryheardisease,
- "IschemicStroke"=>$ischemicstroke,
- "NbIschemicStroke"=>$nbischemicstroke,
- "BloodPressureRightArm"=>$bloodpressurerightarm,
- "BloodPressureLeftArm"=>$bloodpressureleftarm,
- "HeartRate"=>$heartrate,
- "Arrhytmia"=>$arrhytmia,
- "AntiHypertensive"=>$antihypertensive,
- "AntiHypertensiveName1"=>$antihypertensivename1,
- "AntiHypertensivePosology1"=>$antihypertensiveposology1,
- "AntiHypertensiveStartingDate1"=>$antihypertensivestartingdate1,
- "AntiHypertensiveName2"=>$antihypertensivename2,
- "AntiHypertensivePosology2"=>$antihypertensiveposology2,
- "AntiHypertensiveStartingDate2"=>$antihypertensivestartingdate2,
- "AntiHypertensiveName3"=>$antihypertensivename3,
- "AntiHypertensivePosology3"=>$antihypertensiveposology3,
- "AntiHypertensiveStartingDate3"=>$antihypertensivestartingdate3,
- "Hypolipidemic"=>$hypolipidemic,
- "HypolipidemicName1"=>$hypolipidemicname1,
- "HypolipidemicPosology1"=>$hypolipidemicposology1,
- "HypolipidemicStartingDate1"=>$hypolipidemicstartingdate1,
- "HypolipidemicName2"=>$hypolipidemicname2,
- "HypolipidemicPosology2"=>$hypolipidemicposology2,
- "HypolipidemicStartingDate2"=>$hypolipidemicstartingdate2,
- "HypolipidemicName3"=>$hypolipidemicname3,
- "HypolipidemicPosology3"=>$hypolipidemicposology3,
- "HypolipidemicStartingDate3"=>$hypolipidemicstartingdate3,
- "Antidiabetis"=>$antidiabetis,
- "AntidiabetisName1"=>$antidiabetisname1,
- "AntidiabetisPosology1"=>$antidiabetisposology1,
- "AntidiabetisStartingDate1"=>$antidiabetisstartingdate1,
- "AntidiabetisName2"=>$antidiabetisname2,
- "AntidiabetisPosology2"=>$antidiabetisposology2,
- "AntidiabetisStartingDate2"=>$antidiabetisstartingdate2,
- "AntidiabetisName3"=>$antidiabetisname3,
- "AntidiabetisPosology3"=>$antidiabetisposology3,
- "AntidiabetisStartingDate3"=>$antidiabetisstartingdate3,
- "AntiThrombotic"=>$antithrombotic,
- "AntiThromboticName1"=>$antithromboticname1,
- "AntiThromboticPosology1"=>$antithromboticposology1,
- "AntiThromboticStartingDate1"=>$antithromboticstartingdate1,
- "AntiThromboticName2"=>$antithromboticname2,
- "AntiThromboticPosology2"=>$antithromboticposology2,
- "AntiThromboticStartingDate2"=>$antithromboticstartingdate2,
- "AntiThromboticName3"=>$antithromboticname3,
- "AntiThromboticPosology3"=>$antithromboticposology3,
- "AntiThromboticStartingDate3"=>$antithromboticstartingdate3));
- }
- }
- else
- {
- $idpatient = '';
- $visite = '';
- $date = '';
- $highbloodpressure = '';
- $nbhighbloodpressure = '';
- $hypercholesterolemia = '';
- $nbhypercholesterolemia = '';
- $diabetes = '';
- $nbdiabetes = '';
- $hypertriglyceridemia = '';
- $nbhypertriglyceridemia = '';
- $smoking = '';
- $nbcigarettesday = '';
- $nbyearsmoking = '';
- $coronaryheartdisease = '';
- $typecoronaryheardisease = '';
- $ischemicstroke = '';
- $nbischemicstroke = '';
- $typeischelicstroke = '';
- $etiologyischemicstroke = '';
- $bloodpressurerightarm = '';
- $bloodpressureleftarm = '';
- $heartrate = '';
- $arrhytmia = '';
- $antihypertensive = '';
- $antihypertensivename1 = '';
- $antihypertensiveposology1 = '';
- $antihypertensivestartingdate1 = '';
- $antihypertensivename2 = '';
- $antihypertensiveposology2 = '';
- $antihypertensivestartingdate2 = '';
- $antihypertensivename3 = '';
- $antihypertensiveposology3 = '';
- $antihypertensivestartingdate3 = '';
- $hypolipidemic = '';
- $hypolipidemicname1 = '';
- $hypolipidemicposology1 = '';
- $hypolipidemicstartingdate1 = '';
- $hypolipidemicname2 = '';
- $hypolipidemicposology2 = '';
- $hypolipidemicstartingdate2 = '';
- $hypolipidemicname3 = '';
- $hypolipidemicposology3 = '';
- $hypolipidemicstartingdate3 = '';
- $antidiabetis = '';
- $antidiabetisname1 = '';
- $antidiabetisposology1 = '';
- $antidiabetisstartingdate1 = '';
- $antidiabetisname2 = '';
- $antidiabetisposology2 = '';
- $antidiabetisstartingdate2 = '';
- $antidiabetisname3 = '';
- $antidiabetisposology3 = '';
- $antidiabetisstartingdate3 = '';
- $antithrombotic = '';
- $antithromboticname1 = '';
- $antithromboticposology1 = '';
- $antithromboticstartingdate1 = '';
- $antithromboticname2 = '';
- $antithromboticposology2 = '';
- $antithromboticstartingdate2 = '';
- $antithromboticname3 = '';
- $antithromboticposology3 = '';
- $antithromboticstartingdate3 = '';
-
- array_push($rest, array("IDPatient"=>$idpatient,
- "Visite"=>$visite,
- "Date"=>$date,
- "HighBloodPressure"=>$highbloodpressure,
- "NbHighBloodPressure"=>$highbloodpressure,
- "Hypercholesterolemia"=>$hypercholesterolemia,
- "NbHypercholesterolemia"=>$nbhypercholesterolemia,
- "Diabetes"=>$diabetes,
- "NbDiabetes"=>$nbdiabetes,
- "Hypertriglyceridemia"=>$hypertriglyceridemia,
- "NbHypertriglyceridemia"=>$nbhypertriglyceridemia,
- "Smoking"=>$smoking,
- "NbCigarettesDay"=>$nbcigarettesday,
- "NbYearSmoking"=>$nbyearsmoking,
- "CoronaryHeartDisease"=>$coronaryheartdisease,
- "TypeCoronaryHearDisease"=>$typecoronaryheardisease,
- "IschemicStroke"=>$ischemicstroke,
- "NbIschemicStroke"=>$nbischemicstroke,
- "EtiologyIlchemicStroke"=>$etiologyischemicstroke,
- "BloodPressureRightArm"=>$bloodpressurerightarm,
- "BloodPressureLeftArm"=>$bloodpressureleftarm,
- "HeartRate"=>$heartrate,
- "Arrhytmia"=>$arrhytmia,
- "AntiHypertensive"=>$antihypertensive,
- "AntiHypertensiveName1"=>$antihypertensivename1,
- "AntiHypertensivePosology1"=>$antihypertensiveposology1,
- "AntiHypertensiveStartingDate1"=>$antihypertensivestartingdate1,
- "AntiHypertensiveName2"=>$antihypertensivename2,
- "AntiHypertensivePosology2"=>$antihypertensiveposology2,
- "AntiHypertensiveStartingDate2"=>$antihypertensivestartingdate2,
- "AntiHypertensiveName3"=>$antihypertensivename3,
- "AntiHypertensivePosology3"=>$antihypertensiveposology3,
- "AntiHypertensiveStartingDate3"=>$antihypertensivestartingdate3,
- "Hypolipidemic"=>$hypolipidemic,
- "HypolipidemicName1"=>$hypolipidemicname1,
- "HypolipidemicPosology1"=>$hypolipidemicposology1,
- "HypolipidemicStartingDate1"=>$hypolipidemicstartingdate1,
- "HypolipidemicName2"=>$hypolipidemicname2,
- "HypolipidemicPosology2"=>$hypolipidemicposology2,
- "HypolipidemicStartingDate2"=>$hypolipidemicstartingdate2,
- "HypolipidemicName3"=>$hypolipidemicname3,
- "HypolipidemicPosology3"=>$hypolipidemicposology3,
- "HypolipidemicStartingDate3"=>$hypolipidemicstartingdate3,
- "Antidiabetis"=>$antidiabetis,
- "AntidiabetisName1"=>$antidiabetisname1,
- "AntidiabetisPosology1"=>$antidiabetisposology1,
- "AntidiabetisStartingDate1"=>$antidiabetisstartingdate1,
- "AntidiabetisName2"=>$antidiabetisname2,
- "AntidiabetisPosology2"=>$antidiabetisposology2,
- "AntidiabetisStartingDate2"=>$antidiabetisstartingdate2,
- "AntidiabetisName3"=>$antidiabetisname3,
- "AntidiabetisPosology3"=>$antidiabetisposology3,
- "AntidiabetisStartingDate3"=>$antidiabetisstartingdate3,
- "AntiThrombotic"=>$antithrombotic,
- "AntiThromboticName1"=>$antithromboticname1,
- "AntiThromboticPosology1"=>$antithromboticposology1,
- "AntiThromboticStartingDate1"=>$antithromboticstartingdate1,
- "AntiThromboticName2"=>$antithromboticname2,
- "AntiThromboticPosology2"=>$antithromboticposology2,
- "AntiThromboticStartingDate2"=>$antithromboticstartingdate2,
- "AntiThromboticName3"=>$antithromboticname3,
- "AntiThromboticPosology3"=>$antithromboticposology3,
- "AntiThromboticStartingDate3"=>$antithromboticstartingdate3));
- }
-
- // on retourne le tableau
- return $rest;
- }
-
- // Récupère toutes les mesures pour un rendez-vous sélectionné
- function getMesures($database, $serveurbase, $loginbase, $passwordbase, $idrendezvous, $idutiliseur)
- {
- $rest = array();
-
- $link = mysql_connect($serveurbase, $loginbase, $passwordbase) or die ("Impossible de se connecter : " . mysql_error());
- mysql_select_db($database, $link);
- mysql_query("SET NAMES 'utf8'");
-
- $mesures = 'mesures'.$idutiliseur;
-
- $query = "SELECT
- 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 FROM $mesures WHERE (IDRendezVous = $idrendezvous) LIMIT 0,30000";
-
- $result = mysql_query($query);
-
- $result2 = mysql_num_rows($result);
- if ($result2 >= 1)
- {
- while($data = mysql_fetch_assoc($result))
- {
- $typemesure = $data['TypeMesure'];
- $situation = $data['Situation'];
- $side = $data['Side'];
- $echelle = $data['Echelle'];
- $nomechelle = $data['NomEchelle'];
- $longueurechelle = $data['LongueurEchelle'];
- $x1echelle = $data['x1Echelle'];
- $y1echelle = $data['y1Echelle'];
- $x2echelle = $data['x2Echelle'];
- $y2echelle = $data['y2Echelle'];
- $etendue = $data['Etendue'];
- $min = $data['Min'];
- $moy = $data['Moy'];
- $max = $data['Max'];
- $iq_densite = $data['IQ_Densite'];
- $standartdeviation = $data['StandartDeviation'];
- $numberofpoints = $data['NumberOfPoints'];
- $x1 = $data['x1'];
- $y1 = $data['y1'];
- $x2 = $data['x2'];
- $y2 = $data['y2'];
- $numberofplaques = $data['NumberOfPlaques'];
- $numberofstenosis = $data['NumberOfStenosis'];
- $stenosisangle = $data['StenosisAngle'];
- $numberofocclusions = $data['NumberOfOcclusions'];
-
- array_push($rest, array("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));
- }
- }
- else
- {
- $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 = '';
-
- array_push($rest, array("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));
- }
-
- // on retourne le tableau
- return $rest;
- }
-
- // Récupère toutes les graphiques pour un rendez-vous sélectionné
- function getGraphiques($database, $serveurbase, $loginbase, $passwordbase, $idrendezvous, $idutiliseur)
- {
- $rest = array();
-
- $link = mysql_connect($serveurbase, $loginbase, $passwordbase) or die ("Impossible de se connecter : " . mysql_error());
- mysql_select_db($database, $link);
- mysql_query("SET NAMES 'utf8'");
-
- $tgraphiques = 'graphiques'.$idutiliseur;
-
- $query = "SELECT
- TypeGraphique,
- Situation,
- Side,
- x,
- y FROM $tgraphiques WHERE (IDRendezVous = $idrendezvous) LIMIT 0,30000";
-
- $result = mysql_query($query);
-
- $result2 = mysql_num_rows($result);
- if ($result2 >= 1)
- {
- while($data = mysql_fetch_assoc($result))
- {
- $typegraphique = $data['TypeGraphique'];
- $situation = $data['Situation'];
- $side = $data['Side'];
- $x = $data['x'];
- $y = $data['y'];
-
- array_push($rest, array("TypeGraphique"=>$typegraphique,
- "Situation"=>$situation,
- "Side"=>$side,
- "x"=>$x,
- "y"=>$y));
- }
- }
- else
- {
- $typegraphique = '';
- $situation = '';
- $side = '';
- $x = '';
- $y = '';
-
- array_push($rest, array("TypeGraphique"=>$typegraphique,
- "Situation"=>$situation,
- "Side"=>$side,
- "x"=>$x,
- "y"=>$y));
- }
-
- // on retourne le tableau
- return $rest;
- }
-
- function updateInfosPatient($database, $serveurbase, $loginbase, $passwordbase, $idpatient, $ivrs, $nom, $prenom, $sexe, $datedenaissance, $idutilisateur)
- {
- $tpatients = 'patients'.$idutilisateur;
-
- $link = mysql_connect($serveurbase, $loginbase, $passwordbase) or die ("Impossible de se connecter : " . mysql_error());
- mysql_select_db($database, $link);
- mysql_query("SET NAMES 'utf8'");
-
- $query = "UPDATE $tpatients SET IVRS='$ivrs', Nom='$nom', Prenom='$prenom', Sexe='$sexe', DateDeNaissance='$datedenaissance' WHERE ID=$idpatient";
-
- $result = mysql_query($query);
-
- return true;
- }
- // Copie des fichiers
- function copyFile($etude, $source1, $dest1, $source2, $dest2, $source3, $dest3, $source4, $dest4, $source5, $dest5, $source6, $dest6)
- {
- if ($etude == 256)
- {
- if (($source1 != '') && ($dest1 != ''))
- {
- copy($source1, $dest1);
- chmod($dest1, 0755);
- }
- if (($source2 != '') && ($dest2 != ''))
- {
- copy($source2, $dest2);
- chmod($dest2, 0755);
- }
- if (($source3 != '') && ($dest3 != ''))
- {
- copy($source3, $dest3);
- chmod($dest3, 0755);
- }
- if (($source4 != '') && ($dest4 != ''))
- {
- copy($source4, $dest4);
- chmod($dest4, 0755);
- }
- if (($source5 != '') && ($dest5 != ''))
- {
- copy($source5, $dest5);
- chmod($dest5, 0755);
- }
- if (($source6 != '') && ($dest6 != ''))
- {
- copy($source6, $dest6);
- chmod($dest6, 0755);
- }
- }
- else
- {
- if (($source1 != '') && ($dest1 != ''))
- {
- copy($source1, $dest1);
- chmod($dest1, 0755);
- }
-
- if (($source4 != '') && ($dest4 != ''))
- {
- copy($source4, $dest4);
- chmod($dest4, 0755);
- }
-
- if (($etude == 1) || ($etude == 2))
- {
- if (($source2 != '') && ($dest2 != ''))
- {
- copy($source2, $dest2);
- chmod($dest2, 0755);
- }
-
- if (($source3 != '') && ($dest3 != ''))
- {
- copy($source3, $dest3);
- chmod($dest3, 0755);
- }
-
- if (($source5 != '') && ($dest5 != ''))
- {
- copy($source5, $dest5);
- chmod($dest5, 0755);
- }
-
- if (($source6 != '') && ($dest6 != ''))
- {
- copy($source6, $dest6);
- chmod($dest6, 0755);
- }
- }
- }
- }
-
- // Détruit des fichiers
- function deleteFile($etude, $filename1, $filename2, $filename3, $filename4, $filename5, $filename6)
- {
- // Si le chemin contient Temp
- if (strpos($filename1, 'Temp'))
- {
- unlink($filename1);
- }
-
- if (strpos($filename4, 'Temp'))
- {
- unlink($filename4);
- }
-
- if (($etude == 1) || ($etude == 2))
- {
- if (strpos($filename2, 'Temp'))
- {
- unlink($filename2);
- }
-
- if (strpos($filename3, 'Temp'))
- {
- unlink($filename3);
- }
-
- if (strpos($filename5, 'Temp'))
- {
- unlink($filename5);
- }
-
- if (strpos($filename6, 'Temp'))
- {
- unlink($filename6);
- }
- }
- }
- // Nettoyage des répertoires temporaires
- function cleanDir($captchaFolder, $fileTypes)
- {
- // Filetypes to check (you can also use *.*)
-
- // Here you can define after how many
- // minutes the files should get deleted
- // Durée max connecion : 24 heures
- $expire_time = 1440;
-
- // Find all files of the given file type
- foreach (glob($captchaFolder.$fileTypes) as $Filename)
- {
- // Read file creation time
- $FileCreationTime = filectime($Filename);
-
- // Calculate file age in seconds
- $FileAge = time() - $FileCreationTime;
-
- // Is the file older than the given time span?
- if ($FileAge > ($expire_time * 60))
- {
- // Now do something with the olders files...
- // print "The file $Filename is older than $expire_time minutes\n";
-
- // For example deleting files:
- unlink($Filename);
- }
- }
- }
- // Nettoyage des répertoires temporaires
- function cleanTempDir()
- {
- // Define the folder to clean
- $rep1 = $_SERVER['DOCUMENT_ROOT'].'/TempMP/';
- $this->cleanDir($rep1, '*.JPG');
- $this->cleanDir($rep1, '*.jpg');
- $this->cleanDir($rep1, '*.dcm');
- $this->cleanDir($rep1, '*.DCM');
- $rep2 = $_SERVER['DOCUMENT_ROOT'].'/TempMPDemo/';
- $this->cleanDir($rep2, '*.JPG');
- $this->cleanDir($rep2, '*.jpg');
- $this->cleanDir($rep2, '*.dcm');
- $this->cleanDir($rep2, '*.DCM');
-
- $rep3 = $_SERVER['DOCUMENT_ROOT'].'/TempCS0/';
- $this->cleanDir($rep3, '*.JPG');
- $this->cleanDir($rep3, '*.jpg');
- $this->cleanDir($rep3, '*.dcm');
- $this->cleanDir($rep3, '*.DCM');
- $rep4 = $_SERVER['DOCUMENT_ROOT'].'/TempCS1/';
- $this->cleanDir($rep4, '*.JPG');
- $this->cleanDir($rep4, '*.jpg');
- $this->cleanDir($rep4, '*.dcm');
- $this->cleanDir($rep4, '*.DCM');
- $rep5 = $_SERVER['DOCUMENT_ROOT'].'/TempCS2/';
- $this->cleanDir($rep5, '*.JPG');
- $this->cleanDir($rep5, '*.jpg');
- $this->cleanDir($rep5, '*.dcm');
- $this->cleanDir($rep5, '*.DCM');
-
- $rep6 = $_SERVER['DOCUMENT_ROOT'].'/uploader/myFileDir/';
- $this->cleanDir($rep6, '*.JPG');
- $this->cleanDir($rep6, '*.jpg');
- $this->cleanDir($rep6, '*.dcm');
- $this->cleanDir($rep6, '*.DCM');
-
- return '1';
- }
-
- function testFilesCopied($etude, $filename1, $filename2, $filename3, $filename4, $filename5, $filename6)
- {
- if ($etude == 256)
- {
- $erreur = false;
- if ($filename1 != '')
- {
- if (!file_exists($filename1))
- {
- $erreur = true;
- }
- }
- if ($filename2 != '')
- {
- if (!file_exists($filename2))
- {
- $erreur = true;
- }
- }
- if ($filename3 != '')
- {
- if (!file_exists($filename3))
- {
- $erreur = true;
- }
- }
- if ($filename4 != '')
- {
- if (!file_exists($filename4))
- {
- $erreur = true;
- }
- }
- if ($filename5 != '')
- {
- if (!file_exists($filename5))
- {
- $erreur = true;
- }
- }
- if ($filename6 != '')
- {
- if (!file_exists($filename6))
- {
- $erreur = true;
- }
- }
-
- if ($erreur == true)
- {
- return '0';
- }
- else
- {
- return '1';
- }
- }
- else if ($etude == 0)
- {
- if (file_exists($filename1) && file_exists($filename4))
- {
- return '1';
- }
- else
- {
- return '0';
- }
- }
- else if (($etude == 1) || ($etude == 2))
- {
- if (file_exists($filename1) && file_exists($filename2) && file_exists($filename3) && file_exists($filename4) && file_exists($filename5) && file_exists($filename6))
- {
- return '1';
- }
- else
- {
- return '0';
- }
- }
- }
-
- function SaveAsJPEG($etude, $file1, $bytesArray1, $file2, $bytesArray2, $file3, $bytesArray3, $file4, $bytesArray4, $file5, $bytesArray5, $file6, $bytesArray6)
- {
- $data1 = $bytesArray1->data;
-
- file_put_contents($file1, $data1);
- $data4 = $bytesArray4->data;
-
- file_put_contents($file4, $data4);
- if (($etude == 1) || ($etude == 2))
- {
- $data2 = $bytesArray2->data;
-
- file_put_contents($file2, $data2);
-
- $data3 = $bytesArray3->data;
-
- file_put_contents($file3, $data3);
-
- $data5 = $bytesArray5->data;
-
- file_put_contents($file5, $data5);
-
- $data6 = $bytesArray6->data;
-
- file_put_contents($file6, $data6);
- }
-
- return '1';
- }
-
- function SaveAsJPEG2($file1, $bytesArray1, $idpatient, $nom, $prenom, $sexe, $datenaissance)
- {
- // chmod($file1, 0777);
- $data1 = $bytesArray1->data;
-
- file_put_contents($file1, $data1);
- chmod($file1, 0755);
- // Cryptage de l'image
- header("Content-type:image/jpeg");
- $image = imagecreatefromjpeg($file1);
- $dimh = imagesx($image);
- $dimv = imagesy($image);
-
- $ncol = ($dimv * 12) / 100;
-
- $rouge = 0;
- $vert = 0;
- $bleu = 0;
- $fond = imagecolorallocate($image, $rouge, $vert, $bleu);
- $blanc = imagecolorallocate($image, 255, 255, 255);
-
- ImageFilledRectangle($image, 0, 0, $dimh, $ncol, $fond);
- ImageFilledRectangle($image, 0, ($dimv - $ncol), $dimh, $dimv, $fond);
-
- $texte_h = $dimv - imagefontheight(12) - 20;
- $texte_v = 20;
- imagestring($image, 12, $texte_v, $texte_h, $nom.' '.$prenom.' '.$datenaissance.' ('.$sexe.') '.$idpatient, $blanc);
- // Enregistrement de l'image
- imagejpeg($image, $file1, 100);
-
- chmod($file1, 0755);
-
- return '1';
- }
-
- function sendReportMail($pdfname, $to1, $from, $subject, $emailMessage)
- {
- include_once('class.phpmailer.php');
- $mail = new PHPMailer();
- $body = $emailMessage;
- $body = eregi_replace("[\]",'',$body);
- $mail->IsSendmail(); // telling the class to use SendMail transport
- $mail->From = $from;
- $mail->FromName = $from;
- $mail->Subject = $subject;
- $mail->AltBody = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test
- $mail->MsgHTML($body);
- $mail->AddAddress($to1, "Dest 1");
-
- $mail->AddAttachment($pdfname);
- if(!$mail->Send())
- {
- return '0';
- }
- else
- {
- return '1';
- }
- }
- function testFileUploadCreated($filename)
- {
- if (file_exists($filename))
- {
- chmod($filename, 0755);
- return '1';
- }
- else
- {
- return '0';
- }
- }
-
- function sendContactForm($to1, $subject, $emailMessage)
- {
- include_once('class.phpmailer.php');
- $mail = new PHPMailer();
- $body = $emailMessage;
- $body = eregi_replace("[\]",'',$body);
- $mail->IsSendmail(); // telling the class to use SendMail transport
- $mail->From = "j.deppe@evolucare.com";
- $mail->FromName = $from;
- $mail->Subject = $subject;
- $mail->AltBody = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test
- $mail->MsgHTML($body);
- $mail->AddAddress($to1, "Dest 1");
-
- if(!$mail->Send())
- {
- return '0';
- }
- else
- {
- return '1';
- }
- }
-
- function sendImageGalerie($to1, $subject, $emailMessage, $myimage)
- {
- include_once('class.phpmailer.php');
- $mail = new PHPMailer();
- $body = $emailMessage;
- $body = eregi_replace("[\]",'',$body);
- $mail->IsSendmail(); // telling the class to use SendMail transport
- $mail->From = "j.deppe@evolucare.com";
- $mail->FromName = $from;
- $mail->Subject = $subject;
- $mail->AltBody = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test
- $mail->MsgHTML($body);
- $mail->AddAddress($to1, "Dest 1");
-
- $mail->AddAttachment($myimage); // attachment
- if(!$mail->Send())
- {
- return '0';
- }
- else
- {
- return '1';
- }
- }
-
- // Récupère en une fois toutes les infos
- function GetStartInfos()
- {
- $rest = array();
-
- if (!empty($_SERVER['HTTP_CLIENT_IP'])) //check ip from share internet
- {
- $ip=$_SERVER['HTTP_CLIENT_IP'];
- }
- elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) //to check ip is pass from proxy
- {
- $ip=$_SERVER['HTTP_X_FORWARDED_FOR'];
- }
- else
- {
- $ip=$_SERVER['REMOTE_ADDR'];
- }
-
- $today = date("d-m")."-20".date('y')." ".date('H:i');
- /*
- $gi = geoip_open(DIR_LOCALISE."GeoLiteCity.dat",GEOIP_STANDARD);
- $record = geoip_record_by_addr($gi, $ip);
-
- $pays = $record->country_code;
- */
- $pathovh = $_SERVER['DOCUMENT_ROOT'];
-
- array_push($rest, array("AdresseIP"=>$ip,
- "DateServeur"=>$today,
- "PathOvh"=>$pathovh));
-
- // on retourne le tableau
- return $rest;
- }
- function pdfEncrypt($origFile, $password, $destFile)
- {
- $pdf =& new FPDI_Protection();
-
- // set the format of the destinaton file, in our case 6×9 inch
- $pdf->FPDF('P', 'in', 'A4');
- //calculate the number of pages from the original document
- $pagecount = $pdf->setSourceFile($origFile);
- // copy all pages from the old unprotected pdf in the new one
- for ($loop = 1; $loop <= $pagecount; $loop++)
- {
- $tplidx = $pdf->importPage($loop);
- $pdf->addPage();
- $pdf->useTemplate($tplidx);
- }
- // protect the new pdf file, and allow no printing, copy etc and leave only reading allowed
- $pdf->SetProtection(array('print', 'copy'), $password, '');
- $pdf->Output($destFile, 'F');
- return $destFile;
- }
-
- function sendEnvoyerAUnAmi($from, $to1, $subject, $emailMessage)
- {
- include_once('class.phpmailer.php');
- $mail = new PHPMailer();
- $body = $emailMessage;
- $body = eregi_replace("[\]",'',$body);
- $mail->IsSendmail(); // telling the class to use SendMail transport
- $mail->From = $from;
- $mail->FromName = $from;
- $mail->Subject = $subject;
- $mail->AltBody = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test
- $mail->MsgHTML($body);
- $mail->AddAddress($to1, "Dest 1");
-
- if(!$mail->Send())
- {
- return '0';
- }
- else
- {
- return '1';
- }
- }
- function upload($level, $id_cont, $fileName, $byteArray)
- {
- $adata = $byteArray->data;
-
- // Les millisecondes
- $m = explode(' ', microtime());
-
- list($totalSeconds, $extraMilliseconds) = array($m[1], (int)round($m[0]*1000,3));
-
- if ((substr_count($fileName,'.dcm') > 0) || (substr_count($fileName, '.DCM') > 0))
- {
- $fname = date('Y_m_d_H_i_s', $totalSeconds).'_'.$extraMilliseconds.'.dcm';
- }
- else
- {
- $fname = date('Y_m_d_H_i_s', $totalSeconds).'_'.$extraMilliseconds.'.jpg';
- }
-
- if (file_put_contents("../../../uploader/myFileDir/" . $fname, $adata))
- {
- chmod("../../../uploader/myFileDir/" . $fname, 0755);
- return ($fname);
- }
- else
- {
- return '0';
- }
- }
- /*
- // Générateur aléatoire
- function getran()
- {
- $k = (int)($seed1 % 53668);
- $l = (int)(($seed1 - $k) / 53668);
- $seed1 = (int)(40014 * $k - $l * 12211);
- if ($seed1 < 0)
- {
- $seed1 = (int)($seed1 + 2147483563);
- }
-
- $k = (int)($seed2 % 52774);
- $l = (int)(($seed2 - $k) / 52774);
- $seed2 = (int)(40692 * $k - $l * 3791);
- if ($seed2 < 0)
- {
- $seed2 = (int)($seed2 + 2147483399);
- }
-
- $iz = (int)($seed1 - $seed2);
- if ($iz < 1)
- {
- $iz = (int)($iz + 2147483562);
- }
-
- $res = (real) ($iz * 4.656613e-10);
- // $res = $iz * 0.0000000004656613;
- if ($res < 0.0)
- {
- $res = 0.0;
- }
-
- if ($res > 1.0)
- {
- $res = 1.0;
- }
-
- return $res;
- }
- */
-
- function crypteImage($fileNameIn, $fileNameOut, $pseed1, $pseed2, $colmin, $colmax, $dimh, $max)
- {
- header("Content-type:image/jpeg");
- // global $seed1;
- // global $seed2;
- $seed1 = $pseed1;
- $seed2 = $pseed2;
-
- $image = imagecreatefromjpeg($fileNameIn);
- $col2 = imagecolorallocate($image, 0, 0, 0);
-
- for ($y = $colmin; $y < $colmax; $y++)
- {
- for ($x = 0; $x < $dimh; $x++)
- {
- $col = imagecolorat($image, $x, $y);
-
- $rouge = ($col >> 16) & 0xFF;
- $vert = ($col >> 8) & 0xFF;
- $bleu = $col & 0xFF;
- $colh = $bleu + ($rouge << 16) + ($vert << 8);
-
- // $rd = (int) ($this->getran($seed1, $seed2) * PHP_INT_MAX);
- $k = (int)($seed1 % 53668);
- $l = (int)(($seed1 - $k) / 53668);
- $seed1 = (int)(40014 * $k - $l * 12211);
- if ($seed1 < 0)
- {
- $seed1 = (int)($seed1 + 2147483563);
- }
-
- $k = (int)($seed2 % 52774);
- $l = (int)(($seed2 - $k) / 52774);
- $seed2 = (int)(40692 * $k - $l * 3791);
- if ($seed2 < 0)
- {
- $seed2 = (int)($seed2 + 2147483399);
- }
-
- $iz = (int)($seed1 - $seed2);
- if ($iz < 1)
- {
- $iz = (int)($iz + 2147483562);
- }
-
- $res = (real) ($iz * 4.656613e-10);
- if ($res < 0.0)
- {
- $res = 0.0;
- }
-
- if ($res > 1.0)
- {
- $res = 1.0;
- }
- $rd = (int) (($res * $max) * 10000) / 10000;
-
- $col2h = (int) ($colh ^ $rd) & 0x00FFFFFF;
-
- $rouge = ($col2h >> 16) & 0xFF;
- $vert = ($col2h >> 8) & 0xFF;
- $bleu = $col2h & 0xFF;
-
- $col2 = imagecolorallocate($image, $rouge, $vert, $bleu);
-
- ImageSetPixel($image, $x, $y, $col2);
- }
- }
-
- // Enregistrement de l'image
- imagejpeg($image, $fileNameOut, 100);
- }
-
- function updateCredit($database, $serveurbase, $loginbase, $passwordbase, $credits, $idutilisateur, $date, $adresseip, $typecredit, $idpatient, $idrendezvous, $idmesure)
- {
- $link = mysql_connect($serveurbase, $loginbase, $passwordbase) or die ("Impossible de se connecter : " . mysql_error());
- mysql_select_db($database, $link);
- mysql_query("SET NAMES 'utf8'");
- $tcredits = 'credits'.$idutilisateur;
-
- $query="UPDATE utilisateurs SET Credits=$credits WHERE (ID = '$idutilisateur')";
- // Ajout du crédit dans la base
- $result = mysql_query($query);
- $query2 = "INSERT INTO $tcredits (Date, AdresseIP, TypeCredit, IDPatient, IDRendezVous, IDMesure) VALUES ('$date', '$adresseip', '$typecredit', $idpatient, $idrendezvous, $idmesure)";
- $result2 = mysql_query($query2);
- return true;
- }
- }
- ?>
|