[ Mini Kiebo ]
Server: Windows NT DESKTOP-5B8S0D4 6.2 build 9200 (Windows 8 Professional Edition) i586
Path:
D:
/
xampp182
/
htdocs
/
simkeu
/
sia
/
[
Home
]
File: Uploads.inc.php
<?php $id = ""; $nama = ""; $hp = ""; $email = ""; $buton = "Simpan"; $u_pswd = "-"; $u_name = "-"; $hp = "-"; $ktp = "-"; $kota_asal = "-"; $alamat = "-"; $email = "-"; $nama = "-"; if(isset($_GET["deleteID"])) { $sql = "delete from login_sales where id = ".$_GET["deleteID"]; if (mysqli_query($conn, $sql)) { echo "<script>window.alert('Data Sudah Terhapus');</script>"; } else { echo "Error: " . $sql . "<br>" . mysqli_error($conn); } } if(isset($_GET["editID"])) { $sql = "SELECT * FROM login_sales where id = ".$_GET["editID"]." order by id desc"; $result = mysqli_query($conn, $sql); if(mysqli_num_rows($result) > 0) { while($row = mysqli_fetch_assoc($result)) { $id = $row['id']; $nama = $row['nama']; $hp = $row['hp']; $email = $row['email']; $buton = "Koreksi"; } } } function cariMHS($nim,$conn) { $sql = "SELECT * FROM f_riwayatpendidikanmahasiswa where nim = '".$nim."'"; $result = mysqli_query($conn, $sql); $id_registrasi_mahasiswa = 0; if(mysqli_num_rows($result) > 0) { while($row = mysqli_fetch_assoc($result)) { $id_registrasi_mahasiswa = $row['id_registrasi_mahasiswa']; } } return $id_registrasi_mahasiswa; } function cariPT($kd_pt,$conn) { $sql = "SELECT * FROM f_pt where kode_perguruan_tinggi = '0".$kd_pt."' or kode_perguruan_tinggi = '".$kd_pt."'"; $result = mysqli_query($conn, $sql); $id_perguruan_tinggi = 0; if(mysqli_num_rows($result) > 0) { while($row = mysqli_fetch_assoc($result)) { $id_perguruan_tinggi = $row['id_perguruan_tinggi']; } } return $id_perguruan_tinggi; } // function cariMHS($va) { // $sql = "SELECT * FROM m_va where va = '".$va."'"; // $result = mysqli_query($conn, $sql); // $nama_mhs = "-"; // if(mysqli_num_rows($result) > 0) { // while($row = mysqli_fetch_assoc($result)) { // $nama_mhs = $row['nama']; // } // } // return $nama_mhs; // } function cariSKS($kode_mk,$conn) { $sql = "SELECT * FROM f_mk where kode_mata_kuliah = '".$kode_mk."'"; $result = mysqli_query($conn, $sql); $sks_mata_kuliah = 0; if(mysqli_num_rows($result) > 0) { while($row = mysqli_fetch_assoc($result)) { $sks_mata_kuliah = $row['sks_mata_kuliah']; } } return $sks_mata_kuliah; } if(isset($_GET["setaktif"])) { $setz = mysqli_query($conn, "update login_sales set aktif = 0"); $sql = "update login_sales set aktif = 1 where id = ".$_GET["setaktif"]; if (mysqli_query($conn, $sql)) { echo "<scrnamat>window.alert('Set Aktif');</scrnamat>"; } else { echo "Error: " . $sql . "<br>" . mysqli_error($conn); } } if(isset($_POST["Clear"])) { $sql = "delete from temp_va"; $result = mysqli_query($conn, $sql); } if(isset($_POST["Transfer"])) { $sql = "insert into 0_mandiriva (tgl,va,nama,bayar,chanel) select tgl,va,nama,bayar,chanel from temp_va"; $result = mysqli_query($conn, $sql); echo "<script>window.alert('Transfer Sukses');</script>"; } if(isset($_POST["Backup"])) { $tanggalan = str_replace("-","",$skr); $sql = "create table mandiriva_".$tanggalan." as SELECT * FROM 0_mandiriva"; $result = mysqli_query($conn, $sql); echo "<script>window.alert('Back Up Sukses');</script>"; } $sql = "SELECT tgl FROM 0_mandiriva order by tgl desc limit 0,1"; // echo $sql; $result = mysqli_query($conn, $sql); if(mysqli_num_rows($result) > 0) { while($row = mysqli_fetch_assoc($result)) { $tgl = $row['tgl']; // echo "AAA".$tgl; } } if(isset($_POST["Upload"])) { require_once('vendor/php-excel-reader/excel_reader2.php'); require_once('vendor/SpreadsheetReader.php'); $allowedFileType = ['application/vnd.ms-excel','text/xls','text/xlsx','application/vnd.openxmlformats-officedocument.spreadsheetml.sheet']; if(in_array($_FILES["file"]["type"],$allowedFileType)){ //nanti buat juga folder uploads pada projek kalian masing - masing $targetPath = 'uploads/'.$_FILES['file']['name']; move_uploaded_file($_FILES['file']['tmp_name'], $targetPath); $Reader = new SpreadsheetReader($targetPath); $no = 0; foreach ($Reader as $Row) { // echo "<script>window.alert('AAA');</script>"; if(strlen($Row[0]) == 6) { $sqlx = "SELECT * FROM m_va where va = '".$Row[1]."'"; $result = mysqli_query($conn, $sqlx); $nama_mhs = "-"; if(mysqli_num_rows($result) > 0) { while($dt = mysqli_fetch_assoc($result)) { $nama_mhs = $dt['nama']; } } $no = ($no+1); $tbField[0] = "tgl"; $tbField[1] = "va"; $tbField[2] = "nama"; $tbField[3] = "bayar"; $tbField[4] = "chanel"; $tbIsi[0] = "'".fdate_mandiri($Row[0])."'"; $tbIsi[1] = "'".addslashes($Row[1])."'"; $tbIsi[2] = "'".addslashes($nama_mhs)."'"; $tbIsi[3] = "'".addslashes($Row[2])."'"; $tbIsi[4] = "'MRP'"; $nmField = compile_array($tbField); $isiField = compile_array($tbIsi); $sql = "insert into temp_va (".$nmField.") values (".$isiField.")"; // echo $sql."<br>"; // $notif = $ssm; if (mysqli_query($conn, $sql)) { // echo $sql."<br>"; // echo "<script>window.alert('".$notif."');</script>"; } else { echo "Error: " . $sql . "<br>" . mysqli_error($conn); } } } echo "<script>window.alert('Upload Sukses');</script>"; } } ?> <?php if(isset($_GET["editID"])) { ?> <?php }else{ ?> <div class="container-fluid"> <div class="card shadow mb-4"> <div class="card-header py-3"> <h6 class="m-0 font-weight-bold text-primary">Entry Data </h6> </div> <div class="card-body"> <form class="user" action="dashboard.php?Uploads" accept-charset="utf-8" method="post" name="frmExcelImport" id="frmExcelImport" enctype="multipart/form-data"> <div class="col m6"> <div class="row"> <div class="input-field col m6 s12"> <table border="0" width="100%" cellspacing="1" cellpadding="1"> <tr> <td width="30%">Update Terakhir</td> <td width="70%"> <input value="<?php echo $tgl;?>" disabled class="form-control" name="tgl" type="text"> </td> </tr> <tr> <td width="30%">File Excel</td> <td width="70%"> <input value="<?php echo $id;?>" name="id" type="hidden"> <input name="file" type="file" accept=".xls,.xlsx,.csv" class="form-control" id="exampleFirstName" placeholder="Username Feeder"> </td> </tr> <tr> <td> </td> <td> <div class="form-group row" style="margin-top : 5pt;"> <div class="col-sm-3 mb-3 mb-sm-0"> <button name="Upload" type="submit" class="btn btn-primary btn-block">Upload</button> </div> <div class="col-sm-3"> <?php if($skr <> $tgl) { ?> <button name="Backup" type="submit" class="btn btn-primary btn-block">Backup DB</button> <?php } ?> </div> <div class="col-sm-3"> <button name="Clear" type="submit" class="btn btn-primary btn-block">Clear All</button> </div> <div class="col-sm-3"> <button name="Cancel" type="submit" class="btn btn-primary btn-block">Cancel</button> </div> </div> </td> </tr> </table> </div> </div> </div> </div> </div> </div> <?php } ?> <div class="container-fluid"> <!-- Page Heading --> <!-- DataTales Example --> <div class="card shadow mb-4"> <div class="card-header py-3"> <h6 class="m-0 font-weight-bold text-primary">DataTables VA</h6> </div> <div class="card-body"> <div class="table-responsive"> <table class="table table-bordered" id="dataTable" width="100%" cellspacing="0"> <thead> <tr> <!--th>Aksi</th--> <th>Tanggal</th> <th>VA</th> <th>Mahasiswa</th> <th>Nominal</th> <th>Channel</th> </tr> </thead> <tfoot> <tr> <!--th>Aksi</th--> <th>Tanggal</th> <th>VA</th> <th>Mahasiswa</th> <th>Nominal</th> <th>Channel</th> </tr> </tfoot> <tbody> <?php $sql = "SELECT tgl,va,nama,bayar,chanel FROM temp_va order by tgl desc"; //$sql = "SELECT * FROM 0_mandiriva where tgl = '2025-10-17' order by tgl desc"; //echo $sql; $result = mysqli_query($conn, $sql); $cekDB = 0; $id = 0; if(mysqli_num_rows($result) > 0) { while($row = mysqli_fetch_assoc($result)) { /* $id = $row['id_bayar']; if($id == "29733") { $vabaru = "8812720241509"; $namabaru = "Mia Yulva"; $sqledit = "update 0_mandiriva set va = '".$vabaru."', nama = '".$namabaru."' where id_bayar = ".$id; if (mysqli_query($conn, $sqledit)) { echo "<script>window.alert('Data Sudah Dikoreksi');</script>"; } else { echo "Error: " . $sql . "<br>" . mysqli_error($conn); } } */ $cekDB = ($cekDB+1); ?> <tr> <td><?php echo $row['tgl'];?></td> <td><?php echo $row['va'];?></td> <td><?php echo $row['nama'];?></td> <td><?php echo $row['bayar'];?></td> <td><?php echo $id."{".$row['chanel']."}";?></td> </tr> <?php } } ?> </tbody> </table> </div> <?php if($cekDB > 0) { ?> <hr> <div align="center"> <button name="Transfer" type="submit" class="btn btn-primary btn-block">Posting ke Database</button> </div> <?php } ?> </div> </div> </div> </form>