Showing posts with label PHP. Show all posts
Showing posts with label PHP. Show all posts

Tuesday, December 31, 2019

Proses Login Simpel



what sapp bambang ini adalah source code proses login yang di mana gue cari adalah proses yang paling simpel dan mudah di mengerti.



<?php
include 'koneksi.php';
$username= $_POST['username'];
$password=$_POST['password'];


$query = "SELECT * FROM member WHERE username='$username' and pass='$password'";
$result = $koneksi->query($query) or die($koneksi->error.__LINE__);
if($result->num_rows > 0) {
header("location:admin/examples/data_admin.php");
}
else {

header("location:login.php? pesan=gagal");

}





 ?>
Baca selengkapnya

source code proses upload photo



what sapp bambang ini adalah source code proses upload photo yang di miliki KING sulaiman tetapi sayangnya tidak memiliki validasi ukuran gambar tetapi memiliki tipe format gambar seperti PNG JPG dan JPEG.



<?php

    if(isset($_POST['Submit'])) {
        $no_plat = $_POST['no_plat'];
        $nm_mobil = $_POST['nm_mobil'];
        $thn = $_POST['thn'];
        $merek = $_POST['merek'];
        $digunakan = $_POST['digunakan'];
        $keadaan = $_POST['keadaan'];
        $status = $_POST['status'];

        $nama_file = $_FILES['gambar']['name'];
        $tmp_file = $_FILES['gambar']['tmp_name'];
        $type_file = $_FILES['gambar']['type'];

        // include database connection file
        include_once("koneksi.php");




 if ($nama_file == "") {
        $query = mysqli_query($koneksi, "INSERT INTO data_mobil(no_plat,nm_mobil,thn,merek,digunakan,keadaan,status) VALUES('$no_plat','$nm_mobil', '$thn', '$merek', '$digunakan', '$keadaan','$status')");
        if ($query) {
            echo '<script>alert("Data Berhasil Ditambah");
                     window.location="data_admin.php" </script>';
        } else {
            echo '<script language="javascript">alert("Data Gagal Ditambah!")
        window.history.go(-1);</script>';
        }
    } else {
        if ($type_file == "image/png" or $type_file == "image/jpg" or $type_file == "image/jpeg") {
            $upload = move_uploaded_file($tmp_file, "../../gambar/$nama_file");
            if ($upload) {
                $query = mysqli_query($koneksi, "INSERT INTO `data_mobil` (`no_plat`, `nm_mobil`, `thn`, `merek`, `digunakan`, `keadaan`, `status`, `gambar`) VALUES ('$no_plat', '$nm_mobil', '$thn', '$merek', '$digunakan', '$keadaan', '$status', '$nama_file');");
                if ($query) {
                    echo '<script>alert("Data Berhasil Ditambah");
                     window.location="data_mobil.php" </script>';
                } else {
                    echo '<script language="javascript">alert("Data Gagal Ditambah!")
        window.history.go(-1);</script>';
                }
            }
            else {
                echo '<script language="javascript">alert("Gambar Gagal DiUpload!")
        window.history.go(-1);</script>';
            }
        } else {
            echo '<script language="javascript">alert("Jenis File Tidak Didukung!")
        window.history.go(-1);</script>';
        }
    }
} else {
    echo '<script language="javascript">alert("Data Gagal Ditambah!")
        window.history.go(-1);</script>';
}



    

     
    ?>
Baca selengkapnya

link untuk halaman proses


what sapp bambang ini source code pemilihan kondisi yang di gunakan pada halaman peroses ubah tambah dannn hapus okee........!!!!


1. link + validasi

           if ($query) {
                                echo '<script>alert("Data Berhasil Ditambah");
                               window.location="data_mobil.php" </script>';
                             }

2. link menggunakan meta 

          echo '<meta http-equiv="refresh" content="0; URL=data_sewa.php">';

3. link simpel dan mudah rusak atau mudah error menggunakan 

       header("Location:data_admin.php");
Baca selengkapnya