-
Notifications
You must be signed in to change notification settings - Fork 1
/
daftar_proces_siswa.php
60 lines (55 loc) · 2.69 KB
/
daftar_proces_siswa.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
<?php
include 'config/functions.php';
include 'admin_page/csrf-protect.php';
$nis = addslashes(htmlspecialchars(trim($_POST['nis'])));
$username = addslashes(htmlspecialchars(trim($_POST['username'])));
$password = addslashes(htmlspecialchars(trim($_POST['password'])));
$namalengkap = addslashes(htmlspecialchars(trim($_POST['nama_lengkap'])));
$namaorangtua = addslashes(htmlspecialchars(trim($_POST['nama_orangtua'])));
$notelp = addslashes(htmlspecialchars(trim($_POST['no_telp'])));
$jeniskelamin = addslashes(htmlspecialchars(trim($_POST['jenis_kelamin'])));
$tanggallahir = addslashes(htmlspecialchars(trim($_POST['tanggal-lahir'])));
$tempatlahir = addslashes(htmlspecialchars(trim($_POST['tempat_lahir'])));
$alamat = addslashes(htmlspecialchars(trim($_POST['alamat'])));
$kota = addslashes(htmlspecialchars(trim($_POST['kota'])));
$provinsi = addslashes(htmlspecialchars(trim($_POST['provinsi'])));
$foto = addslashes(htmlspecialchars(trim($_FILES['file']['name'])));
$csrf = addslashes(htmlspecialchars(trim($_POST['csrf'])));
$asalsekolah = addslashes(htmlspecialchars(trim($_POST['asal_sekolah'])));
// location Upload
$localtion = "assets/img/$foto";
// File Extension
$file_ext = pathinfo($localtion, PATHINFO_EXTENSION);
$file_ext = strtolower($file_ext);
// Valid Image Extension
$image_ext = array('jpg', 'jpeg', 'png');
if (isset($_POST['tambahsiswa'])) {
if (check_csrf($csrf)) {
if (in_array($file_ext, $image_ext)) {
if (move_uploaded_file($_FILES['file']['tmp_name'], $localtion)) {
$query = "INSERT INTO tbsiswa VALUES (null,
'$nis',
'$username',
'$password',
'$namalengkap',
'$tempatlahir',
'$tanggallahir',
'$notelp',
'$jeniskelamin',
'$asalsekolah',
'$namaorangtua',
'$alamat',
'$kota',
'$provinsi',
'$foto',
'belum diverifikasi'
)";
if (mysqli_query($con, $query)) {
echo 'success';
}
}
} else {
echo 'file not jpg';
}
}
}