Add ZK library classes for device interaction and user management

- Implemented Os class for retrieving OS information.
- Added Pin class for getting PIN width.
- Created Platform class for fetching platform details and version.
- Developed SerialNumber class to retrieve device serial number.
- Introduced Ssr class for SSR information retrieval.
- Implemented Time class for setting and getting device time.
- Added User class for user management including setting, getting, clearing, and removing users.
- Created Util class with various utility functions for command handling and data processing.
- Implemented Version class for fetching device version.
- Added WorkCode class for retrieving work code information.
- Set up Composer autoloading for the ZK library.
This commit is contained in:
2025-06-25 17:25:23 +07:00
commit 5bec63d9cd
39 changed files with 10171 additions and 0 deletions

89
controller/libconfig.php Normal file
View File

@ -0,0 +1,89 @@
<?php
if(preg_match("/libconfig.php/i", $_SERVER['PHP_SELF'])){header("location: index.php");die;}
class MY_LIBRARY
{
public function __construct()
{
//$return=true;
$clhtml=new MY_HTML();
//if(!isset($_SESSION['nik'])){$clhtml->mosRedirect("D.H.T.M.L.X");}
}
public function fn_row_isexists($query)
{
$rtn=false;
$rschk=mysql_query($query) or die(mysql_error());
if($rschk)
{
if(mysql_num_rows($rschk)>0){$rtn=true;}
}
$this->clearrecordset($rschk);
return $rtn;
}
public function fn_get_fieldsvalues($fieldsname,$query)
{
$rtn='';
$spfields=explode(",",trim($fieldsname));
$rsgetvalue=$this->selectquery($query);
if($rsgetvalue)
{
if(mysql_num_rows($rsgetvalue)>0)
{
$rw=mysql_fetch_object($rsgetvalue);
for($i=0;$i<=count($spfields)-1;$i++)
{
$rtn.=$rw->$spfields[$i]."|";
}
$rtn=substr($rtn,0,strlen($rtn)-1);
}
}
$this->clearrecordset($rsgetvalue);
$rtn=explode("|",$rtn);
return $rtn;
}
public function selectquery($query,$mysql_error=null)
{
$rsqry=@mysql_query($query);
if(!$mysql_error){$mysql_error=mysql_error();}
if(!$rsqry){echo $mysql_error;return false;}
return $rsqry;
}
public function data_row_object($recordset)
{
return mysql_fetch_object($recordset);
}
public function data_row_array($recordset)
{
return mysql_fetch_array($recordset);
}
public function field_length($recordset)
{
return mysql_num_fields($recordset);
}
public function getErrorQuery()
{
return $this->errquery;
}
public function executequery($query)
{
if(mysql_query($query))
{return true;}
else
{$this->errquery=mysql_error(); die(mysql_error());return false;}
}
public function REC_ROWS_COUNT($recordset){return mysql_num_rows($recordset);}
}
?>

29
controller/libdbconn.php Normal file
View File

@ -0,0 +1,29 @@
<?php
/*
* Connects to the database using the parameters from above.
* BE SURE TO CHANGE THE DATABASE PARAMS TO REFLECT YOUR DATABASE SETTINGS!
*/
function dbconnect()
{
try
{
//echo DB_HOST_NAME.' '.DB_USER_NAME.' '.DB_USER_PASS;
mysql_connect(DB_HOST_NAME,DB_USER_NAME,DB_USER_PASS);
//$db = new PDO("mysql:host=".DB_HOST_NAME.";dbname=".DB_IMS.";charset=utf8", DB_USER_NAME, DB_USER_PASS);
@mysql_select_db(DB_HCM) or die (mysql_error()." ".DB_HOST_NAME." ");
}
catch(Exception $e)
{
echo "line : ".$e->getLine()." ".$e->getMessage();
}
//include("config.php");
//mysql_connect($opts["hn"], $opts["un"],$opts["pass"]);
// @mysql_select_db($opts["db"]) or die (mysql_error());
}
dbconnect();
$dbconnect = 1;
?>

11
controller/libdefine.php Normal file
View File

@ -0,0 +1,11 @@
<?php
if(preg_match("/libdefine.php/i", $_SERVER['PHP_SELF'])){header("location: index.php");die;}
// ==== My SERVER CONFIG
DEFINE("DB_HCM","dbhcm");
// DEFINE("DB_HOST_NAME","localhost");
DEFINE("DB_HOST_NAME","192.168.1.4");
// DEFINE("DB_USER_NAME","antrian");
// DEFINE("DB_USER_NAME","appproject");
DEFINE("DB_USER_NAME","apphcm");
DEFINE('DB_USER_PASS',"\$ppHCMTT#2024"); //pmmr
?>