samedi 18 avril 2015

Flexcode SDK : I want to search (globel search with single button) record on the basis of finger print impression without using any user_id

I am integrating flexcodeSDK with my application using php and mysql. I am trying to register a new record . As per the demo given, it is mandatory to pass the user id of user for whom i am adding the finger prints.


But in my application i am registering finger prints in the first step of registration (Add User) so there is no user ID. Now how do i handle this case?


Actually my requirement is that i want to search ( global search with single button ) record from database on the basis of perticular finger print.Please help. Here is my code


process_verification.php



<?php if (isset($_POST['VerPas']) && !empty($_POST['VerPas'])) {

include 'include/global.php';
include 'include/function.php';

$data = explode(";",$_POST['VerPas']);
$user_id = $data[0];
$vStamp = $data[1];
$time = $data[2];
$sn = $data[3];

$fingerData = getUserFinger($user_id);
$device = getDeviceBySn($sn);

$salt = md5($sn.$fingerData[0]['finger_data'].$device[0]['vc'].$time.$user_id.$device[0]['vkey']);

if (strtoupper($vStamp) == strtoupper($salt)) {

$log = createLog($user_id, $time, $sn);

if ($log == 1) {

echo $base_path."messages.php?user_id=$user_id&time=$time";

} else {

echo $base_path."messages.php?msg=$log";

}

} else {

$msg = "Parameter invalid..";

echo $base_path."messages.php?msg=$msg";

}


}


?>


process_register.php



<?php if (isset($_POST['RegTemp']) && !empty($_POST['RegTemp'])) {

include 'include/global.php';
include 'include/function.php';

$data = explode(";",$_POST['RegTemp']);
$vStamp = $data[0];
$sn = $data[1];
$user_id = $data[2];
$regTemp = $data[3];

$device = getDeviceBySn($sn);

$salt = md5($device[0]['ac'].$device[0]['vkey'].$regTemp.$sn.$user_id);

if (strtoupper($vStamp) == strtoupper($salt)) {

$sql1 = "SELECT MAX(finger_id) as fid FROM demo_finger WHERE user_id=".$user_id;
$result1 = mysql_query($sql1);
$data = mysql_fetch_array($result1);
$fid = $data['fid'];

if ($fid == 0) {
$sq2 = "INSERT INTO demo_finger SET user_id='".$user_id."', finger_id=".($fid+1).", finger_data='".$regTemp."' ";
$result2 = mysql_query($sq2);
if ($result1 && $result2) {
$res['result'] = true;
} else {
$res['server'] = "Error insert registration data!";
}
} else {
$res['result'] = false;
$res['user_finger_'.$user_id] = "Template already exist.";
}

echo "empty";

} else {

$msg = "Parameter invalid..";

echo $base_path."messages.php?msg=$msg";

}


}


?>


1 commentaire: