Minggu, 18 Agustus 2024

Selisih Waktu Berjalan

Berikut adalah fungsi PHP yang menghitung selisih hari antara tanggal saat ini dengan tanggal 2024-08-22. Jika tanggal saat ini kurang dari 2024-08-22, maka fungsi akan mengembalikan jumlah hari yang tersisa. Jika tanggal saat ini sudah melewati 2024-08-22, maka fungsi tidak akan menampilkan apa pun.


function hitungSelisihHari($targetDate = '2024-08-22') {
    $currentDate = date('Y-m-d');
    
    // Konversi tanggal menjadi objek DateTime
    $currentDateTime = new DateTime($currentDate);
    $targetDateTime = new DateTime($targetDate);
    
    // Hitung selisih hari
    if ($currentDateTime < $targetDateTime) {
        $interval = $currentDateTime->diff($targetDateTime);
        echo "Selisih hari: " . $interval->days . " hari";
    } else {
        // Jika tanggal sudah lewat, tidak tampilkan apapun
        echo "";
    }
}

// Contoh penggunaan
hitungSelisihHari(); 



function is24HoursPassed($bookingDate) {
    // Convert the booking date to a timestamp
    $bookingTimestamp = strtotime($bookingDate);

    // Get the current timestamp
    $currentTimestamp = time();

    // Calculate the difference in seconds
    $differenceInSeconds = $currentTimestamp - $bookingTimestamp;

    // Check if the difference is greater than or equal to 24 hours (86400 seconds)
    if ($differenceInSeconds >= 86400) {
        return 1;
    } else {
        return 0;
    }
}


function spot($str,$N){
return wordwrap($str,$N,"<br>\n");
}
function kirimWA($HP,$PESAN){
echo "$HP,$PESAN";
$curl = curl_init(); 
curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://api.fonnte.com/send',
  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 => array(
'target' => $HP,
'message' => $PESAN, 
'countryCode' => '62', //optional
),
  CURLOPT_HTTPHEADER => array(
'Authorization: NzTx3XXXXX'
  ),
)); 
$response = curl_exec($curl);
if (curl_errno($curl)) {
  $error_msg = curl_error($curl);
}
curl_close($curl);

if (isset($error_msg)) {
echo $error_msg;
}
echo $response;
}


function sentWA($conn, $id_pinjam, $id_anggota, $telepon, $pesan, $keterangan)
{
  date_default_timezone_set("Asia/Jakarta");
  $tanggal = date("Y-m-d");
  $jam = date("H:i:s");

  $sql = "INSERT INTO `tb_wa` (`idw`, `tanggal`, `jam`, `id_pinjam`,`id_anggota`, `telepon`, `pesan`, `keterangan`) VALUES ('', '$tanggal', '$jam', '$id_pinjam','$id_anggota', '$telepon', '$pesan', '$keterangan')";
  $s = false;
  $conn->autocommit(FALSE);
  try {
    $rs = $conn->query($sql);
    if ($rs) {
      $conn->commit();
      $last_inserted_id = $conn->insert_id;
      $affected_rows = $conn->affected_rows;
      $s = true;
    }
  } catch (Exception $e) {
    echo 'fail: ' . $e->getMessage();
    $conn->rollback();
  }
  $conn->autocommit(TRUE);
  return $s;
}
function RP($rupiah){
return number_format($rupiah, "2", ",", ".");
}  


function getR($digits) {
  $temp = "";
  for ($i = 0; $i < $digits; $i++) {
    $temp .= rand(0, 9);
  }
  return (int)$temp;
}
function saveWA2($conn,$id_pinjam,$id_anggota,$telepon,$pesan){
return 0;
}

function randomPassword() {
    $alphabet = "abcdefghijklmnopqrstuwxyzABCDEFGHIJKLMNOPQRSTUWXYZ0123456789";
$gab="";
    for ($i = 0; $i < 8; $i++) {//8 karakter
        $n = rand(0, count($alphabet)-1);
       // $pass[$i] = $alphabet[$n];
   $gab.= $alphabet[$n];;
    }
    return $gab;
}
function saveWA($conn,$id_pinjam,$id_anggota,$telepon,$pesan){
date_default_timezone_set("Asia/Jakarta");
$tanggal=date("Y-m-d");
$jam=date("H:i:s");
$sql="INSERT INTO `tb_wa` ( `tanggal`, `jam`, `id_pinjam`, `id_anggota`, `telepon`, `pesan`, `keterangan`) VALUES ('$tanggal', '$jam', '$id_pinjam', '$id_anggota', '$telepon', '$pesan', '')";
$pro=process($conn,$sql);
$reply = ["message" => "$pesan",];
kirimWA($telepon,$pesan);
return $pro;
}


function terbilang($i){
  $huruf = array("", "Satu", "Dua", "Tiga", "Empat", "Lima", "Enam", "Tujuh", "Delapan", "Sembilan", "Sepuluh", "Sebelas");
 
  if ($i < 12) return " " . $huruf[$i];
  elseif ($i < 20) return terbilang($i - 10) . " Belas";
  elseif ($i < 100) return terbilang($i / 10) . " Puluh" . terbilang($i % 10);
  elseif ($i < 200) return " Seratus" . terbilang($i - 100);
  elseif ($i < 1000) return terbilang($i / 100) . " Ratus" . terbilang($i % 100);
  elseif ($i < 2000) return " Seribu" . terbilang($i - 1000);
  elseif ($i < 1000000) return terbilang($i / 1000) . " Ribu" . terbilang($i % 1000);
  elseif ($i < 1000000000) return terbilang($i / 1000000) . " Juta" . terbilang($i % 1000000);   


function BAL($tanggal){
$arr=explode(" ",$tanggal);
if($arr[1]=="Januari"||$arr[1]=="January"){$bul="01";}
else if($arr[1]=="Februari"||$arr[1]=="February"){$bul="02";}
else if($arr[1]=="Maret"||$arr[1]=="March"){$bul="03";}
else if($arr[1]=="April"){$bul="04";}
else if($arr[1]=="Mei"||$arr[1]=="May"){$bul="05";}
else if($arr[1]=="Juni"||$arr[1]=="June"){$bul="06";}
else if($arr[1]=="Juli"||$arr[1]=="July"){$bul="07";}
else if($arr[1]=="Agustus"||$arr[1]=="August"){$bul="08";}
else if($arr[1]=="September"){$bul="09";}
else if($arr[1]=="Oktober"||$arr[1]=="October"){$bul="10";}
else if($arr[1]=="November"){$bul="11";}
else if($arr[1]=="Nopember"){$bul="11";}
else if($arr[1]=="Desember"||$arr[1]=="December"){$bul="12";}
return "$arr[2]-$bul-$arr[0]";


function BALP($tanggal){
$arr=explode(" ",$tanggal);
if($arr[1]=="Jan"){$bul="01";}
else if($arr[1]=="Feb"){$bul="02";}
else if($arr[1]=="Mar"){$bul="03";}
else if($arr[1]=="Apr"){$bul="04";}
else if($arr[1]=="Mei"){$bul="05";}
else if($arr[1]=="Jun"){$bul="06";}
else if($arr[1]=="Jul"){$bul="07";}
else if($arr[1]=="Agu"){$bul="08";}
else if($arr[1]=="Sep"){$bul="09";}
else if($arr[1]=="Okt"){$bul="10";}
else if($arr[1]=="Nov"){$bul="11";}
else if($arr[1]=="Nop"){$bul="11";}
else if($arr[1]=="Des"){$bul="12";}
return "$arr[2]-$bul-$arr[0]";


function WKT($sekarang){
if ($sekarang == "0000-00-00") {
$sekarang = date("Y-m-d");
}

$tanggal = substr($sekarang, 8, 2) + 0;
$bulan = substr($sekarang, 5, 2);
$tahun = substr($sekarang, 0, 4);

$judul_bln = array(1 => "Januari", "Februari", "Maret", "April", "Mei", "Juni", "Juli", "Agustus", "September", "Oktober", "November", "Desember");
$wk = $tanggal . " " . $judul_bln[(int)$bulan] . " " . $tahun;
return $wk;


function WKTP($sekarang){
$tanggal = substr($sekarang, 8, 2) + 0;
$bulan = substr($sekarang, 5, 2);
$tahun = substr($sekarang, 2, 2);

$judul_bln = array(1 => "Jan", "Feb", "Mar", "Apr", "Mei", "Jun", "Jul", "Agu", "Sep", "Okt", "Nov", "Des");
$wk = $tanggal . " " . $judul_bln[(int)$bulan] . "'" . $tahun;
return $wk;


function saveLog($conn,$id_pengunjung,$nama_pengunjung,$level,$catatan){
date_default_timezone_set("Asia/Jakarta");
$jam=date("H:i:s");
$tanggal = date("Y-m-d");
$sql="INSERT INTO `tb_bukutamu` (`id_bukutamu`, `id_pengunjung`, `nama_pengunjung`, `level`, `catatan`, `tanggal`, `jam`) 
VALUES ('', '$id_pengunjung', '$nama_pengunjung', '$level', '$catatan', '$tanggal', '$jam')";
process($conn, $sql);
return 1;

}

function process($conn, $sql){
$s = false;
$conn->autocommit(FALSE);
try {
$rs = $conn->query($sql);
if ($rs) {
$conn->commit();
$last_inserted_id = $conn->insert_id;
$affected_rows = $conn->affected_rows;
$s = true;
}
} catch (Exception $e) {
echo 'fail: ' . $e->getMessage();
$conn->rollback();
}
$conn->autocommit(TRUE);
return $s;
}

function getJum($conn, $sql){
$rs = $conn->query($sql);
$jum = $rs->num_rows;
$rs->free();
return $jum;
}

function getField($conn, $sql){
$rs = $conn->query($sql);
$rs->data_seek(0);
$d = $rs->fetch_assoc();
$rs->free();
return $d;
}

function getData($conn, $sql){
$rs = $conn->query($sql);
$rs->data_seek(0);
$arr = $rs->fetch_all(MYSQLI_ASSOC);
//foreach($arr as $row) {
//  echo $row['nama_kelas'] . '*<br>';
//}

$rs->free();
return $arr;
}

function getBukuDetail($conn, $kode){
//error_reporting(0);
$field = "judul";
$sql = "SELECT `$field` FROM `tb_buku` where `id_buku`='$kode'";
$rs = $conn->query($sql);
$rs->data_seek(0);
$row = $rs->fetch_assoc();
$rs->free();
return $row[$field];
}

function getAnggotaDetail($conn, $kode){
//error_reporting(0);
$field = "nama_anggota";
$sql = "SELECT `$field` FROM `tb_anggota` where `id_anggota`='$kode'";
$rs = $conn->query($sql);
$rs->data_seek(0);
$row = $rs->fetch_assoc();
$rs->free();
return $row[$field];
}

function getAdmin($conn, $kode){
//error_reporting(0);
$field = "nama_admin";
$sql = "SELECT `$field` FROM `tb_admin` where `id_admin`='$kode'";
$rs = $conn->query($sql);
$rs->data_seek(0);
$row = $rs->fetch_assoc();
$rs->free();
return $row[$field];
}

function getKategori($conn, $kode){
//error_reporting(0);
$field = "kategori";
$sql = "SELECT `$field` FROM `tb_kategori` where `id_kategori`='$kode'";
$rs = $conn->query($sql);
$rs->data_seek(0);
$row = $rs->fetch_assoc();
$rs->free();
return $row[$field];
}

function getBuku($conn, $kode){
//error_reporting(0);
$field = "judul";
$sql = "SELECT `$field` FROM `tb_buku` where `id_buku`='$kode'";
$rs = $conn->query($sql);
$rs->data_seek(0);
$row = $rs->fetch_assoc();
$rs->free();
return $row[$field];
}
function getListB($conn, $kode){
//error_reporting(0);
    $sql="select `id_buku` from `tb_detail` where `id_pinjam`='$kode' order by `idd` asc";
    $jum=getJum($conn,$sql);
$gab="";
if($jum > 0){
$arr=getData($conn,$sql);
foreach($arr as $d) {
$id_buku=$d["id_buku"];
$buku=getBuku($conn,$id_buku);
$gab.="$buku ($id_buku), ";
}
$gab.=" $jum buku";
}
else{$gab="Belum melakukan peminjaman buku...";}
return $gab;
}

function getListB2($conn, $kode){
// error_reporting(0);
    $sql="select `id_buku` from `tb_detail` where `id_pinjam`='$kode' order by `idd` asc";
    $jum=getJum($conn,$sql);
$gab="<ol>";
if($jum > 0){
$arr=getData($conn,$sql);
foreach($arr as $d) {
$id_buku=$d["id_buku"];
$buku=getBuku($conn,$id_buku);
$gab.="<li>$buku ($id_buku)</li>";
}
$gab.="</ol>$jum buku";
}
else{$gab="Belum melakukan peminjaman buku...";}
return $gab;
}
function getCek($conn, $id_anggota){
$sql = "SELECT `tb_detail`.`idd` FROM `tb_pinjam`,`tb_detail` where `tb_pinjam`.id_pinjam=`tb_detail`.id_pinjam  and tb_pinjam.`id_anggota`='$id_anggota' and (`tb_detail`.status_detail='Pinjam' or `tb_detail`.status_detail='Pesan')";
$jum=getJum($conn,$sql)+0;
return $jum;
}
function upBuku($conn, $id_buku){
$sql="select `stok` from `tb_buku` where `id_buku`='$id_buku'";
    $jum=getJum($conn,$sql);
if($jum > 0){
$d=getField($conn,$sql);
$stok=$d["stok"]+0;
if($stok<1){
$sql = "Update `tb_buku` set status='Tidak Tersedia' where id_buku='$id_buku'";
$pro=process($conn,$sql);
}
else{
$sql = "Update `tb_buku` set status='Tersedia' where id_buku='$id_buku'";
$pro=process($conn,$sql);
}
}
return 1;
}

#########################
index.php (Cek timer)

<?php
if (version_compare(phpversion(), "5.3.0", ">=")  == 1)
  error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED);
else
  error_reporting(E_ALL & ~E_NOTICE);
?>
<?php
session_start();
error_reporting(0);
require_once "konmysqli.php";

$mnu = "";
if (isset($_GET["mnu"])) {
  $mnu = $_GET["mnu"];
}
if (!isset($_SESSION["cid"])) {
  die("<script>location.href='login.php';</script>");
}



$max_buku = 2;
$max_hari = 14;
$denda = 1000;
$sql = "select `denda`,`max_hari`  from `tb_setting` order by `id_setting` desc";
$ada = getJum($conn, $sql);
if ($ada > 0) {
  $d = getField($conn, $sql);
  $denda = $d["denda"];
  $max_hari = $d["max_hari"];
}
$rpdenda = $denda;
$today = date("Y-m-d");

$sql = "select * from `$tbpinjam` where status='Pinjam' order by `id_pinjam` asc";
$jum = getJum($conn, $sql);
if ($jum > 0) {
  $arr = getData($conn, $sql);
  foreach ($arr as $d) {
    $id_pinjam = $d["id_pinjam"];
    $id_anggota = $d["id_anggota"];

    $tanggal_pinjam = WKT($d["tanggal_pinjam"]);
    $jam_pinjam = $d["jam_pinjam"];
    $tanggal_selesai = WKT($d["tanggal_selesai"]);
    $selesai = $d["tanggal_selesai"];

    $sqly = "select `id_buku` from `tb_detail` where `id_pinjam`='$id_pinjam' and `status_detail`='Pinjam'";
    $jumy = getJum($conn, $sqly);
    if ($jumy > 0) {
      $dy = getField($conn, $sqly);
      $id_buku = $dy["id_buku"];
      $buku = getBuku($conn, $id_buku);
      $tgl1 = strtotime($today);
      $tgl2 = strtotime($selesai);

      $jarak = $tgl1 - $tgl2;
      $ke = ($jarak / 60 / 60 / 24) + 0;
  $SISAHARI=abs($ke);
      if ($SISAHARI <= 2 ) { //hanya -2 sd +2,
  //or $SISAHARI==14 or $SISAHARI==7
        $ke2 = "H" . $ke;
        if ($ke == 0) {
          $ke2 = "H";
        } else if ($ke > 0) {
          $ke2 = "H+" . $ke;
        }

        $sqlc = "select `idw` from `tb_wa` where id_pinjam='$id_pinjam' and `keterangan`='$ke2'";
        $jumc = getJum($conn, $sqlc);
        if ($jumc < 1) {
          $sql2 = "select `nama_anggota`,`telepon` from `$tbanggota` where `id_anggota`='$id_anggota'";
          $d2 = getField($conn, $sql2);
          $nama_anggota = $d2["nama_anggota"];
          $telepon = $d2["telepon"];
          $pesan = "Yth,$nama_anggota, Waktu peminjaman Sudah hari " . $ke2 . ", Buku $buku Harap dikembalikan, (Deadline $tanggal_selesai)";
          sentWA($conn, $id_pinjam, $id_anggota, $telepon, $pesan, $ke2);
          kirimWA($telepon, $pesan);
        }
      } //ke
    } //jk ada buku dipinjam
  } //foreach
} //Pinjam



//CEK 24 JAM
$today=date("Y-m-d");
 
$gab="";
$nom=0;
$sql = "select id_pinjam,id_anggota,tanggal_pinjam,jam_pinjam from `$tbpinjam` where status='Pesan' order by `id_pinjam` asc";
$jum = getJum($conn, $sql);
if ($jum > 0) {
  $arr = getData($conn, $sql);
  foreach ($arr as $d) {
    $id_pinjam = $d["id_pinjam"];
    $id_anggota = $d["id_anggota"];

    $tanggal_pinjam = ($d["tanggal_pinjam"]);
    $jam_pinjam = $d["jam_pinjam"]; 

$bookingDate = "$tanggal_pinjam $jam_pinjam";
$sudah24=is24HoursPassed($bookingDate); 
if($sudah24==1){
$sqlv = "select nama_anggota,telepon from `$tbanggota` where `id_anggota`='$id_anggota'";
$dv = getField($conn, $sqlv); 
$nama_anggota = $dv["nama_anggota"]; 
$telepon = $dv["telepon"];
$sqlUP = "Update `$tbpinjam` set status='Batal' where `id_pinjam`='$id_pinjam'";
process($conn, $sqlUP);
 
 
$sqly = "select `id_buku` from `tb_detail` where `id_pinjam`='$id_pinjam' and `status_detail`='Pesan'";
    $jumy = getJum($conn, $sqly);
    if ($jumy > 0) {
$sqlUP = "Update `tb_pinjam` set status='Batal',catatan='$cat' where `id_pinjam`='$id_pinjam'";
process($conn, $sqlUP);
 
$nom++; 
  $arry=getData($conn,$sqly);
  foreach($arry as $dy) {
      $id_buku = $dy["id_buku"];
  $buku = getBuku($conn, $id_buku);
  $gab.="$buku, ";
  $cat="Buku Pinjam $id_buku /$buku Gagal Pesan, Waktu Habis";
   
$sqlUP = "Update `tb_detail` set status_detail='Batal',catatan='$cat' where `id_pinjam`='$id_pinjam' and `id_buku`='$id_buku'";
process($conn, $sqlUP);
$sqlUP = "Update `tb_buku` set `stok`=`stok`+'1' where `id_buku`='$id_buku'";
process($conn, $sqlUP);
}//for
}//jum
$gab.=" $nom Buku ";
  $pesan = "Yth $nama_anggota, Waktu Masa 24 Jam Pengambilan Buku Pesan : $gab Sudah Habis ...";
          sentWA($conn, $id_pinjam, $id_anggota, $telepon, $pesan, "Expire Time");
          kirimWA($telepon, $pesan);
}//sudah24
  }//for Pesan
}//jum

//===================  
?>




Sabtu, 10 Agustus 2024

LARAVEL ELOQUENT IF


use Illuminate\Support\Facades\DB;
use Illuminate\Http\Request;


function pot($kalimat, $maxKata = 50) {
  $kata = explode(" ", $kalimat);

  if (count($kata) <= $maxKata) {
    return $kalimat; // Kalimat tidak perlu dipotong
  }

  $kalimatPotong = "";
  for ($i = 0; $i < $maxKata; $i++) {
    $kalimatPotong .= $kata[$i] . " ";
  }
  return $kalimat . "..."; // Tambahkan "..." di akhir kalimat
}

function getSOP($kode){
        $sql = "SELECT `nama_sop` FROM `tb_sop` WHERE `id_sop`= '" . $kode . "'";
        $results = DB::select($sql);
$hasil ="-";
if (!empty($r)) {
$hasil =  $results[0]->nama_sop;

        return $hasil;
}

function getImg($doc){
$imagePath = '/ypathfile/'.$doc;
$urlParts = asset($imagePath); 
//$gab="<a href='$urlParts' target='_blank' title='$urlParts'>$doc</a>";
return $urlParts;
}

function getLNK($nm,$doc,$v){

$imagePath = '/ypathfile/'.$doc;
$urlParts = asset($imagePath); 
//$gab="<a href='$urlParts' target='_blank' title='$urlParts'>$doc</a>";
$x="<a href=\"$urlParts\" title=\"$doc\" target=\"_blank\">".ucwords($nm)."</a>";
if($v==1){
$x="<a href=\"$urlParts\" title=\"$doc\" target=\"_blank\"><b>".ucwords($nm)."</b></a>";
}
return  $x;
}
function getList($kode){

$sql = "SELECT `judul_dokumen`,`dokumen` FROM `tb_dokumen` WHERE `id_sop`= '" . $kode . "'";
        //$results = DB::select($sql);
        //$hasil = $results[0]->nama_dosen;
$dokumen = DB::select($sql);
$gab="<div align='left'><ol>";
$i=0;
foreach ($dokumen as $dokumenItem) {
$i++;
$judul= $dokumenItem->judul_dokumen ;
$doc=$dokumenItem->dokumen;
//{{ url('ypathfile/'.$sop->flowchart)}}
//<img src="{{ asset('images/gambar.jpg') }}" alt="Gambar">
$imagePath = '/ypathfile/'.$doc;
$urlParts = asset($imagePath); 

$gab.="<li><a href='$urlParts' target='_blank' title='$urlParts'>$judul</a></li>";
}
$gab.="</ol></div>";
if($i==0){$gab="<i>Dokumen Pendukung belum tersedia....</i>";}
        return $gab;
}


 @php
    $Jpositif = 0;
    $Jnegatif = 0;
@endphp

@forelse ($datalatihs as $datalatih)
    NO: {{$loop->iteration}}<br>
    Kategori: {{$datalatih->kategori}}<hr>


    @if ($datalatih->kategori == "Positif")
        @php
            $Jpositif++;
        @endphp
    @elseif ($datalatih->kategori == "Negatif")
        @php
            $Jnegatif++;
        @endphp
    @endif

@empty
    <p>Tidak ada data.</p>
@endforelse


<p>Total Positif: {{$Jpositif}}</p>
<p>Total Negatif: {{$Jnegatif}}</p>




<?php
$as="tx".rand(1,8).".jpg";
$x=asset("images/$as");
?>
<img width="100%" height="800" src="{{ $x }}" alt="<?php echo $judul;?>">

Kamis, 25 Juli 2024

MYSQL XAMPP for Windows 8.2.12 Aborting

Muncul pesan error:

[Note] InnoDB: Completed initialization of buffer pool

[ERROR] InnoDB: Missing MLOG_CHECKPOINT at 9134054 between the checkpoint 9134054 and the end 9133568.

 [ERROR] InnoDB: Plugin initialization aborted with error Generic error

 [Note] InnoDB: Starting shutdown...

[ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.

 [Note] Plugin 'FEEDBACK' is disabled.

[ERROR] Unknown/unsupported storage engine: InnoDB

[ERROR] Aborting

++++++++++++++++++++++++++++++++++++

CUT atau Pindahkan Atau 3 File dari C:\xampp\mysql\data:

ibdata1
ib_logfile0
ib_logfile1

Lalu jalankan lagi Apache dan Mysql 





Senin, 22 Juli 2024

Set Tanggal Expire

 <?php


function cekLama($date) {
    $inputDate = strtotime($date);
    $currentDate = strtotime(date('Y-m-d'));
    $yesterday = strtotime('-1 day', $currentDate);
$status=0;
    if ($inputDate < $yesterday) {
$status=0;
        //return "Tanggal tersebut adalah tanggal lampau.";
    } elseif ($inputDate == $yesterday) {
        //return "Tanggal tersebut adalah tanggal kemarin.";
$status=0;
    } else {
        $status=1;
//return "Tanggal tersebut belum tiba atau adalah hari ini.";
    }
return $status;
}
 
 

function is24HoursPassed($bookingDate) {
    // Convert the booking date to a timestamp
    $bookingTimestamp = strtotime($bookingDate);

    // Get the current timestamp
    $currentTimestamp = time();

    // Calculate the difference in seconds
    $differenceInSeconds = $currentTimestamp - $bookingTimestamp;

    // Check if the difference is greater than or equal to 24 hours (86400 seconds)
    if ($differenceInSeconds >= 86400) {
        return 1;
    } else {
        return 0;
    }
}

function cekLink($img,$id_konfirmasi){
$link="<a href='$img' target='_blank'>
<img src='ypathfile/pg.png' width='40' height='40' title='Payment Gateway'>
</a>";
if(strlen($img)<50){
$link="<a href='#' onclick='buka(\"konfirmasi/zoom.php?id=$id_konfirmasi\")'>
<img src='ypathfile/$img' width='40' height='40' /></a>";
}
return $link;
}
+++++++++++++++++++++
function kirimWA($HP,$PESAN){
echo "$HP,$PESAN";
$curl = curl_init(); 
curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://api.fonnte.com/send',
  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 => array(
'target' => $HP,
'message' => $PESAN, 
'countryCode' => '62', //optional
),
  CURLOPT_HTTPHEADER => array(
'Authorization: NzTx3456788Hi'
  ),
));
$response = curl_exec($curl);
if (curl_errno($curl)) {
  $error_msg = curl_error($curl);
}
curl_close($curl);

if (isset($error_msg)) {
echo $error_msg;
}
echo $response;
}


function sentWA($conn, $id_pinjam, $id_anggota, $telepon, $pesan, $keterangan){
  date_default_timezone_set("Asia/Jakarta");
  $tanggal = date("Y-m-d");
  $jam = date("H:i:s");

  $sql = "INSERT INTO `tb_wa` (`idw`, `tanggal`, `jam`, `id_pinjam`,`id_anggota`, `telepon`, `pesan`, `keterangan`) VALUES ('', '$tanggal', '$jam', '$id_pinjam','$id_anggota', '$telepon', '$pesan', '$keterangan')";
  $s = false;
  $conn->autocommit(FALSE);
  try {
    $rs = $conn->query($sql);
    if ($rs) {
      $conn->commit();
      $last_inserted_id = $conn->insert_id;
      $affected_rows = $conn->affected_rows;
      $s = true;
    }
  } catch (Exception $e) {
    echo 'fail: ' . $e->getMessage();
    $conn->rollback();
  }
  $conn->autocommit(TRUE);
  return $s;
}


function RP($rupiah){
return number_format($rupiah, "2", ",", ".");
}    

function getR($digits) {
  $temp = "";
  for ($i = 0; $i < $digits; $i++) {
    $temp .= rand(0, 9);
  }
  return (int)$temp;
}

 

function randomPassword() {
    $alphabet = "abcdefghijklmnopqrstuwxyzABCDEFGHIJKLMNOPQRSTUWXYZ0123456789";
$gab="";
    for ($i = 0; $i < 8; $i++) {//8 karakter
        $n = rand(0, count($alphabet)-1);
       // $pass[$i] = $alphabet[$n];
   $gab.= $alphabet[$n];;
    }
    return $gab;
}


function saveWA($conn,$id_pinjam,$id_anggota,$telepon,$pesan){
date_default_timezone_set("Asia/Jakarta");
$tanggal=date("Y-m-d");
$jam=date("H:i:s");
$sql="INSERT INTO `tb_wa` ( `tanggal`, `jam`, `id_pinjam`, `id_anggota`, `telepon`, `pesan`, `keterangan`) VALUES ('$tanggal', '$jam', '$id_pinjam', '$id_anggota', '$telepon', '$pesan', '')";
$pro=process($conn,$sql);
$reply = ["message" => "$pesan",];
kirimWA($telepon,$pesan);
return $pro;
}


function terbilang($i){
  $huruf = array("", "Satu", "Dua", "Tiga", "Empat", "Lima", "Enam", "Tujuh", "Delapan", "Sembilan", "Sepuluh", "Sebelas");
 
  if ($i < 12) return " " . $huruf[$i];
  elseif ($i < 20) return terbilang($i - 10) . " Belas";
  elseif ($i < 100) return terbilang($i / 10) . " Puluh" . terbilang($i % 10);
  elseif ($i < 200) return " Seratus" . terbilang($i - 100);
  elseif ($i < 1000) return terbilang($i / 100) . " Ratus" . terbilang($i % 100);
  elseif ($i < 2000) return " Seribu" . terbilang($i - 1000);
  elseif ($i < 1000000) return terbilang($i / 1000) . " Ribu" . terbilang($i % 1000);
  elseif ($i < 1000000000) return terbilang($i / 1000000) . " Juta" . terbilang($i % 1000000);   
}

function BAL($tanggal){
$arr=explode(" ",$tanggal);
if($arr[1]=="Januari"||$arr[1]=="January"){$bul="01";}
else if($arr[1]=="Februari"||$arr[1]=="February"){$bul="02";}
else if($arr[1]=="Maret"||$arr[1]=="March"){$bul="03";}
else if($arr[1]=="April"){$bul="04";}
else if($arr[1]=="Mei"||$arr[1]=="May"){$bul="05";}
else if($arr[1]=="Juni"||$arr[1]=="June"){$bul="06";}
else if($arr[1]=="Juli"||$arr[1]=="July"){$bul="07";}
else if($arr[1]=="Agustus"||$arr[1]=="August"){$bul="08";}
else if($arr[1]=="September"){$bul="09";}
else if($arr[1]=="Oktober"||$arr[1]=="October"){$bul="10";}
else if($arr[1]=="November"){$bul="11";}
else if($arr[1]=="Nopember"){$bul="11";}
else if($arr[1]=="Desember"||$arr[1]=="December"){$bul="12";}
return "$arr[2]-$bul-$arr[0]";


function BALP($tanggal){
$arr=explode(" ",$tanggal);
if($arr[1]=="Jan"){$bul="01";}
else if($arr[1]=="Feb"){$bul="02";}
else if($arr[1]=="Mar"){$bul="03";}
else if($arr[1]=="Apr"){$bul="04";}
else if($arr[1]=="Mei"){$bul="05";}
else if($arr[1]=="Jun"){$bul="06";}
else if($arr[1]=="Jul"){$bul="07";}
else if($arr[1]=="Agu"){$bul="08";}
else if($arr[1]=="Sep"){$bul="09";}
else if($arr[1]=="Okt"){$bul="10";}
else if($arr[1]=="Nov"){$bul="11";}
else if($arr[1]=="Nop"){$bul="11";}
else if($arr[1]=="Des"){$bul="12";}
return "$arr[2]-$bul-$arr[0]";

function WKT($sekarang)
{
if ($sekarang == "0000-00-00") {
$sekarang = date("Y-m-d");
}

$tanggal = substr($sekarang, 8, 2) + 0;
$bulan = substr($sekarang, 5, 2);
$tahun = substr($sekarang, 0, 4);

$judul_bln = array(1 => "Januari", "Februari", "Maret", "April", "Mei", "Juni", "Juli", "Agustus", "September", "Oktober", "November", "Desember");
$wk = $tanggal . " " . $judul_bln[(int)$bulan] . " " . $tahun;
return $wk;

function WKTP($sekarang)
{
$tanggal = substr($sekarang, 8, 2) + 0;
$bulan = substr($sekarang, 5, 2);
$tahun = substr($sekarang, 2, 2);

$judul_bln = array(1 => "Jan", "Feb", "Mar", "Apr", "Mei", "Jun", "Jul", "Agu", "Sep", "Okt", "Nov", "Des");
$wk = $tanggal . " " . $judul_bln[(int)$bulan] . "'" . $tahun;
return $wk;


function saveLog($conn,$id_pengunjung,$nama_pengunjung,$level,$catatan){
date_default_timezone_set("Asia/Jakarta");
$jam=date("H:i:s");
$tanggal = date("Y-m-d");
$sql="INSERT INTO `tb_bukutamu` (`id_bukutamu`, `id_pengunjung`, `nama_pengunjung`, `level`, `catatan`, `tanggal`, `jam`) 
VALUES ('', '$id_pengunjung', '$nama_pengunjung', '$level', '$catatan', '$tanggal', '$jam')";
process($conn, $sql);
return 1;

}

function process($conn, $sql)
{
$s = false;
$conn->autocommit(FALSE);
try {
$rs = $conn->query($sql);
if ($rs) {
$conn->commit();
$last_inserted_id = $conn->insert_id;
$affected_rows = $conn->affected_rows;
$s = true;
}
} catch (Exception $e) {
echo 'fail: ' . $e->getMessage();
$conn->rollback();
}
$conn->autocommit(TRUE);
return $s;
}

function getJum($conn, $sql)
{
$rs = $conn->query($sql);
$jum = $rs->num_rows;
$rs->free();
return $jum;
}

function getField($conn, $sql)
{
$rs = $conn->query($sql);
$rs->data_seek(0);
$d = $rs->fetch_assoc();
$rs->free();
return $d;
}

function getData($conn, $sql)
{
$rs = $conn->query($sql);
$rs->data_seek(0);
$arr = $rs->fetch_all(MYSQLI_ASSOC);
//foreach($arr as $row) {
//  echo $row['nama_kelas'] . '*<br>';
//}

$rs->free();
return $arr;
}

function getBukuZ($conn, $kode)
{
//error_reporting(0);
$field = "judul";
$sql = "SELECT `$field` FROM `tb_buku` where `id_buku`='$kode'";
$rs = $conn->query($sql);
$rs->data_seek(0);
$row = $rs->fetch_assoc();
$rs->free();
return $row[$field];
}

function getAnggota($conn, $kode)
{
//error_reporting(0);
$field = "nama_anggota";
$sql = "SELECT `$field` FROM `tb_anggota` where `id_anggota`='$kode'";
$rs = $conn->query($sql);
$rs->data_seek(0);
$row = $rs->fetch_assoc();
$rs->free();
return $row[$field];
}

function getAdmin($conn, $kode)
{
//error_reporting(0);
$field = "nama_admin";
$sql = "SELECT `$field` FROM `tb_admin` where `id_admin`='$kode'";
$rs = $conn->query($sql);
$rs->data_seek(0);
$row = $rs->fetch_assoc();
$rs->free();
return $row[$field];
}

function getKategori($conn, $kode){
//error_reporting(0);
$field = "kategori";
$sql = "SELECT `$field` FROM `tb_kategori` where `id_kategori`='$kode'";
$rs = $conn->query($sql);
$rs->data_seek(0);
$row = $rs->fetch_assoc();
$rs->free();
return $row[$field];
}

function getBuku($conn, $kode){
//error_reporting(0);
$field = "judul";
$sql = "SELECT `$field` FROM `tb_buku` where `id_buku`='$kode'";
$rs = $conn->query($sql);
$rs->data_seek(0);
$row = $rs->fetch_assoc();
$rs->free();
return $row[$field];
}
function getListB($conn, $kode){
//error_reporting(0);
    $sql="select `id_buku` from `tb_detail` where `id_pinjam`='$kode' order by `idd` asc";
    $jum=getJum($conn,$sql);
$gab="";
if($jum > 0){
$arr=getData($conn,$sql);
foreach($arr as $d) {
$id_buku=$d["id_buku"];
$buku=getBuku($conn,$id_buku);
$gab.="$buku ($id_buku), ";
}
$gab.=" $jum buku";
}
else{$gab="Belum melakukan peminjaman buku...";}
return $gab;
}

function getListB2($conn, $kode){
// error_reporting(0);
    $sql="select `id_buku` from `tb_detail` where `id_pinjam`='$kode' order by `idd` asc";
    $jum=getJum($conn,$sql);
$gab="<ol>";
if($jum > 0){
$arr=getData($conn,$sql);
foreach($arr as $d) {
$id_buku=$d["id_buku"];
$buku=getBuku($conn,$id_buku);
$gab.="<li>$buku ($id_buku)</li>";
}
$gab.="</ol>$jum buku";
}
else{$gab="Belum melakukan peminjaman buku...";}
return $gab;
}
function getCek($conn, $id_anggota){
$sql = "SELECT `tb_detail`.`idd` FROM `tb_pinjam`,`tb_detail` where `tb_pinjam`.id_pinjam=`tb_detail`.id_pinjam  and tb_pinjam.`id_anggota`='$id_anggota' and (`tb_detail`.status_detail='Pinjam' or `tb_detail`.status_detail='Pesan')";
$jum=getJum($conn,$sql)+0;
return $jum;
}
function upBuku($conn, $id_buku){
$sql="select `stok` from `tb_buku` where `id_buku`='$id_buku'";
    $jum=getJum($conn,$sql);
if($jum > 0){
$d=getField($conn,$sql);
$stok=$d["stok"]+0;
if($stok<1){
$sql = "Update `tb_buku` set status='Tidak Tersedia' where id_buku='$id_buku'";
$pro=process($conn,$sql);
}
else{
$sql = "Update `tb_buku` set status='Tersedia' where id_buku='$id_buku'";
$pro=process($conn,$sql);
}
}
return 1;
}

?>


Rabu, 10 Juli 2024

ChatAPI GPT

 


 $extracted_text = file_get_contents("peraturan_sekolah.pdf");
if (is_question_relevant($question, $extracted_text)) {

    $data = array(

        'model' => 'gpt-4',

        'messages' => array(

            array('role' => 'system', 'content' => "Anda adalah asisten AI yang hanya dapat menjawab pertanyaan berdasarkan teks peraturan sekolah berikut yang ditulis dalam bahasa Inggris: \"$extracted_text\". Jawaban Anda harus diberikan dalam bahasa Indonesia. Jika pertanyaan tidak relevan dengan teks ini, balas dengan pesan kesalahan yang menyatakan bahwa pertanyaan tidak relevan dengan teks yang diberikan."),

            array('role' => 'user', 'content' => $question)

        ),

        'max_tokens' => 1000,

        'temperature' => 0.7,

    );

} else {

    // Handle the case where the question is not relevant

    echo "Pertanyaan tidak relevan dengan teks yang diberikan.";

}

===========


 $data = array(

                'model' => 'gpt-4o',

                'messages' => array(

                   array('role' => 'system', 'content' => "You are an AI assistant that can only answer questions based on the following school regulations text: $extracted_text. If the question is not relevant to this text, respond with an error message stating that the question is not relevant to the provided text."),

   array('role' => 'user', 'content' => $question)

                ),

                'max_tokens' => 1000,

                'temperature' => 0.7,

            );

 $data = array(

        'model' => 'gpt-4',

        'messages' => array(

            array('role' => 'system', 'content' => "Anda adalah asisten AI yang hanya dapat menjawab pertanyaan berdasarkan teks $nama_file berikut yang ditulis dalam bahasa Inggris: \"$extracted_text\". Jawaban Anda harus diberikan dalam bahasa Indonesia. Jika pertanyaan tidak relevan dengan teks ini, balas dengan pesan kesalahan yang menyatakan bahwa pertanyaan tidak relevan dengan teks yang diberikan."),

            array('role' => 'user', 'content' => $question)

        ),

        'max_tokens' => 1000,

        'temperature' => 0.7,

    );




Senin, 24 Juni 2024

setWA dan setEMAIL

 <?php
require_once"koneksivar.php";

$conn = new mysqli($DBServer, $DBUser, $DBPass, $DBName);
if ($conn->connect_error) {
  trigger_error('Database connection failed: '  . $conn->connect_error, E_USER_ERROR);
}
?>

<?php
function selWaktu($tanggal){
$tanggal_1 = date_create($tanggal);
$tanggal_2 = date_create();
$selisih  = date_diff( $tanggal_1, $tanggal_2 );
$sisa=($selisih->days);
return $sisa." Hari";
}
function addWaktu($conn,$id_anggota){
$tanggal=date("Y-m-d");
$tanggl_berakhir= date('Y-m-d', strtotime($tanggal. ' + 30 days'));
echo $sql = "update `tb_anggota` set `tanggal_berakhir`='$tanggl_berakhir',status='Aktif' where `id_anggota`='$id_anggota'";
process($conn, $sql);
}

function setWA($ph){
$x="https://wa.me/$ph?text=I'm%20interested%20in%20your%20activity%20for%20today%20";
$x="<a href='$x' target='_blank'>$ph</a>";
return $x;
}
function setEmail($email){
$x="<a href='$email' target='_blank'>$email</a>";
return $x;
}

function terbilang($i){
  $huruf = array("", "Satu", "Dua", "Tiga", "Empat", "Lima", "Enam", "Tujuh", "Delapan", "Sembilan", "Sepuluh", "Sebelas");
  if ($i < 12) return " " . $huruf[$i];
  elseif ($i < 20) return terbilang($i - 10) . " Belas";
  elseif ($i < 100) return terbilang($i / 10) . " Puluh" . terbilang($i % 10);
  elseif ($i < 200) return " Seratus" . terbilang($i - 100);
  elseif ($i < 1000) return terbilang($i / 100) . " Ratus" . terbilang($i % 100);
  elseif ($i < 2000) return " Seribu" . terbilang($i - 1000);
  elseif ($i < 1000000) return terbilang($i / 1000) . " Ribu" . terbilang($i % 1000);
  elseif ($i < 1000000000) return terbilang($i / 1000000) . " Juta" . terbilang($i % 1000000);    
}
?>

<?php
function RP($rupiah){return number_format($rupiah,"2",",",".");}
?>
<?php
function WKT($sekarang)
{
$tanggal = substr($sekarang, 8, 2) + 0;
$bulan = substr($sekarang, 5, 2);
$tahun = substr($sekarang, 0, 4);

$judul_bln = array(1 => "Januari", "Februari", "Maret", "April", "Mei", "Juni", "Juli", "Agustus", "September", "Oktober", "November", "Desember");
$wk = $tanggal . " " . $judul_bln[(int)$bulan] . " " . $tahun;
return $wk;
}

function WKTP($sekarang){
$tanggal = substr($sekarang,8,2)+0;
$bulan = substr($sekarang,5,2);
$tahun = substr($sekarang,2,2);

$judul_bln=array(1=> "Jan", "Feb", "Mar", "Apr", "Mei","Jun", "Jul", "Agu", "Sep","Okt", "Nov", "Des");
$wk=$tanggal." ".$judul_bln[(int)$bulan]."'".$tahun;
return $wk;
}
?>
<?php
function BAL($tanggal){
$arr=split(" ",$tanggal);
if($arr[1]=="Januari"){$bul="01";}
else if($arr[1]=="Februari"){$bul="02";}
else if($arr[1]=="Maret"){$bul="03";}
else if($arr[1]=="April"){$bul="04";}
else if($arr[1]=="Mei"){$bul="05";}
else if($arr[1]=="Juni"){$bul="06";}
else if($arr[1]=="Juli"){$bul="07";}
else if($arr[1]=="Agustus"){$bul="08";}
else if($arr[1]=="September"){$bul="09";}
else if($arr[1]=="Oktober"){$bul="10";}
else if($arr[1]=="November"){$bul="11";}
else if($arr[1]=="Nopember"){$bul="11";}
else if($arr[1]=="Desember"){$bul="12";}
return "$arr[2]-$bul-$arr[0]";
}
?>

<?php
function BALP($tanggal){
$arr=split(" ",$tanggal);
if($arr[1]=="Jan"){$bul="01";}
else if($arr[1]=="Feb"){$bul="02";}
else if($arr[1]=="Mar"){$bul="03";}
else if($arr[1]=="Apr"){$bul="04";}
else if($arr[1]=="Mei"){$bul="05";}
else if($arr[1]=="Jun"){$bul="06";}
else if($arr[1]=="Jul"){$bul="07";}
else if($arr[1]=="Agu"){$bul="08";}
else if($arr[1]=="Sep"){$bul="09";}
else if($arr[1]=="Okt"){$bul="10";}
else if($arr[1]=="Nov"){$bul="11";}
else if($arr[1]=="Nop"){$bul="11";}
else if($arr[1]=="Des"){$bul="12";}
return "$arr[2]-$bul-$arr[0]";
}
?>

<?php
function process($conn,$sql){
$s=false;
$conn->autocommit(FALSE);
try {
  $rs = $conn->query($sql);
  if($rs){
    $conn->commit();
    $last_inserted_id = $conn->insert_id;
  $affected_rows = $conn->affected_rows;
   $s=true;
  }

catch (Exception $e) {
echo 'fail: ' . $e->getMessage();
   $conn->rollback();
}
$conn->autocommit(TRUE);
return $s;
}

function getJum($conn,$sql){
  $rs=$conn->query($sql);
  $jum= $rs->num_rows;
$rs->free();
return $jum;
}

function getField($conn,$sql){
$rs=$conn->query($sql);
$rs->data_seek(0);
$d= $rs->fetch_assoc();
$rs->free();
return $d;
}

function getData($conn,$sql){
$rs=$conn->query($sql);
$rs->data_seek(0);
$arr = $rs->fetch_all(MYSQLI_ASSOC);
//foreach($arr as $row) {
//  echo $row['nama_kelas'] . '*<br>';
//}
$rs->free();
return $arr;
}

function getParkir($conn,$kode){
$field="nama_parkir";
$sql="SELECT `$field` FROM `tb_parkir` where `idp`='$kode'";
$rs=$conn->query($sql);
$rs->data_seek(0);
$row = $rs->fetch_assoc();
$rs->free();
    return $row[$field];
}
?>



Selasa, 04 Juni 2024

Error: MySQL shutdown unexpectedly.

 

Semua pasti bisA Nangis...jika ada pesan kesalahan berikut
Mysql pada XAMPPP Control Panel (localhost/phpmyadmin) GAGAL RUN , dengan pesan



7:33:28 AM  [mysql] Error: MySQL shutdown unexpectedly.
7:33:28 AM  [mysql] This may be due to a blocked port, missing dependencies, 
7:33:28 AM  [mysql] improper privileges, a crash, or a shutdown by another method.
7:33:28 AM  [mysql] Press the Logs button to view error logs and check
7:33:28 AM  [mysql] the Windows Event Viewer for more clues
7:33:28 AM  [mysql] If you need more help, copy and post this
7:33:28 AM  [mysql] entire log window on the forums

Dan pada mysql_error.log muncul pesan berikut:

2024-06-04 18:48:00 0 [Note] InnoDB: Mutexes and rw_locks use Windows interlocked functions
2024-06-04 18:48:00 0 [Note] InnoDB: Uses event mutexes
2024-06-04 18:48:00 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
2024-06-04 18:48:00 0 [Note] InnoDB: Number of pools: 1
2024-06-04 18:48:00 0 [Note] InnoDB: Using SSE2 crc32 instructions
2024-06-04 18:48:00 0 [Note] InnoDB: Initializing buffer pool, total size = 4G, instances = 8, chunk size = 128M
2024-06-04 18:48:00 0 [Note] InnoDB: Completed initialization of buffer pool
2024-06-04 18:48:00 0 [ERROR] InnoDB: The Auto-extending innodb_system data file 'C:\xampp\mysql\data\ibdata1' is of a different size 768 pages than specified in the .cnf file: initial 6400 pages, max 0 (relevant if non-zero) pages!
2024-06-04 18:48:00 0 [ERROR] InnoDB: Plugin initialization aborted with error Generic error
2024-06-04 18:48:01 0 [Note] InnoDB: Starting shutdown...
2024-06-04 18:48:01 0 [ERROR] Plugin 'InnoDB' init function returned error.
2024-06-04 18:48:01 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2024-06-04 18:48:01 0 [Note] Plugin 'FEEDBACK' is disabled.
2024-06-04 18:48:01 0 [ERROR] Unknown/unsupported storage engine: InnoDB
2024-06-04 18:48:01 0 [ERROR] Aborting


SOLUSI:
backup file my.ini yang lama(C:\xampp\mysql\bin\my.ini), lalu isinya ganti dengan ini semua:

 

[client] 
port=3306
socket="C:/xampp/mysql/mysql.sock"
 
default-character-set=utf8mb4
[mysqld]
port=3306
socket="C:/xampp/mysql/mysql.sock"
basedir="C:/xampp/mysql"
tmpdir="C:/xampp/tmp"
datadir="C:/xampp/mysql/data"
pid_file="mysql.pid" 
key_buffer=16M
max_allowed_packet=1M
sort_buffer_size=512K
net_buffer_length=8K
read_buffer_size=256K
read_rnd_buffer_size=512K
myisam_sort_buffer_size=8M
log_error="mysql_error.log" 
plugin_dir="C:/xampp/mysql/lib/plugin/" 
server-id =1
 
innodb_data_home_dir="C:/xampp/mysql/data"
innodb_data_file_path=ibdata1:10M:autoextend
innodb_log_group_home_dir="C:/xampp/mysql/data" 
innodb_buffer_pool_size=16M 
innodb_log_file_size=5M
innodb_log_buffer_size=8M
innodb_flush_log_at_trx_commit=1
innodb_lock_wait_timeout=50 
sql_mode=NO_ZERO_IN_DATE,NO_ZERO_DATE,NO_ENGINE_SUBSTITUTION
log_bin_trust_function_creators=1

character-set-server=utf8mb4
collation-server=utf8mb4_general_ci
[mysqldump]
max_allowed_packet=16M

[mysql] 
[isamchk]
key_buffer=20M
sort_buffer_size=20M
read_buffer=2M
write_buffer=2M

[myisamchk]
key_buffer=20M
sort_buffer_size=20M
read_buffer=2M
write_buffer=2M

[mysqlhotcopy]


Selisih Waktu Berjalan

Berikut adalah fungsi PHP yang menghitung selisih hari antara tanggal saat ini dengan tanggal 2024-08-22 . Jika tanggal saat ini kurang dari...