dhiforester

HasilGenerateSignature

Dec 18th, 2023
190
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.19 KB | Source Code | 0 0
  1. <?php
  2.     date_default_timezone_set('UTC');
  3.     include "../../_Config/Connection.php";
  4.     include "../../_Config/Function.php";
  5.     if(!empty($_POST['id_pengaturan'])){
  6.         $id_pengaturan=$_POST['id_pengaturan'];
  7.     }else{
  8.         $id_pengaturan="";
  9.     }
  10.     $profile_pengaturan=getDataDetail($Conn,'pengaturan','id_pengaturan',$id_pengaturan,'profile_pengaturan');
  11.     $kategori_pengaturan=getDataDetail($Conn,'pengaturan','id_pengaturan',$id_pengaturan,'kategori_pengaturan');
  12.     $pengaturan=getDataDetail($Conn,'pengaturan','id_pengaturan',$id_pengaturan,'pengaturan');
  13.     $status=getDataDetail($Conn,'pengaturan','id_pengaturan',$id_pengaturan,'status');
  14.     $pengaturan = json_decode($pengaturan, true);
  15.     $url_api=$pengaturan['url_api'];
  16.     $cons_id=$pengaturan['cons_id'];
  17.     $user_key=$pengaturan['user_key'];
  18.     $secret_key=$pengaturan['secret_key'];
  19.     $kode_ppk=$pengaturan['kode_ppk'];
  20.     $timestamp = strval(time()-strtotime('1970-01-01 00:00:00'));
  21.     //Creat Signature
  22.     $signature = hash_hmac('sha256', $cons_id."&".$timestamp, $secret_key, true);
  23.     // base64 encode…
  24.     $encodedSignature = base64_encode($signature);
  25.     echo $encodedSignature;
  26. ?>
Tags: sim
Add Comment
Please, Sign In to add comment