div -- File Button --
div class=form-group label class=col-md-4
control-label for=gambarGambarlabel div class=col-md-4
input id=gambar name=gambar class=input-file type=file
div div
div class=form-group label class=col-md-4
control-label for=label div class=col-md-4
input id=submit name=submit class=input-submit
type=submit div div fieldset
form divsection
?php include incfooter.php; ?
1.6 tambahberita.php
?php include incheader.php; ? ?php
if isset_GET[judul] { judul_q = _GET[judul];
}if isset_POST[submit] { judul = _POST[judul];
pembuat = _POST[pembuat]; keterangan = _POST[keterangan];
waktu = _POST[tanggal]; imgFile = _FILES[gambar][name];
tmp_dir = _FILES[gambar][tmp_name];
Universitas Sumatera Utara
imgSize = _FILES[gambar][size]; if emptyjudul {
errMSG = Masukkan judul.; } else if emptyketerangan {
errMSG = Masukkan keterangan.; } else if emptyimgFile {
errMSG = Pilih gambar.; } else {
upload_dir = ..foto_berita; upload directory
imgExt = strtolowerpathinfoimgFile, PATHINFO_EXTENSION; get image extension
valid image extensions valid_extensions = arrayjpeg,
jpg, png, gif; valid extensions rename uploading image
userpic = rand1000, 1000000 . . . imgExt;
allow valid image file formats if in_arrayimgExt,
valid_extensions { Check file size 5MB
if imgSize 500000000000 { move_uploaded_filetmp_dir,
upload_dir . userpic; } else {
errMSG = Maaf, file terlalu besar.; } } else {
errMSG = Hanya tipe JPG, JPEG, PNG GIF yang diizinkan.;
} if isseterrMsg { query2 = mysqli_querykon,
INSERT INTO beritajudul, keterangan, pembuat,
Universitas Sumatera Utara
gambar VALUESjudul, keterangan, pembuat, userpic;
if query2 { ? script
alertData berhasil di tambah; window.location.href =
index.php?berita; script ?php } else { echo Error.. .
mysqli_errorkon; } } else { ? script
alert?php echo errMSG; ?; script ?php }}?
section id=section div class=section- container form class=form-horizontal
role=form action= method=post enctype=multipartform-data
?php if isseterrMSG {
? div ?php echo errMSG; ?
div ?php } ? fieldset -- Form Name --
legendBeritalegend div class=form-group
label class=col-md-4 control-label for=judulJudullabel
div class=col-md-6 input id=textinput
name=judul type=text placeholder= class=form-control input-md required=true
div div div class=form-group
Universitas Sumatera Utara
label class=col-md-4 control-label for=pembuatPembuatlabel
div class=col-md-6 input id=textinput
name=pembuat type=text placeholder= class=form-control input-md required=true
div div label class=col-md-4 control-label for=tanggalWaktulabel
div class=col-md-6 input id=textinput name=tanggal
type=text placeholder= class=form-control input-md required=true
div div -- Textarea --
div class=form-group label class=col-md-4
control-label for=keteranganKeteranganlabel
div class=col-md-6textarea rows=10 class=form-control id=keterangan
name=keterangantextarea div div
-- Text input-- div class=form-group
label class=col-md-4 control-label for=label
div class=col-md-4 img class=img-
thumbnail src= div
div -- File Button --
div class=form-group
Universitas Sumatera Utara
label class=col-md-4 control-label for=gambarGambarlabel
div class=col-md-4 input id=gambar
name=gambar class=input-file type=file div
div div class=form-group
label class=col-md-4 control-label for=label
div class=col-md-4 input id=submit
name=submit class=input-submit type=submit div
div fieldset form div
section?php include incfooter.php; ?
1.7 logout.php