1. Go to this page and download the library: Download onnysan/device-security library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
onnysan / device-security example snippets
use Security\Lib\Services\Security;
class MyClass
{
protected $sc;
public function __construct()
{
$this->sc = new Security();
}
public function MyFunction()
{
/* Contoh penerapan :
* apakah perangkat diijinkan masuk
* jika data tersedia di db maka akan allow(return true)
* jika error akan return error message(array dengan key error)
*/
$result = $this->sc->isPerangkatAllowed("00:A0:C9:14:C8:29");
if(isset($result['error'])){
echo json_encode($result);
exit();
}
}
use Security\Lib\Services\Security;
class MyClass
{
protected $sc;
public function __construct()
{
$this->sc = new Security();
}
public function MyFunction()
{
/* Contoh penerapan :
* apakah perangkat diijinkan masuk
* jika data tersedia di db maka akan allow(return true)
* jika error akan return error message(array dengan key error)
*/
$result = $this->sc->isAkunAllowed("myakunname");
if(isset($result['error'])){
echo json_encode($result);
exit();
}
}
use Security\Lib\Services\Security;
class MyClass
{
protected $sc;
public function __construct()
{
$this->sc = new Security();
}
public function MyFunction()
{
/* Contoh penerapan :
* apakah perangkat diijinkan masuk
* jika data tersedia di db maka akan allow(return true)
* jika error akan return error message(array dengan key error)
*/
$result = $this->sc->isAkunDanPerangkatAllowed("idAkun", "idPerangkat");
if(isset($result['error'])){
echo json_encode($result);
exit();
}
}
use Security\Lib\Services\SecurityCreator;
class Example extends CI_Controller
{
protected $sc;
public function __construct()
{
parent::__construct();
$this->sc = new SecurityCreator();
}
public function tambahPerangkat()
{
$data = [];
$result = $this->sc->addPerangkat($data);
if(isset($result['error'])){
echo '<pre>';
print_r($result);
return;
}
}
}
use Security\Lib\Services\SecurityCreator;
use Security\Lib\Services\SecurityRemover;
class Example extends CI_Controller
{
protected $sc;
public function __construct()
{
parent::__construct();
$this->sc = new SecurityCreator();
}
public function removePerangkat()
{
$scr = new SecurityRemover();
$id = "bot";
$result = $scr->removePerangkat($id);
if (isset($result['error'])) {
echo '<pre>';
print_r($result);
return;
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.