Listing Program

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 12

L-1

LISTING PROGRAM

<?php <td align="center"


session_start(); width="75%">
$jdl="SISTEM PELAPOR TINDAK <h1 class="white"><?
KEKERASAN PEREMPUAN DAN php echo $sk;?></h1>
ANAK PADA P2TP2A"; <h4 class="white"><?
$sk="Dinas PPKB Dan PPA php echo $almt;?></h4>
Kabupaten Langkat"; <h2 class="white"><?
$almt="Jl. Proklamasi, Kwala Bingai, php echo $jdl;?></h2>
Kec. Stabat, Kabupaten Langkat, </td>
Sumatera Utara 20811"; </tr>
$_SESSION['judul']=$jdl; </table>
$_SESSION['almt']=$almt; </div>
$_SESSION['sk']=$sk; <div id="content-login">
if(!empty($_GET['errrorrr'])){ <?php
if($_GET['errrorrr']=="abcdefghijklm if(empty($_GET['act'])){
nopgrstupwxyz1234567890"){ ?>
$pesan="Kesalahan dalam <form action="aksi_login.php"
input username atau password !!!"; method="post">
}else{ <table align="center"
$pesan=""; id="form">
} <tr>
}else{ <th colspan="2">
$pesan=""; <h2 class="black">Login
} Sistem</h2>
include"latar/latar.php"; </th>
require_once"koneksi/koneksi.php"; </tr>
?> <tr>
<html>
<head> <th colspan="2">
<title><?php echo $jdl;?></title> <img
</head> src="gambar/logo-p2tp2a.png"
<body> width="175"/>
<div id="main-conten"> </th>
<div id="header"> </tr>
<table width="100%"> <tr>
<tr> <th colspan="2">
L-2

