0% found this document useful (0 votes)
7 views23 pages

Laporan Programmer

The document outlines a web application for user registration, login, and loan application processes, including HTML forms and PHP scripts for handling user inputs and database interactions. It features user input sanitization, password hashing, and file uploads for KTP images. The CSS styles are designed to create a user-friendly interface with responsive layouts.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views23 pages

Laporan Programmer

The document outlines a web application for user registration, login, and loan application processes, including HTML forms and PHP scripts for handling user inputs and database interactions. It features user input sanitization, password hashing, and file uploads for KTP images. The CSS styles are designed to create a user-friendly interface with responsive layouts.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 23

FORM REGISTER

Program
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-
scale=1.0">
<link rel="stylesheet" href="style.css">
<title>Register</title>
</head>
<body>
<div class="container">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="pinjol_web/cashd" />
<h2>Register</h2>
<form action="register_process.php" method="POST">
<div class="form-group">
<label for="username">Username:</label>
<input type="text" id="username" name="username"
required>
</div>
<div class="form-group">
<label for="password">Password:</label>
<input type="password" id="password" name="password"
required>
</div>
<div class="form-group">
<button type="submit">Register</button>
<button type="button"
onclick="window.location.href='indeks.php'">Back to Login</button>
</div>
</form>
</div>
</body>
</html>

Program relasi Register


<?php
include 'db.php';

$username = $_POST['username'];
$password = $_POST['password'];

// Sanitize input
$username = $conn->real_escape_string($username);
$password = $conn->real_escape_string($password);

// Hash the password


$password = md5($password);

$sql = "INSERT INTO users (username, password) VALUES ('$username',


'$password')";

if ($conn->query($sql) === TRUE) {


echo "<script>alert('Registration successful');
window.location.href='indeks.php';</script>";
} else {
echo "Error: " . $sql . "<br>" . $conn->error;
}

$conn->close();
?>
CSS
body {
font-family: Arial, sans-serif;
background-color: blue;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
margin: 0;
}

.container {
background-color: #fff;
padding: 30px;
border-radius: 10px;
box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
width: 400px;
text-align: center;
}

h2 {
margin-bottom: 20px;
font-size: 24px;
}

.form-group {
margin-bottom: 20px;
text-align: left;
}

label {
display: block;
margin-bottom: 5px;
font-weight: bold;
}

input[type="text"],
input[type="password"] {
width: calc(100% - 22px);
padding: 10px;
margin-top: 5px;
border: 1px solid #ccc;
border-radius: 5px;
}
button {
padding: 10px 20px;
border: none;
border-radius: 5px;
cursor: pointer;
width: 100%;
margin-top: 10px;
}

button[type="submit"] {
background-color: #28a745;
color: #fff;
}

button[type="button"] {
background-color: #007bff;
color: #fff;
}

.button-group {
display: flex;
flex-direction: column;
align-items: center;
}

FORM LOGIN
Program
!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-
scale=1.0">
<link rel="stylesheet" href="style.css">
<title>Login</title>
</head>
<body>
<div class="container">
<h2>Login</h2>
<form action="login_process.php" method="POST">
<div class="form-group">
<label for="username">Username:</label>
<input type="text" id="username" name="username"
required>
</div>
<div class="form-group">
<label for="password">Password:</label>
<input type="password" id="password" name="password"
required>
</div>
<div class="form-group">
<button type="submit">Login</button>
<button type="button"
onclick="window.location.href='register.php'">Register</button>
</div>
<div class="form-group">
<a href="info.php" class="next-button">Info Lebih
Lanjut</a>
</div>
</form>
</div>
</body>
</html>

Relasi Login
<?php
session_start();
include 'db.php';

$username = $_POST['username'];
$password = $_POST['password'];

// Sanitize input
$username = $conn->real_escape_string($username);
$password = $conn->real_escape_string($password);

// Hash the password


$password = md5($password);

$sql = "SELECT * FROM users WHERE username='$username' AND


password='$password'";
$result = $conn->query($sql);

if ($result->num_rows > 0) {
$_SESSION['username'] = $username;
header("Location: peminjaman.php");
} else {
echo "<script>alert('Invalid username or password');
window.location.href='indeks.php';</script>";
}

$conn->close();
?>

CSS
body {
font-family: 'Arial', sans-serif;
background-color: blue;
display: flex;
justify-content: center;
align-items: center;
height: 200vh;
margin: 0;
}

.container {
background-color: #fff;
padding: 30px;
border-radius: 10px;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
width: 100%;
max-width: 600px;
}

h2 {
margin-bottom: 20px;
color: #333;
font-size: 24px;
text-align: center;
}

.form-group {
margin-bottom: 20px;
}

label {
display: block;
margin-bottom: 8px;
font-weight: bold;
color: #b62222;
}

input[type="text"],
input[type="number"],
input[type="file"],
textarea {
width: 100%;
padding: 12px;
border: 1px solid #ddd;
border-radius: 5px;
box-sizing: border-box;
font-size: 16px;
color: #333;
}

input[type="text"]:focus,
input[type="number"]:focus,
textarea:focus {
border-color: #007bff;
outline: none;
box-shadow: 0 0 5px rgba(0, 123, 255, 0.2);
}

textarea {
resize: vertical;
height: 100px;
}

.button-group {
display: flex;
justify-content: space-between; /* Mengatur jarak antara tombol
secara merata */
margin-top: 20px; /* Jarak antara tombol dengan elemen di atasnya
*/
flex: 1; /* Menggunakan flex untuk tombol Kirim agar menyesuaikan
ruang yang tersedia */
}

button {
padding: 12px 20px;
border: none;
border-radius: 5px;
cursor: pointer;
font-size: 16px;
transition: background-color 0.3s ease;
}

button[type="submit"] {
background-color: #28a745;
color: #fff;
margin-right: 10px;

button[type="submit"]:hover {
background-color: #218838;
}

button[type="button"] {
background-color: #007bff;
color: #fff;
}

button[type="button"]:hover {
background-color: #0056b3;
}
.next-button {
padding: 12px 20px;
background-color: #28a745; /* Warna hijau */
color: #fff;
border: none;
border-radius: 5px;
cursor: pointer;
font-size: 16px;
transition: background-color 0.3s ease;
text-decoration: none; /* Menghapus garis bawah default pada tautan
*/

}
.next-button:hover {
background-color: #218838; /* Warna hijau gelap saat dihover */
}

FORM PEMINJAMAN
Program
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-
scale=1.0">
<link rel="stylesheet" href="style1.css">
<title>Formulir Peminjaman</title>
</head>
<body>
<div class="container">
<h2>Formulir Peminjaman</h2>
<form action="process_peminjaman.php" method="POST"
enctype="multipart/form-data">
<div class="form-group">
<label for="nama_lengkap">Nama Lengkap:</label>
<input type="text" id="nama_lengkap"
name="nama_lengkap" required>
</div>
<div class="form-group">
<label for="nomor_telefon">Nomor Telefon:</label>
<input type="text" id="nomor_telefon"
name="nomor_telefon" required>
</div>
<div class="form-group">
<label for="nomor_wa">Nomor WA:</label>
<input type="text" id="nomor_wa" name="nomor_wa"
required>
</div>
<div class="form-group">
<label for="alamat">Alamat:</label>
<textarea id="alamat" name="alamat"
required></textarea>
</div>
<div class="form-group">
<label for="tujuan_peminjaman">Tujuan
Peminjaman:</label>
<input type="text" id="tujuan_peminjaman"
name="tujuan_peminjaman" required>
</div>
<div class="form-group">
<label for="jumlah_peminjaman">Jumlah
Peminjaman:</label>
<input type="number" id="jumlah_peminjaman"
name="jumlah_peminjaman" required>
</div>
<div class="form-group">
<label for="nomor_rekening">Nomor Rekening:</label>
<input type="text" id="nomor_rekening"
name="nomor_rekening" required>
</div>
<div class="form-group">
<label for="jenis_bank">Jenis Bank:</label>
<input type="text" id="jenis_bank" name="jenis_bank"
required>
</div>
<div class="form-group">
<label for="foto_ktp">Foto KTP:</label>
<input type="file" id="foto_ktp" name="foto_ktp"
required>
</div>
<div class="form-group">
<label for="tanggal_pengembalian">Tanggal
Pengembalian:</label>
<input type="date" id="tanggal_pengembalian"
name="tanggal_pengembalian" required>
</div>
<div class="button-group">
<button type="submit">Kirim</button>
</div>
<div class="button-group">
<a href="info.php" class="next-button">Info Lebih
Lanjut</a>
</div>
<div class="button-group">
<a href="tabel_peminjaman.php" class="next-
button">Silahkan Klik Jika Sudah Mengisi Formulir</a>
</div>
</form>
</div>
</body>
</html>

Relasi Peminjaman
<?php
include 'db.php';

$target_dir = "uploads/";

// Cek apakah folder sudah ada


if (!file_exists($target_dir)) {
// Buat folder jika belum ada
if (!mkdir($target_dir, 0777, true)) {
die("Gagal membuat folder 'uploads'.");
}
}

// Ambil nilai dari formulir


$nama_lengkap = $_POST['nama_lengkap'];
$email = $_POST['email'];
$nomor_telefon = $_POST['nomor_telefon'];
$alamat = $_POST['alamat'];
$penghasilan_bulanan = $_POST['penghasilan_bulanan'];
$status_pekerjaan = $_POST['status_pekerjaan'];
$nomor_rekening = $_POST['nomor_rekening'];
$jenis_bank = $_POST['jenis_bank'];
$foto_ktp = $_FILES['foto_ktp'];
$tanggal_pengembalian = $_POST['tanggal_pengembalian']; // Ambil nilai
tanggal pengembalian

// Handle file upload


$target_file = $target_dir . basename($foto_ktp["name"]);
$uploadOk = 1;
$imageFileType = strtolower(pathinfo($target_file,
PATHINFO_EXTENSION));

// Check if image file is a actual image or fake image


$check = getimagesize($foto_ktp["tmp_name"]);
if($check !== false) {
$uploadOk = 1;
} else {
echo "File is not an image.";
$uploadOk = 0;
}

// Check if file already exists


if (file_exists($target_file)) {
echo "Sorry, file already exists.";
$uploadOk = 0;
}

// Check file size


if ($foto_ktp["size"] > 500000) {
echo "Sorry, your file is too large.";
$uploadOk = 0;
}

// Allow certain file formats


if($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType
!= "jpeg"
&& $imageFileType != "gif" ) {
echo "Sorry, only JPG, JPEG, PNG & GIF files are allowed.";
$uploadOk = 0;
}

// Check if $uploadOk is set to 0 by an error


if ($uploadOk == 0) {
echo "Sorry, your file was not uploaded.";
// if everything is ok, try to upload file
} else {
if (move_uploaded_file($foto_ktp["tmp_name"], $target_file)) {
$sql = "INSERT INTO peminjaman (nama_lengkap, nomor_telefon,
nomor_wa, alamat, tujuan_peminjaman, jumlah_peminjaman, nomor_rekening,
jenis_bank, foto_ktp, tanggal_pengembalian)
VALUES ('$nama_lengkap', '$nomor_telefon', '$nomor_wa',
'$alamat', '$tujuan_peminjaman', '$jumlah_peminjaman',
'$nomor_rekening', '$jenis_bank', '$target_file',
'$tanggal_pengembalian')";

if ($conn->query($sql) === TRUE) {


echo "<script>alert('Data berhasil disimpan. Dana akan
masuk ke rekening anda, silahkan tunggu !!!');
window.location.href='peminjaman.php';</script>";
} else {
echo "Error: " . $sql . "<br>" . $conn->error;
}
} else {
echo "Sorry, there was an error uploading your file.";
}
}

$conn->close();
?>

Program Uploads Image


<?php
$target_dir = "uploads/";

// Cek apakah folder sudah ada


if (!file_exists($target_dir)) {
// Buat folder jika belum ada
if (mkdir($target_dir, 0777, true)) {
echo "Folder 'uploads' berhasil dibuat.";
} else {
echo "Gagal membuat folder 'uploads'.";
}
} else {
echo "Folder 'uploads' sudah ada.";
}
?>

CSS
body {
font-family: 'Arial', sans-serif;
background-color: blue;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
margin: 0;
}

.container {
background-color: #fff;
padding: 30px;
border-radius: 10px;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
width: 100%;
max-width: 1200px;
margin: 20px;
}

h2 {
margin-bottom: 20px;
color: #333;
font-size: 24px;
text-align: center;
}

.instructions {
font-size: 16px;
color: #555;
margin-bottom: 20px;
text-align: center;
}

table {
width: 100%;
border-collapse: collapse;
margin-top: 20px;
}

table, th, td {
border: 1px solid #ddd;
}

th, td {
padding: 12px;
text-align: left;
color: #333;
}

th {
background-color: #f2f2f2;
}
tr:nth-child(even) {
background-color: #f9f9f9;
}

a {
color: #007bff;
text-decoration: none;
}

a:hover {
text-decoration: underline;
}

.button-group {
display: flex;
justify-content: center;
margin-top: 20px;
}

.btn-back {
padding: 12px 20px;
border: none;
border-radius: 5px;
background-color: #007bff;
color: #fff;
text-decoration: none;
font-size: 16px;
transition: background-color 0.3s ease;
text-align: center;
}

.btn-back:hover {
background-color: #0056b3;
}

FORM DATA
Program
<?php
include 'db.php';

$sql = "SELECT * FROM peminjaman";


$result = $conn->query($sql);
?>

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-
scale=1.0">
<link rel="stylesheet" href="style2.css">
<title>Data Peminjaman</title>
</head>
<body>
<div class="container">
<h2>Data Peminjaman</h2>
<p class="instructions">Silahkan cari nama anda, jika data anda
sudah muncul, tolong di screenshoot.</p>
<table>
<thead>
<tr>
<th>ID</th>
<th>Nama Lengkap</th>
<th>Nomor Telefon</th>
<th>Nomor WA</th>
<th>Alamat</th>
<th>Tujuan Peminjaman</th>
<th>Jumlah Peminjaman</th>
<th>Nomor Rekening</th>
<th>Jenis Bank</th>
<th>Foto KTP</th>
<th>Tanggal</th>
<th>Tanggal pengembalian</th>
</tr>
</thead>
<tbody>
<?php if ($result->num_rows > 0): ?>
<?php while($row = $result->fetch_assoc()): ?>
<tr>
<td><?php echo $row["id"]; ?></td>
<td><?php echo $row["nama_lengkap"]; ?
></td>
<td><?php echo $row["nomor_telefon"]; ?
></td>
<td><?php echo $row["nomor_wa"]; ?></td>
<td><?php echo $row["alamat"]; ?></td>
<td><?php echo $row["tujuan_peminjaman"]; ?
></td>
<td><?php echo $row["jumlah_peminjaman"]; ?
></td>
<td><?php echo $row["nomor_rekening"]; ?
></td>
<td><?php echo $row["jenis_bank"]; ?></td>
<td><a href="<?php echo $row["foto_ktp"]; ?
>" target="_blank">Lihat KTP</a></td>
<td><?php echo $row["created_at"]; ?></td>
<td><?php echo
$row["tanggal_pengembalian"]; ?></td>
</tr>
<?php endwhile; ?>
<?php else: ?>
<tr>
<td colspan="11">Tidak ada data
peminjaman.</td>
</tr>
<?php endif; ?>
</tbody>
</table>
<div class="button-group">
<a href="peminjaman.php" class="btn-back">Kembali</a>
</div>
</div>
</body>
</html>

<?php
$conn->close();
?>

CSS
body {
font-family: Arial, sans-serif;
background-color: blue;
margin: 0;
padding: 0;
display: flex;
justify-content: center;
align-items: center;
height: 120vh;
}

.form-container {
background-color: #fff;
padding: 20px;
border-radius: 5px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
width: 500px;
}

form {
display: flex;
flex-direction: column;
}

form h2 {
margin-bottom: 20px;
}

label {
margin-bottom: 5px;
}

input[type="text"],
input[type="number"],
input[type="file"] {
padding: 10px;
margin-bottom: 15px;
border: 1px solid #ccc;
border-radius: 4px;
}

input[type="submit"] {
background-color: #28a745;
color: white;
padding: 10px;
border: none;
border-radius: 4px;
cursor: pointer;
}

input[type="submit"]:hover {
background-color: #218838;
}

FORM INFO
CSS
body {
font-family: 'Arial', sans-serif;
background-color: #f9f9f9;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
margin: 0;
}

.container {
background-color: #fff;
padding: 30px;
border-radius: 10px;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
width: 100%;
max-width: 600px;
text-align: center; /* Center align content */
}

h2 {
margin-bottom: 20px;
color: #333;
font-size: 24px;
}

.contact-info {
margin-top: 20px;
}

.contact-info p {
font-size: 18px; /* Adjust font size */
color: #555;
margin-bottom: 10px; /* Add margin below the paragraph */
}

.contact-info a {
display: inline-block;
}

.contact-info img {
width: 100px; /* Adjust image size */
vertical-align: middle;
}

DATABASE
<?php
$servername = "localhost";
$username = "root"; // Sesuaikan dengan username database Anda
$password = ""; // Sesuaikan dengan password database Anda
$dbname = "your_database"; // Nama database Anda

// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);

// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
?>

php MyAdmin

You might also like