Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
PSW_II_PARIWISATA_TRANSPORTASI
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Proyek_PSW_II_PARIWISATA
PSW_II_PARIWISATA_TRANSPORTASI
Commits
6323c486
Commit
6323c486
authored
Jun 06, 2020
by
11319009_Pratiwi Sibarani
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Upload New File
parent
00081101
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
62 additions
and
0 deletions
+62
-0
functions.php
transportasi/user/functions.php
+62
-0
No files found.
transportasi/user/functions.php
0 → 100644
View file @
6323c486
<?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
);
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment