Add SPOTA core PHP application

Add the main admin, dosen, mahasiswa, API, and service code needed to run the core legacy application with configurable upload storage.
This commit is contained in:
Power BI Dev
2026-05-02 10:08:52 +07:00
parent 874dbbe8e8
commit efdb11db3f
221 changed files with 43273 additions and 0 deletions

View File

@@ -0,0 +1,152 @@
<?php
$base_url = 'http://203.24.50.140';
$jsonNomor = file_get_contents("$base_url/baileys_api_php/get_list_session_wa.php");
$listNomor = [];
if(!empty($jsonNomor)){
$listNomor = json_decode($jsonNomor, true);
}
$response = "";
if(isset($_POST['simpanData'])){
$nomor = $_POST['nomor'];
//if(in_array($nomor, $listNomor)){
$hapus = file_get_contents("$base_url:8000/session/delete/$nomor", false, stream_context_create(array( 'http' => array( 'method' => 'DELETE' ) )) );
//}
$data = [
'id' => $nomor,
'isLegacy' => false,
];
/**
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => $base_url.':8000/session/add',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => http_build_query($data),
]);
$response = curl_exec($curl);
*/
$postData = http_build_query($data);
$opts = ['http' =>
[
'method' => 'POST',
'ignore_errors' => true,
'header' => 'Content-Type: application/x-www-form-urlencoded',
'content' => $postData
]
];
$context = stream_context_create($opts);
$response = file_get_contents($base_url.':8000/session/add', false, $context);
$decodedResponse = json_decode($response, true);
$resultQR = "";
if(isset($decodedResponse['success'])){
$success = (bool) $decodedResponse['success'];
$msg = $decodedResponse['message'];
if($success){
$base64QR = $decodedResponse['data']['qr'];
$resultQR = "status : $success, pesan : $msg"."<br>"."<img src='$base64QR' alt='qr-code'>";
}
}else{
$resultQR = $response.' '.'Tidak dapat terhubung dengan API';
}
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>List Session WA Gateway</title>
<link
rel="stylesheet"
href="steven/libs/Semantic/Fomantic-UI/semantic.css"
type="text/css"
charset="utf-8"
/>
<link
rel="stylesheet"
href="steven/libs/DataTable/datatables.min.css"
type="text/css"
charset="utf-8"
/>
<script src="steven/libs/jquery-3.3.1.js"></script>
<script src="steven/libs/Semantic/Fomantic-UI/semantic.min.js"></script>
<script src="steven/libs/DataTable/datatables.min.js"></script>
</head>
<body>
<div class="ui segment container">
<h3 class="ui header">List Sesi WA Gateway</h3>
<table class="ui structured celled table">
<thead>
<tr>
<th>No.</th>
<th>Nomor</th>
<th>Hapus</th>
</tr>
</thead>
<tbody>
<?php
$no = 1;
foreach($listNomor as $key => $val){
$btnHapusSesi = "<button onClick='hapusSesiIni($val)' class='ui red button'>Hapus Sesi Ini</button>";
echo "<tr><td>$no</td><td>$val</td><td>$btnHapusSesi</td></tr>";
$no++;
}
?>
</tbody>
</table>
<form class="ui form" style="margin-top:1rem" method="POST" target="">
<div class="field">
<label>Nomor WA (62xxxxxxxxx) (Dengan mengklik tombol SIMPAN, maka sesi lama untuk nomor tsb akan terhapus)</label>
<input type="text" name="nomor" placeholder="Masukkan Nomor WA (62xxxxxxxxx)">
</div>
<input type="submit" name="simpanData" class="ui blue button" value="SIMPAN">
</form>
<?php if(isset($_POST['simpanData'])){ ?>
<div class="ui segment" style="margin-top:1rem">
<h3 class="ui header">Respon Server</h3>
<?php echo $resultQR; ?>
<br>
<br><br>
<a href="./create-session-wa-gateway.php">Klik disini jika sudah berhasil scan QRCode</a>
</div>
<?php } ?>
</div>
</body>
</html>
<script>
function hapusSesiIni(nomor){
let text = `Hapus Sesi ${nomor}`;
if (confirm(text) == true) {
window.location = "./hapus_sesi_wa.php?sesi="+nomor;
}
}
</script>