Skip to content

Instantly share code, notes, and snippets.

Avatar
📍
Work from wherever I am

TFK Project tfkproject

📍
Work from wherever I am
View GitHub Profile
@tfkproject
tfkproject / resetpassword.php
Created Aug 7, 2020
Aplikasi mengirim email, salah satunya bisa dimanfaatkan untuk metode reset password
View resetpassword.php
<?php
require 'PHPMailer/PHPMailerAutoload.php'; // ini lib yg digunakan
$mail = new PHPMailer;
// array for JSON response
$response = array();
$email = $_POST['email']; // parameter cuma email saja
// include db connect class
require 'connect.php';
@tfkproject
tfkproject / fragment_home.xml
Created Jul 26, 2020
Fragment dalam fragment (tab dalam navbottom)
View fragment_home.xml
<!-- ini layout fragment yg berada pada salah satu navbottom -->
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".ui.home.HomeFragment">
<LinearLayout
@tfkproject
tfkproject / AcitvityUtama.java
Last active May 20, 2020
Klik marker untuk masuk ke activity dengan membawa parameter
View AcitvityUtama.java
/*
skema: susun marker (indexing) (1*) > klik marker > munculin infowindow/snip (2)> klik infowindow (3)> masuk ke activity (4)
*/
@Override
public void onMapReady(GoogleMap googleMap) {
mMap = googleMap;
mMap.setMyLocationEnabled(true);
}
@tfkproject
tfkproject / update.php
Created Oct 7, 2019
Untuk proses update
View update.php
<?php
$id_pengumuman = mysqli_real_escape_string($conn, $_POST['id_pengumuman']);
$judul = mysqli_real_escape_string($conn, $_POST['judul']);
$file_lampiran_lama = mysqli_real_escape_string($conn, $_POST['file_lampiran_lama']);
$file_lampiran_baru = $_FILES['file_lampiran_baru']['name'];
$keterangan = mysqli_real_escape_string($conn, $_POST['keterangan']);
if($file_lampiran_baru==null){
$file_lampiran = $file_lampiran_lama; //ambil nama file yg baru
}else{
View edit.php
<form action="update.php" role="form" method="POST" enctype="multipart/form-data">
<input type="hidden" class="form-control" name="id_pengumuman" value="<?php echo $id_pengumuman;?>">
<div class="box-body">
<div class="form-group">
<label>Judul</label>
<input type="text" class="form-control" placeholder="Judul" name="judul" value="<?php echo $data['judul'];?>" required>
</div>
<div class="form-group">
<label>Keterangan</label>
<textarea type="text" class="form-control" placeholder="Keterangan" name="keterangan" required><?php echo $data['keterangan'];?></textarea>
@tfkproject
tfkproject / simpan.php
Created Oct 7, 2019
Untuk proses simpan
View simpan.php
<?php
$judul = mysqli_real_escape_string($conn, $_POST['judul']);
$keterangan = mysqli_real_escape_string($conn, $_POST['keterangan']);
$file_lampiran = $_FILES['file_lampiran']['name'];
$result = mysqli_query($conn, "
INSERT INTO `pengumuman` (`id_pengumuman`, `judul`, `keterangan`, `file_lampiran`, `timestamp`, `status`)
VALUES
(NULL, '$judul', '$keterangan', '$file_lampiran', CURRENT_TIMESTAMP, 'Tidak Aktif')
");
@tfkproject
tfkproject / tambah.php
Created Oct 7, 2019
Untuk form tambah
View tambah.php
<form action="simpan.php" role="form" method="POST" enctype="multipart/form-data">
<div class="box-body">
<div class="form-group">
<label>Judul</label>
<input type="text" class="form-control" placeholder="Judul" name="judul" required>
</div>
<div class="form-group">
<label>Keterangan</label>
<textarea type="text" class="form-control" placeholder="Keterangan" name="keterangan"></textarea>
</div>