Upload New File

parent 00081101
<?php
include("../common/dbconfig.php");
function acak($panjang)
{
$karakter= 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz123456789';
$string = '';
for ($i = 0; $i < $panjang; $i++) {
$pos = rand(0, strlen($karakter)-1);
$string .= $karakter{$pos};
}
return $string;
}
function caritiket($keyword)
{
$query = "SELECT t_tiketsdia.id, t_tiketsdia.kode_tiket, destinasi.nama_destinasi, pt_trans.nama_transp, t_tiketsdia.harga, pt_kategori.nama_kategori
FROM pt_kategori INNER JOIN (pt_trans INNER JOIN (destinasi INNER JOIN t_tiketsdia ON destinasi.id_destinasi = t_tiketsdia.t_destinasi) ON pt_trans.id_transp = t_tiketsdia.t_kendaraan) ON pt_kategori.id_kategori = pt_trans.kategori_id
WHERE nama_destinasi LIKE '%$keyword%' OR nama_transp LIKE '%$keyword%' OR harga LIKE '%$keyword%' OR nama_kategori LIKE '%$keyword%'
";
return query($query);
}
function caridestinasi($keyword){
$query="SELECT * FROM destinasi WHERE nama_destinasi LIKE '%$keyword%'";
return query($query);
}
function sorting($keyword){
$query="SELECT * FROM b_Berita ORDER BY t_upload $keyword";
echo "$keyword";
return query($query);
}
function beli($data){
global $koneksi;
$akun_id = htmlspecialchars($data["id_akun"]);
$tiket_id = htmlspecialchars($data["id_tiket"]);
$j_pemesanan = htmlspecialchars($data["j_pemesanan"]);
$via_pembayaran = htmlspecialchars($data["via_pembayaran"]);
$query = "INSERT INTO pmt_tiket VALUES
('','$akun_id','$tiket_id','$j_pemesanan','$via_pembayaran')";
mysqli_query($koneksi,$query);
return mysqli_affected_rows($koneksi);
}
function bayar($data){
global $koneksi;
$id_ptiket = htmlspecialchars($data["id_ptiket"]);
$kode_pembayaran = acak(10);
$status = "Menunggu";
$query = "INSERT INTO p_pembayaran VALUES
('','$id_ptiket','$kode_pembayaran','$status')";
mysqli_query($koneksi,$query);
return mysqli_affected_rows($koneksi);
}
function hapuspemesanan($id_pemesanan){
global $koneksi;
mysqli_query($koneksi, "DELETE FROM pmt_tiket WHERE id_pemesanan=$id_pemesanan");
return mysqli_affected_rows($koneksi);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment