-
Notifications
You must be signed in to change notification settings - Fork 3
/
doInputMhs.php
90 lines (71 loc) · 1.83 KB
/
doInputMhs.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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
<?php
include 'config/connection.php';
include 'config/funcGoogleApi.php';
$nim = $_POST['nim'];
$nama = $_POST['nama'];
$alamat = $_POST['alamat'];
$sub = substr($nim,0,4);
//distance action
$addressFrom = htmlspecialchars($_POST['alamat']);
$addressTo = htmlspecialchars("unsada");
$jarak = round($distance = getDistance($addressFrom, $addressTo, "K"),1);
$semester = $_POST['semester'];
$ipk = $_POST['ipk'];
$penghasilan = $_POST['penghasilan'];
$jenis = $_POST['jenis_kel'];
if($jk = $_POST['jenis_kel']=='L')
echo "1";
elseif ($jk = $_POST['jenis_kel']=='P')
echo "0";
$beasiswa = $_POST['beasiswa'];
$tot = ($jk * $penghasilan * $semester * $ipk) / 4;
if($sub == 2010){
if($tot > 20){
echo $res = "0";
}else{
echo $res = "1";
}
}
elseif($sub == 2011){
if($tot > 18){
echo $res = "0";
}else{
echo $res = "1";
}
}
elseif($sub == 2012){
if($tot > 16){
echo $res = "0";
}else{
echo $res = "1";
}
}
elseif($sub == 2013){
if($tot > 8.5){
echo $res = "0";
}else{
echo $res = "1";
}
}
elseif($sub == 2014){
if($tot > 4.5){
echo $res = "0";
}else{
echo $res = "1";
}
}
elseif($sub == 2015){
if($tot > 2){
echo $res = "0";
}else{
echo $res = "1";
}
}
$insertMaster = "INSERT INTO master(nim,nama,alamat_rumah,jenis_kelamin,id_penghasilan)
VALUES('$nim','$nama','$alamat','$jenis','$penghasilan')";
$queryMaster = mysqli_query($conn,$insertMaster) or die (mysqli_error($conn));
$insertDatasets = "INSERT INTO datasets(nim,nama,ipk,semester,id_penghasilan,jarak,jenis_kelamin,beasiswa,d_o)
VALUES('$nim', '$nama', '$ipk', '$semester', '$penghasilan', '$jarak', '$jenis', '$beasiswa', '$res')";
$queryDatasets = mysqli_query($conn,$insertDatasets) or die (mysqli_error($conn));
header('location:index.php?page=formInput&&act');
?>