Initial commit for newdesigngestionnaire project
This commit is contained in:
363
flexcode/user.php
Executable file
363
flexcode/user.php
Executable file
@@ -0,0 +1,363 @@
|
||||
<?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');
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
$('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)
|
||||
{
|
||||
$('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);
|
||||
|
||||
prestations();
|
||||
}
|
||||
}
|
||||
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)
|
||||
{
|
||||
$('body').ajaxMask();
|
||||
|
||||
regStats = 0;
|
||||
|
||||
try
|
||||
{
|
||||
timer_register.stop();
|
||||
}
|
||||
catch(err)
|
||||
{
|
||||
console.log('Démarrage de la Vérification');
|
||||
}
|
||||
|
||||
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 });
|
||||
|
||||
v_msg="Echec identification!";
|
||||
v_msgEng="Identification failed!";
|
||||
alert_ebene(v_msg, v_msgEng);
|
||||
}
|
||||
if (regStats==1)
|
||||
{
|
||||
$('body').ajaxMask({ stop: true });
|
||||
|
||||
v_msg="Identification effectuée avec succès!";
|
||||
v_msgEng="Identified successfully!";
|
||||
alert_ebene(v_msg, v_msgEng);
|
||||
|
||||
$.ajax({
|
||||
url: $("#racineWeb").val()+"Ajaxcontextidentification/",
|
||||
type : 'post'
|
||||
});
|
||||
}
|
||||
}
|
||||
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['lienServeur'] . "/flexcode/register.php?user_id=".$user_id);
|
||||
$url_verification = base64_encode($_SESSION['lienServeur'] . "/flexcode/verification.php?user_id=".$user_id);
|
||||
|
||||
if ($finger == 0)
|
||||
{
|
||||
if (est_anglophone())
|
||||
{
|
||||
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
|
||||
{
|
||||
initJeton($user_id);
|
||||
|
||||
if (isset($_GET['facturation']))
|
||||
{
|
||||
if (est_anglophone())
|
||||
{
|
||||
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 (est_anglophone())
|
||||
{
|
||||
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>";
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if ($finger != 0)
|
||||
{ // Début Emprientes de subtitution
|
||||
|
||||
$user = getSurrogates($user_id);
|
||||
|
||||
if (count($user) > 0)
|
||||
{
|
||||
if (est_anglophone())
|
||||
{
|
||||
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['lienServeur'] . "/flexcode/verification.php?user_id=".$user_id_s);
|
||||
|
||||
initJeton($user_id_s);
|
||||
|
||||
if (isset($_GET['facturation']))
|
||||
{
|
||||
if (est_anglophone())
|
||||
{
|
||||
$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 (est_anglophone())
|
||||
{
|
||||
$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 (est_anglophone())
|
||||
{
|
||||
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..";
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user