Re: proc_reg.php - SOLVED

From abnormal, 2 Years ago, written in PHP, viewed 317 times. This paste will kick the bucket in 1 Second. This paste is a reply to proc_reg.php from abnormal - go back
URL https://code.nat.moe/view/06c985d9/diff Embed
Viewing differences between proc_reg.php and Re: proc_reg.php - SOLVED
<?php
/*
    proc_reg.php -> daftar.php
    was created on 2020/04/08
*/

include "config/config.php";

if (isset($_POST['submit'])) {

    //-------------------------------> START
    $nm_siswa = htmlentities($_POST['namaSiswa']);
    $nm_wali = htmlentities($_POST['namaWali']);
    $username = htmlentities($_POST['username']);
    $password = hash('md5', hash('sha256', $_POST['password']));
    $asal_sklh = htmlentities($_POST['asalSekolah']);

    // Jurusan
    if ($_POST['pilihJurusan'] == "1") {
        $jurusan = "Teknik Komputer dan Jaringan";
    } elseif ($_POST['pilihJurusan'] == "2") {
        $jurusan = "Teknik Otomotif";
    } elseif ($_POST['pilihJurusan'] == "3") {
        $jurusan = "Teknik Mesin";
    } else {
        $jurusan = "";
    }

    // Prestasi
    if ($_POST['pilihPrestasi']){
        $prestasi = "Rangking " . $_POST['pilihPrestasi'];
    } else {
        $prestasi = "";
    }

    $alamat = htmlentities($_POST['alamat']);
    $status = $_POST['status'];

    // Upload File
    $upload_dir = "assets/uploads/";
    $allow_ext = "pdf";
    $fileName = $_FILES['ijazah']['name'];
    $fileType = $_FILES['ijazah']['type'];
    $fileTemp = $_FILES['ijazah']['tmp_name'];
    $getExt = strtolower(pathinfo($fileName, PATHINFO_EXTENSION));
    $pathFile = $upload_dir . $fileName;

<?php

    // ......

    if ($getExt == "pdf" && $fileType == "application/pdf"){
        if (move_uploaded_file($_FILES['userfile']['tmp_name'], $pathFile)) 
$pathFile))
        {
            $statusFile = "";
        }
        else
        {
            $statusFile = "forbidden";
        }
    }
    //-------------------------------> END

    
}

    // ......


    // Diubah menjadi :

    
if ($statusFile ($getExt == ""){
        $query = $mysqli->query("[REDACTED]");
        
"pdf" && $fileType == "application/pdf"){
        
if ($query) (move_uploaded_file($_FILES['ijazah']['tmp_name'], $pathFile)) 
        
{
            echo 'success';
        } else {
            echo 'fail';
$statusFile = "";
        }
    } else {
        echo 'forbidden';
    }
}
$statusFile = "forbidden";
    }

Reply to "Re: proc_reg.php - SOLVED"

Here you can reply to the paste above

captcha