470 lines
12 KiB
PHP
Executable File
470 lines
12 KiB
PHP
Executable File
<?php
|
|
session_start();
|
|
|
|
include 'include/global.php';
|
|
include 'include/function.php';
|
|
|
|
|
|
if (isset($_GET['action']) && $_GET['action'] == 'index')
|
|
{
|
|
$user_id = $_GET['user_id'];
|
|
$user_name = $_GET['user_name'];
|
|
$finger = $_GET['finger'];
|
|
?>
|
|
<script type="text/javascript">
|
|
|
|
function user_register(user_id, user_name)
|
|
{
|
|
$('body').ajaxMask();
|
|
|
|
regStats = 0;
|
|
regCt = -1;
|
|
try
|
|
{
|
|
timer_register.stop();
|
|
}
|
|
catch(err)
|
|
{
|
|
console.log('Registration timer has been init');
|
|
}
|
|
|
|
|
|
/* mis en commentaire le 11/11/2018 pour augmenter le temp d'essai
|
|
var limit = 11;
|
|
*/
|
|
|
|
var limit = 21;
|
|
var ct = 1;
|
|
var timeout = 2000;
|
|
|
|
timer_register = $.timer(timeout, function()
|
|
{
|
|
console.log("'"+user_name+"' registration checking...");
|
|
user_checkregister(user_id,$("#user_finger_"+user_id).html());
|
|
if (ct>=limit || regStats==1)
|
|
{
|
|
timer_register.stop();
|
|
console.log("'"+user_name+"' : Enrôlement terminé!");
|
|
if (ct>=limit && regStats==0)
|
|
{
|
|
$("#okId" ).val("-1");
|
|
|
|
$('body').ajaxMask({ stop: true });
|
|
|
|
v_msg=user_name+" => échec de l'enrôlement!";
|
|
v_msgEng=user_name+" => Enrollement failed!";
|
|
alert_ebene(v_msg, v_msgEng);
|
|
}
|
|
if (regStats==1)
|
|
{
|
|
$("#okId" ).val("1");
|
|
|
|
$('body').ajaxMask({ stop: true });
|
|
|
|
$("#user_finger_"+user_id).html(regCt);
|
|
|
|
v_msg =user_name+" : Enrôlement effectué avec succès!";
|
|
v_msgEng=user_name+" : Enrolled successfully!";
|
|
alert_ebene(v_msg, v_msgEng);
|
|
|
|
// Ajout du 21/09/2018 => enregistrer celui qui a enrôler l'assuré
|
|
save_enroleur(user_id);
|
|
|
|
afficher_beneficiaire_id();
|
|
}
|
|
}
|
|
ct++;
|
|
});
|
|
}
|
|
|
|
function user_checkregister(user_id, current)
|
|
{
|
|
$.ajax({
|
|
url : "flexcode/user.php?action=checkreg&user_id="+user_id+"¤t="+current,
|
|
type : "GET",
|
|
success : function(data)
|
|
{
|
|
try
|
|
{
|
|
var res = jQuery.parseJSON(data);
|
|
if (res.result)
|
|
{
|
|
regStats = 1;
|
|
$.each(res, function(key, value)
|
|
{
|
|
if (key=='current')
|
|
{
|
|
regCt = value;
|
|
}
|
|
});
|
|
}
|
|
}
|
|
catch(err)
|
|
{
|
|
alert(err.message);
|
|
}
|
|
}
|
|
});
|
|
}
|
|
|
|
// ajouté le 26/05/2017 pour la vérification
|
|
function user_verification(user_id)
|
|
{
|
|
/*
|
|
verifiertentativeidentitification(user_id);
|
|
nbTentative = $("#nbTentative").val();
|
|
|
|
if (nbTentative>=3)
|
|
{
|
|
v_msg="Attention, vous avez effectué plus de 3 tentatives!";
|
|
v_msgEng="Warning, you made more than 3 attempts!";
|
|
alert_ebene(v_msg, v_msgEng);
|
|
}
|
|
*/
|
|
|
|
$('body').ajaxMask();
|
|
|
|
regStats = 0;
|
|
|
|
try
|
|
{
|
|
timer_register.stop();
|
|
}
|
|
catch(err)
|
|
{
|
|
console.log('Démarrage de la Vérification');
|
|
}
|
|
|
|
/* mis en commentaire le 11/11/2018 pour augmenter le temp d'essai
|
|
var limit = 11;
|
|
*/
|
|
|
|
var limit = 21;
|
|
var ct = 1;
|
|
var timeout = 2000;
|
|
|
|
timer_register = $.timer(timeout, function()
|
|
{
|
|
console.log("Vérification en cours...");
|
|
user_checkverification(user_id);
|
|
if (ct>=limit || regStats==1)
|
|
{
|
|
timer_register.stop();
|
|
console.log("Vérification terminé!");
|
|
if (ct>=limit && regStats==0)
|
|
{
|
|
$('body').ajaxMask({ stop: true });
|
|
|
|
$("#okId" ).val("0");
|
|
|
|
v_msg="Echec identification!";
|
|
v_msgEng="Identification failed!";
|
|
alert_ebene(v_msg, v_msgEng);
|
|
|
|
/*
|
|
if (nbTentative==3)
|
|
{
|
|
envoyer_alert_tentative_fraude(user_id);
|
|
}
|
|
*/
|
|
}
|
|
if (regStats==1)
|
|
{
|
|
$('body').ajaxMask({ stop: true });
|
|
|
|
$("#okId" ).val("1");
|
|
|
|
facturation = $("#facturation").val();
|
|
|
|
if(facturation==1)
|
|
{
|
|
codeProfil = $("#codeProfil_C" ).val();
|
|
codeTypeFacture = $("#codeTypeFacture_C" ).val();
|
|
|
|
if(codeTypeFacture=="PHAR")
|
|
{
|
|
facturer_pha();
|
|
}
|
|
else if(codeTypeFacture=="CSO")
|
|
{
|
|
facturer_cso(user_id);
|
|
}
|
|
else if(codeTypeFacture=="OPT")
|
|
{
|
|
facturer_opt();
|
|
}
|
|
else if(codeTypeFacture=="MON")
|
|
{
|
|
facturer_monture(user_id);
|
|
}
|
|
else if(codeTypeFacture=="LAB")
|
|
{
|
|
facturer_lab(user_id);
|
|
}
|
|
else if(codeTypeFacture=="LABCSO")
|
|
{
|
|
facturer_lab_cso(user_id);
|
|
}
|
|
else if(codeTypeFacture=="SEA")
|
|
{
|
|
facturer_sea(user_id);
|
|
}
|
|
else if(codeTypeFacture=="SEACSO")
|
|
{
|
|
facturer_sea_cso(user_id);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
donnees_substitut = 'user_id_substitut='+user_id;
|
|
|
|
v_msg="Identification effectuée avec succès!";
|
|
v_msgEng="Identified successfully!";
|
|
alert_ebene(v_msg, v_msgEng);
|
|
|
|
$("#okId").val("1");
|
|
|
|
$.ajax({
|
|
url: $("#racineWeb").val()+"Ajaxcontextidentification/",
|
|
type : 'post',
|
|
data: donnees_substitut,
|
|
complete: function()
|
|
{
|
|
remplacerordonnance = $("#remplacerordonnance").val();
|
|
|
|
if(remplacerordonnance==1)
|
|
{
|
|
fiche_remplacer_ordonnance();
|
|
}
|
|
else
|
|
{
|
|
dossiers("1");
|
|
}
|
|
}
|
|
});
|
|
|
|
/*
|
|
remplacerordonnance = $("#remplacerordonnance").val();
|
|
|
|
if(remplacerordonnance==1)
|
|
{
|
|
fiche_remplacer_ordonnance();
|
|
}
|
|
else
|
|
{
|
|
dossiers("1");
|
|
}
|
|
*/
|
|
}
|
|
}
|
|
}
|
|
ct++;
|
|
});
|
|
}
|
|
|
|
function user_checkverification(user_id)
|
|
{
|
|
$.ajax({
|
|
url : "flexcode/user.php?action=checkver&user_id="+user_id,
|
|
type : "GET",
|
|
success : function(data)
|
|
{
|
|
try
|
|
{
|
|
var res = jQuery.parseJSON(data);
|
|
console.log("res : "+res);
|
|
if (res.result)
|
|
{
|
|
regStats = 1;
|
|
}
|
|
}
|
|
catch(err)
|
|
{
|
|
alert(err.message);
|
|
}
|
|
}
|
|
});
|
|
}
|
|
// fin ajout du 26/05/2017 pour la vérification
|
|
|
|
</script>
|
|
|
|
<br>
|
|
|
|
<?php
|
|
$register = '';
|
|
$verification = '';
|
|
|
|
// $long_link
|
|
|
|
$url_register = base64_encode($_SESSION['p_lienServeur'] . "/flexcode/register.php?user_id=".$user_id);
|
|
$url_verification = base64_encode($_SESSION['p_lienServeur'] . "/flexcode/verification.php?user_id=".$user_id);
|
|
|
|
if ($finger == 0)
|
|
{
|
|
if (isset($_SESSION['p_lang']) && $_SESSION['p_lang']=="en_US")
|
|
{
|
|
echo "<a class='form-control btn btn-danger' style='font-size:10pt;' href='finspot:FingerspotReg;$url_register' onclick=\"user_register('".$user_id."','".$user_name."')\">Start Enrollment </a>";
|
|
}
|
|
else
|
|
{
|
|
echo "<a class='form-control btn btn-danger' style='font-size:10pt;' href='finspot:FingerspotReg;$url_register' onclick=\"user_register('".$user_id."','".$user_name."')\">Démarrer Enrôlement </a>";
|
|
}
|
|
}
|
|
// else
|
|
elseif ($finger <> -1)
|
|
{
|
|
initJeton($user_id);
|
|
|
|
if (isset($_GET['facturation']))
|
|
{
|
|
if (isset($_SESSION['p_lang']) && $_SESSION['p_lang']=="en_US")
|
|
{
|
|
echo "<a id='btn_check_id' name='btn_check_id' class='form-control btn btn-primary' style='font-size:10pt;' href='finspot:FingerspotVer;$url_verification' onclick=\"user_verification('".$user_id."')\" > Start Billing </a>";
|
|
}
|
|
else
|
|
{
|
|
echo "<a id='btn_check_id' name='btn_check_id' class='form-control btn btn-primary' style='font-size:10pt;' href='finspot:FingerspotVer;$url_verification' onclick=\"user_verification('".$user_id."')\" > Démarrer la facturation </a>";
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if (isset($_SESSION['p_lang']) && $_SESSION['p_lang']=="en_US")
|
|
{
|
|
echo "<a id='btn_check_id' name='btn_check_id' class='form-control btn btn-primary' style='font-size:10pt;' href='finspot:FingerspotVer;$url_verification' onclick=\"user_verification('".$user_id."')\" > Start Identity Verification </a>";
|
|
}
|
|
else
|
|
{
|
|
echo "<a id='btn_check_id' name='btn_check_id' class='form-control btn btn-primary' style='font-size:10pt;' href='finspot:FingerspotVer;$url_verification' onclick=\"user_verification('".$user_id."')\" > Démarrer Vérification Identité </a>";
|
|
}
|
|
}
|
|
}
|
|
|
|
$user = getSurrogates($user_id);
|
|
|
|
if (count($user) > 0)
|
|
{
|
|
if (isset($_SESSION['p_lang']) && $_SESSION['p_lang']=="en_US")
|
|
{
|
|
echo "<table class='table table-bordered table-hover'>"
|
|
."<thead>"
|
|
."<tr>"
|
|
."<th style='text-align:center' width='60%'>Substitution Fingerprints</th>"
|
|
."<th style='text-align:center' class='col-md-4'>Action</th>"
|
|
."</tr>"
|
|
."</thead>"
|
|
."<tbody>";
|
|
}
|
|
else
|
|
{
|
|
echo "<table class='table table-bordered table-hover'>"
|
|
."<thead>"
|
|
."<tr>"
|
|
."<th style='text-align:center' width='60%'>Empreintes de substitution </th>"
|
|
."<th style='text-align:center' class='col-md-4'>Action</th>"
|
|
."</tr>"
|
|
."</thead>"
|
|
."<tbody>";
|
|
}
|
|
|
|
foreach ($user as $row)
|
|
{
|
|
$user_id_s = $row['user_id'];
|
|
|
|
$url_verification = base64_encode($_SESSION['p_lienServeur'] . "/flexcode/verification.php?user_id=".$user_id_s);
|
|
|
|
initJeton($user_id_s);
|
|
|
|
if (isset($_GET['facturation']))
|
|
{
|
|
if (isset($_SESSION['p_lang']) && $_SESSION['p_lang']=="en_US")
|
|
{
|
|
$verification = "<a style='font-size:10pt;' href='finspot:FingerspotVer;$url_verification' onclick=\"user_verification('".$user_id_s."')\" > Substitute </a>";
|
|
}
|
|
else
|
|
{
|
|
$verification = "<a style='font-size:10pt;' href='finspot:FingerspotVer;$url_verification' onclick=\"user_verification('".$user_id_s."')\" > Substituer </a>";
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if (isset($_SESSION['p_lang']) && $_SESSION['p_lang']=="en_US")
|
|
{
|
|
$verification = "<a style='font-size:10pt;' href='finspot:FingerspotVer;$url_verification' onclick=\"user_verification('".$user_id_s."')\" > Substitute </a>";
|
|
}
|
|
else
|
|
{
|
|
$verification = "<a style='font-size:10pt;' href='finspot:FingerspotVer;$url_verification' onclick=\"user_verification('".$user_id_s."')\" > Substituer </a>";
|
|
}
|
|
}
|
|
|
|
echo "<tr>"
|
|
."<td align='center'>".$row['user_name']."</td>"
|
|
."<td align='center'>"
|
|
."$verification"
|
|
."</td>"
|
|
."</tr>";
|
|
|
|
}
|
|
|
|
echo
|
|
"</tbody>";
|
|
|
|
// Fin Emprientes de subtitution
|
|
} else
|
|
{
|
|
if (isset($_SESSION['p_lang']) && $_SESSION['p_lang']=="en_US")
|
|
{
|
|
echo "No substitute!";
|
|
}
|
|
else
|
|
{
|
|
echo "Pas de substitut!";
|
|
}
|
|
}
|
|
}
|
|
elseif (isset ($_GET['action']) && $_GET['action'] == 'checkreg')
|
|
{
|
|
$result1 = getFingerCountUser($_GET['user_id']);
|
|
|
|
$ct=$result1['0']['ct'];
|
|
if (intval($ct) > intval($_GET['current']))
|
|
{
|
|
$res['result'] = true;
|
|
$res['current'] = intval($ct);
|
|
}
|
|
else
|
|
{
|
|
$res['result'] = false;
|
|
}
|
|
|
|
echo json_encode($res);
|
|
|
|
}
|
|
elseif (isset ($_GET['action']) && $_GET['action'] == 'checkver')
|
|
{
|
|
/*
|
|
Non testé => succes = "0"
|
|
Echec => succes = "9"
|
|
Reussite => succes = "1"
|
|
*/
|
|
$result1 = checkFinger($_GET['user_id']);
|
|
|
|
$succes=$result1['0']['succes'];
|
|
if (intval($succes) == 1)
|
|
{
|
|
$res['result'] = true;
|
|
}
|
|
else
|
|
{
|
|
$res['result'] = false;
|
|
}
|
|
|
|
echo json_encode($res);
|
|
|
|
}
|
|
else
|
|
{
|
|
echo "Parameter invalid..";
|
|
}
|
|
?>
|