33 lines
849 B
PHP
33 lines
849 B
PHP
<?php
|
|
class Awb extends MY_Controller {
|
|
function __construct() {
|
|
parent::__construct();
|
|
}
|
|
function show($db,$id) {
|
|
$sql = "select * from $db.inbox
|
|
where id = $id";
|
|
$qry = $this->db->query($sql);
|
|
if(!$qry) {
|
|
echo "Err : " . $this->db->error()["message"];
|
|
exit;
|
|
}
|
|
$rows = $qry->result_array();
|
|
if (count($rows) == 0) {
|
|
echo "No record for $db.inbox id : $id ";
|
|
exit;
|
|
}
|
|
$data = $rows[0]["data"];
|
|
echo "tanggal : " . $rows[0]["tgl"] . "<br/>\n";
|
|
echo $this->hexToString($data);
|
|
}
|
|
function hexToString($data) {
|
|
$result = "";
|
|
$arr = explode(" ",$data);
|
|
foreach($arr as $hex) {
|
|
if ( trim($hex) == "" ) continue;
|
|
$result = $result . chr(hexdec(trim($hex)));
|
|
}
|
|
return $result;
|
|
}
|
|
}
|