<h2 class="blue"><?php }else{


echo $sk;?></h2> $act=$_GET['act'];
</th> if($act=='daftarakun'){
</tr> ?>
<tr> <form method="post"
<td> action="aksi_login.php?
<b>Username</b> act=daftarakun">
</td> <table class="box-form"
<td> width="100%" align="center">
<input type="text" <tr>
name="username" id="input-login" <th colspan="2"
placeholder="Username" /> class="th-form"><h2>Form Daftar
</td> Akun Pelaporan</h2></th>
</tr> </tr>
<tr> <tr>
<td> <td>Nama</td>
<b>Password</b> <td><input
</td> type="text" name="nama" id="nama"
<td> class="input" placeholder="Nama"
<input /><font size="-1" color="red">*Wajib
type="password" name="password" diisi</font></td>
id="input-login" </tr>
placeholder="Password" /> <tr>
</td> <td>NIK
</tr> KTP</td>
<tr> <td><input
<td colspan="3" type="text" name="nik" id="nik"
align="center"> class="input" placeholder="NIK KTP"
<input type="submit" /><font size="-1" color="red">*Wajib
value="Dafar Akun" name="daftar" diisi</font></td>
class="tombol-login"> </tr>
<tr>
<input type="submit" value="Login"
name="login" class="tombol-login"> <td>Alamat</td>
</td> <td><textarea
</tr> name="alamat" id="alamat"
</table> class="textarea"
<div class="red"><?php echo placeholder="Alamat"></textarea><fo
$pesan;?></div> nt size="-1" color="red">*Wajib
</form> diisi</font></td>
<?php </tr>
L-3

<tr> id="tombol" class="tombol-form"


value="Daftar">
<td>Pekerjaan</td> </td>
<td><input </tr>
type="text" name="pekerjaan" </table>
id="pekerjaan" class="input" </form>
placeholder="Pekerjaan"/><font <?php
size="-1" color="red">*Wajib }elseif($act=='daftarakunberhasil'){
diisi</font></td> $username=$_GET['username'];
</tr> $password=$_GET['password'];
<tr> ?>
<td>Usia</td> <form method="post"
<td><input action="aksi_login.php?">
type="text" name="usia" id="usia" <table class="box-form"
class="input" width="100%" align="center">
placeholder="Usia"/><font size="-1" <tr>
color="red">*Wajib diisi</font></td> <th
</tr> colspan="2"><h2>Daftar Akun
<tr> Berhasil</h2></th>
<td>No. </tr>
Telepon</td> <tr>
<td><input <th
type="text" name="telepon" colspan="2"><font
id="telepon" class="input" color="red">Berikut username dan
placeholder="Nomor Telepon/HP" password yang dapat digunakan untuk
/><font size="-1" color="red">*Wajib login ke sistem</font></th>
diisi</font></td> </tr>
</tr> <tr>
<tr>
<td colspan="2" <td>Username</td>
align="center"> <td><input
<input type="text" class="input" value="<?
type="submit" name="batal" php echo $username;?>" disabled
id="batal" class="tombol-form" /></td>
value="Batal"/> </tr>
<input <tr>
type="reset" name="tombol"
id="tombol" class="tombol-form" <td>Password</td>
value="Reset"> <td><input
<input type="text" class="input" value="<?
type="submit" name="daftarakun"
L-4

php echo $password;?>" disabled <input


/></td> type="submit" name="daftar"
</tr> id="tombol" class="tombol-formb"
<tr> value="Kembali Ke Daftar Akun">
<td colspan="2" </td>
align="center"> </tr>
<input </table>
type="submit" name="tombol" </form>
id="tombol" class="tombol-formb" <?php
value="Kembali Ke Login Sistem"> }
</td> }
</tr> ?>
</table> </div>
</form> </div>
<?php </body>
}elseif($act=='daftarakungagal'){ </html>
$nik=$_GET['nik'];
?> DAFTAR PELAPOR :
<form method="post" <?php
action="aksi_login.php?"> require_once "koneksi\koneksi.php";
<table class="box-form" if(isset($_POST['login'])){
width="100%" align="center"> $user = $_POST['username'];
<tr> $pass = MD5($_POST['password']);
<th $q_user = mysql_query("select * from
colspan="2"><h2>Daftar Akun tabel_user where username='$user'
Gagal</h2></th> and password='$pass'");
</tr> $d_ada = mysql_num_rows($q_user);
<tr> $d_user =
<th mysql_fetch_array($q_user);
colspan="2"><font color="red">NIK //jika username dan password
KTP <?php echo $nik; ?> sudah ditemukan
terdaftar !!!</font></th> if($d_ada > 0){
</tr> session_start();
$_SESSION['login'] = 1;
<tr> $level=$d_user['level'];
<td colspan="2" if($level=='pelapor'){
align="center"> $id_pelapor=$d_user['id_pelapor'];
<input $id_pegawai="";
type="submit" name="tombol" $q_pelapor = mysql_query("select *
id="tombol" class="tombol-formb" from tabel_pelapor where
value="Kembali Ke Login Sistem"> id_pelapor='$id_pelapor'");
L-5

$d_pelapor = }elseif(isset($_POST['daftarakun'])){
mysql_fetch_array($q_pelapor); if($_GET['act']=='daftarakun')
$nama_pengguna = {
$d_pelapor['nama']; $nama=$_POST['nama'];
}else{ $alamat=$_POST['alamat'];
$id_pelapor=""; $nik=$_POST['nik'];
$id_pegawai=$d_user['id_pegawai']; $telepon=$_POST['telepon'];
$q_pegawai = mysql_query("select *
from tabel_pegawai where $pekerjaan=$_POST['pekerjaan'];
id_pegawai='$id_pegawai'"); $usia=$_POST['usia'];
$d_pegawai = $aktif='aktif';
mysql_fetch_array($q_pegawai); $q_pelapor =
$nama_pengguna=$d_pegawai['nama mysql_query("select * from
_pegawai']; tabel_pelapor where nik_ktp='$nik'");
} $d_pelapor =
$_SESSION['id_pegawai']=$id_pega mysql_fetch_array($q_pelapor);
wai; if(empty($d_pelapor )){
$_SESSION['id_pelapor']=$id_pelapo mysql_query("INSERT INTO
r; tabel_pelapor(id_pelapor, nama,
$_SESSION['nama_pengguna']=$nam nik_ktp, alamat, no_telepon,
a_pengguna; pekerjaan,usia,status_pelapor)
$_SESSION['level']=$level; VALUES
header("location:sistem/sistem.php"); ( 'NULL' , '$nama', '$nik','$alamat',
}else{ '$telepon','$pekerjaan', '$usia',
//jika username dan password tidak '$aktif')");
ada $q_pelapor1 =
?> mysql_query("select * from
<script> tabel_pelapor order by id_pelapor
desc");
window.alert("ANDA $d_pelapor1 =
GAGAL MASUK KE SISTEM"); mysql_fetch_array($q_pelapor1);

window.location="index.php? $id_pelapor=$d_pelapor1['id_pelapor'
errrorrr=abcdefghijklmnopgrstupwxyz ];
1234567890"; $username=$nik;
</script> $tahun=date('y');
<?php $bulan=date('m');
} $tanggal=date('d');
}elseif(isset($_POST['daftar'])){ $jam=date('H');
header("location:index.php? $menit=date('i');
act=daftarakun"); $detik=date('s');
L-6

$password=($tahun.$bulan. mysql_query("INSERT
$tanggal.$jam.$menit.$detik); INTO tabel_kasus(id_kasus,
$level='pelapor'; jenis_kasus, pasal_kasus,
mysql_query("INSERT INTO hukuman_kasus, keterangan_kasus,
tabel_user( username, password, level, status_kasus)
id_pelapor, status_user) VALUES
VALUES ( 'NULL' , '$kasus',
('$username',MD5('$password'), '$pasal','$hukuman', '$ket', '$aktif')");
'$level', '$id_pelapor','$aktif')");
header("location:index.php?
act=daftarakunberhasil&username=$n header("location:../../sistem.php?
ik&password=$password"); module=datakasus");
}else{ }elseif($act=="update"){
header("location:index.php?
act=daftarakungagal&nik=$nik"); mysql_query("UPDATE
} tabel_kasus SET
}else{ jenis_kasus='$kasus',
header("location:index.php"); pasal_kasus='$pasal',
}
}else{ hukuman_kasus='$hukuman',
header("location:index.php");
} keterangan_kasus='$ket',
?> status_kasus='$aktif'
DATA KASUS : WHERE
<?php tabel_kasus.id_kasus='$id_kasus' ");
require_once
"../../../koneksi/koneksi.php";
if(isset($_POST['tombol'])){ header("location:../../sistem.php?
session_start(); module=datakasus");
$act=$_GET['act']; }else{
if($act=="tambah" or
$act=="update"){
header("location:../../sistem.php?
$id_kasus=$_POST['id_kasus']; module=datakasus");
$kasus=$_POST['kasus']; }
$pasal=$_POST['pasal']; }else{

$hukuman=$_POST['hukuman'];
$ket=$_POST['ket']; header("location:../../sistem.php?
$aktif=$_POST['aktif']; module=datakasus");
if($act=="tambah"){ }
L-7

}else{
if(!empty($_GET['act'])){ $usia_terlapor=$_POST['usia_terlapor
if($_GET['act']=="hapus"){ '];
$id_kasus=$_GET['id_kasus']; //KORBAN
mysql_query("DELETE
FROM tabel_kasus WHERE $nama_korban=$_POST['nama_korba
tabel_kasus.id_kasus = '$id_kasus'"); n'];

header("location:../../sistem.php? $alamat_korban=$_POST['alamat_kor
module=datakasus"); ban'];
}else{
$pekerjaan_korban=$_POST['pekerjaa
header("location:../../sistem.php? n_korban'];
module=datakasus");
} $usia_korban=$_POST['usia_korban'];
} //KASUS
else{
$id_kasus=$_POST['id_kasus'];
header("location:../../sistem.php? //WAKTU KEJADIAN
module=datakasus");
} $jam_kejadian=$_POST['jam'];
}
DATA PELAPORAN : $menit_kejadian=$_POST['menit'];
<?php $date = new DateTime("0000-
require_once 00-00 ".$jam_kejadian.":".
"../../../koneksi/koneksi.php"; $menit_kejadian.":00");
if(isset($_POST['buat'])){ $waktu_kejadian=$date-
session_start(); >format('H:i');

$id_pelapor=$_SESSION['id_pelapor' $tanggal_kejadian=$_POST['tanggal_
]; kejadian'];
//TERLAPOR
$tanggal_k=substr($tanggal_kejadian,
$nama_terlapor=$_POST['nama_terla 8,2);
por'];
$bulan_k=substr($tanggal_kejadian,5,
$alamat_terlapor=$_POST['alamat_ter 2);
lapor'];
$tahun_k=substr($tanggal_kejadian,0,
$pekerjaan_terlapor=$_POST['pekerja 4);
an_terlapor'];
L-8

$day = mktime(0, 0, 0, else if ($hari_p == "Saturday")


date($bulan_k), date($tanggal_k)+ { $hari_pelaporan = "Sabtu";}
$selisih, date($tahun_k)); else{ $hari_pelaporan = "-";}
$hari_k=date("l", $day);
if ($hari_k == "Sunday")
{ $hari_kejadian = "Minggu";} $tempat_kejadian=$_POST['tempat_k
else if ($hari_k == "Monday") ejadian'];
{ $hari_kejadian = "Senin";}
else if ($hari_k == "Tuesday") $kronologis_kejadian=$_POST['krono
{ $hari_kejadian = "Selasa";} logis_kejadian'];
else if ($hari_k ==
"Wednesday"){ $hari_kejadian = $keterangan=$_POST['keterangan'];
"Rabu";}
else if ($hari_k == $kerugian=$_POST['kerugian'];
"Thursday"){ $hari_kejadian =
"Kamis";} mysql_query("INSERT INTO
else if ($hari_k == "Friday") tabel_pelaporan(id_pelaporan,
{ $hari_kejadian = "Jumat";} id_pelapor, id_kasus,
else if ($hari_k == "Saturday") tempat_kejadian, kerugian,
{ $hari_kejadian = "Sabtu";} kronologis_kejadian,
else{ $hari_kejadian = "-";} keterangan_pelaporan)
//WAKTU PELAPORAN VALUES
$waktu_pelaporan=date('H:i'); ( 'NULL' , '$id_pelapor',
$tanggal_pelaporan=date('Y- '$id_kasus','$tempat_kejadian',
m-d'); '$kerugian', '$kronologis_kejadian',
$hari_p=date("l"); '$keterangan')");
if ($hari_p == "Sunday") $q_pelaporan =
{ $hari_pelaporan = "Minggu";} mysql_query("select * from
else if ($hari_p == "Monday") tabel_pelaporan order by id_pelaporan
{ $hari_pelaporan = "Senin";} desc");
else if ($hari_p == "Tuesday") $d_pelaporan =
{ $hari_pelaporan = "Selasa";} mysql_fetch_array($q_pelaporan);
else if ($hari_p == $id_pelaporan =
"Wednesday"){ $hari_pelaporan = $d_pelaporan['id_pelaporan'];
"Rabu";}
else if ($hari_p == $_SESSION['id_pelaporan']=$id_pela
"Thursday"){ $hari_pelaporan = poran;
"Kamis";} mysql_query("INSERT INTO
else if ($hari_p == "Friday") tabel_terlapor(id_terlapor,
{ $hari_pelaporan = "Jumat";} id_pelaporan, nama_terlapor,
L-9

alamat_terlapor, pekerjaan_terlapor,
usia_terlapor) header("location:../../sistem.php?
VALUES module=buatpelaporan&act=berhasil"
( 'NULL' , '$id_pelaporan', );
'$nama_terlapor','$alamat_terlapor', }elseif(isset($_POST['pesan']))
'$pekerjaan_terlapor', {
'$usia_terlapor')");
mysql_query("INSERT INTO $id_pelaporan=$_POST['id_pelaporan
tabel_korban(id_korban, id_pelaporan, '];
nama_korban, alamat_korban, $pesan=$_POST['pesanp'];
pekerjaan_korban, usia_korban) mysql_query("INSERT INTO
VALUES tabel_pesan_pelaporan(id_pesan_pela
( 'NULL' , '$id_pelaporan', poran, id_pelaporan, pesan_pelapor)
'$nama_korban', '$alamat_korban', VALUES
'$pekerjaan_korban', ( 'NULL' , '$id_pelaporan', '$pesan')");
'$usia_korban')");
mysql_query("INSERT INTO header("location:../../sistem.php?
tabel_waktu_kejadian(id_waktu_kejad module=buatpelaporan&act=terkirim"
ian, id_pelaporan, hari_kejadian, );
tanggal_kejadian, waktu_kejadian) }else{
VALUES
( 'NULL' , '$id_pelaporan', header("location:../../sistem.php");
'$hari_kejadian', '$tanggal_kejadian', }
'$waktu_kejadian')"); CETAK LAPORAN :
mysql_query("INSERT INTO <font size="+2"><b
tabel_waktu_pelaporan(id_waktu_pela class="black"><?php echo $link; ?
poran, id_pelaporan, hari_pelaporan, ></b></font>
tanggal_pelaporan, waktu_pelaporan) <hr id="hr">
VALUES <?php
( 'NULL' , '$id_pelaporan', if(empty($_GET['tanggal'])){
'$hari_pelaporan', $tanggal=date('Y-m-d');
'$tanggal_pelaporan','$waktu_pelapora $q_pelaporan =
n')"); mysql_query("select *from
$status_pelaporan="terkirim"; tabel_pelaporan a inner join
mysql_query("INSERT INTO tabel_status_pelaporan b on
tabel_status_pelaporan(id_status_pela a.id_pelaporan = b.id_pelaporan
poran, id_pelaporan, status_pelaporan) where b.tanggal_diterima='$tanggal'
VALUES order by a.id_pelaporan desc");
( 'NULL' , '$id_pelaporan', }else{
'$status_pelaporan')"); $tanggal=$_GET['tanggal'];
L-10

$q_pelaporan = <th
mysql_query("select *from class="th">Pelapor</th>
tabel_pelaporan a inner join <th
tabel_status_pelaporan b on class="th">Terlapor</th>
a.id_pelaporan = b.id_pelaporan <th
where b.tanggal_diterima='$tanggal' class="th">Korban</th>
order by a.id_pelaporan desc"); <th
} class="th">Kasus</th>
?> <th
<form method="post" class="th">Kerugian</th>
action="module/cetak/aksi1.php"> <th
<table width="100%"> class="th">Tempat Kejadian</th>
<tr> <th
<td class="th">Waktu Kejadian</th>
width="10%">Tanggal Diterima</td> <th
<td><input class="th">Waktu Pelaporan</th>
type="date" class="input" <th
name="tanggal" id="tanggal" class="th">Kronologi Kejadian</th>
value="<?php echo </tr>
$tanggal;?>"/></td> <?php
<td> $no=1;
<input while($d_pelaporan =
type="submit" name="cari" mysql_fetch_array($q_pelaporan)){
id="tombol" class="tombol-form"
value="Cari">
<input $id_pelaporan=$d_pelaporan['id_pela
type="submit" name="cetak" poran'];
id="tombol" class="tombol-form" ?>
value="Cetak"> <tr>
</td> <td
</tr> class="td"><?php echo $no; ?></td>
</table> <?php
</form>
<br>
<table class="table1" if(empty($d_pelaporan['nomor_pelapo
width="100%"> ran'])){
<tr>
<th $nomor="<font
class="th">No</th> color='red'>Nomor akan diberikan jika
<th pelaporan sudah diterima.</font>";
class="th">Nomor Pelaporan</th> }else{
L-11

$d_korban =
mysql_fetch_array($q_korban);
$nomor=$d_pelaporan['nomor_pelapo ?>
ran']; <td
} class="td"><?php echo
?> $d_korban['nama_korban']; ?></td>
<td <?php
class="td"><?php echo $nomor;
?></td>
<?php $id_kasus=$d_pelaporan['id_kasus'];
$q_kasus =
mysql_query("select *from
$id_pelapor=$d_pelaporan['id_pelapor tabel_kasus where
']; id_kasus='$id_kasus'");
$q_pelapor = $d_kasus =
mysql_query("select *from mysql_fetch_array($q_kasus);
tabel_pelapor where ?>
id_pelapor='$id_pelapor'"); <td
$d_pelapor = class="td"><?php echo
mysql_fetch_array($q_pelapor); $d_kasus['jenis_kasus'];?> (<?php
?> echo $d_kasus['pasal_kasus'];?>
<td )</td>
class="td"><?php echo <td
$d_pelapor['nama']; ?></td> class="td"><?php echo
<?php $d_pelaporan['kerugian'];?></td>
$q_terlapor = <td
mysql_query("select *from class="td"><?php echo
tabel_terlapor where $d_pelaporan['tempat_kejadian'];?></t
id_pelaporan='$id_pelaporan'"); d>
$d_terlapor = <?php
mysql_fetch_array($q_terlapor); $q_wk =
?> mysql_query("select *from
<td tabel_waktu_kejadian where
class="td"><?php echo id_pelaporan='$id_pelaporan'");
$d_terlapor['nama_terlapor']; ?></td> $d_wk =
<?php mysql_fetch_array($q_wk);
$q_korban = ?>
mysql_query("select *from <td
tabel_korban where class="td"><?php echo
id_pelaporan='$id_pelaporan'"); $d_wk['hari_kejadian'];?>, <?php
echo $d_wk['tanggal_kejadian'];?>, <?
L-12

php echo $d_wk['waktu_kejadian'];? <td


></td> class="td"><?php echo
<?php $d_pelaporan['kronologis_kejadian'];?
$q_wp = ></td>
mysql_query("select *from </tr>
tabel_waktu_pelaporan where <?php
id_pelaporan='$id_pelaporan'"); $no++;
$d_wp = }
mysql_fetch_array($q_wp); ?>
?> <tr>
<td <th class="td"
class="td"><?php echo colspan="15" align="left">Jumlah
$d_wp['hari_pelaporan'];?>, <?php Semua Data Pelaporan : <?php echo
echo $d_wp['tanggal_pelaporan'];?>, $no-1; ?></th>
<?php echo </tr>
$d_wp['waktu_pelaporan'];?></td> </table>

You might also like