Found lazy way to create api

This commit is contained in:
Ibnu Maksum
2024-03-31 21:23:19 +07:00
parent 4bf6f9c0ac
commit ee73621c85
5 changed files with 50 additions and 31 deletions

View File

@ -11,7 +11,9 @@ if (realpath(__FILE__) == realpath($_SERVER['SCRIPT_FILENAME'])) {
die();
}
$root_path = realpath(dirname(__FILE__)) . DIRECTORY_SEPARATOR;
$isApi = false;
if(!isset($isApi)){
$isApi = false;
}
// on some server, it getting error because of slash is backwards
function _autoloader($class)
{
@ -243,6 +245,13 @@ function sendWhatsapp($phone, $txt)
function r2($to, $ntype = 'e', $msg = '')
{
global $isApi;
if ($isApi) {
showResult(
($ntype=='s')? true : false,
$msg
);
}
if ($msg == '') {
header("location: $to");
exit;