-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathrequest_detail.php
326 lines (287 loc) · 12.2 KB
/
request_detail.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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
<?php
include('connect/pg_connect.php');
$page_title = 'Permohonan Sertifikat YOLO CA';
include('includes/header.html');
// Check the form before storing the data into database
if (isset($_POST['submitted'])) {
// Initialize an error array
$errors = array();
// Cek domain organisasi
if (empty($_POST['institution_cn'])) {
$errors[] = 'Anda lupa memasukkan domain organisasi.';
} else {
$cn = trim($_POST['institution_cn']);
}
// Cek nama organisasi
if (empty($_POST['institution_name'])) {
$errors[] = 'Anda lupa memasukkan nama organisasi.';
} else {
$institution_name = trim($_POST['institution_name']);
}
// Cek unit organisasi
if (empty($_POST['institution_unit'])) {
$error[] = 'Anda lupa memasukkan unit organisasi.';
} else {
$institution_unit = trim($_POST['institution_unit']);
}
// Cek alamat organisasi
if (empty($_POST['institution_address'])) {
$errors[] = 'Anda lupa memasukkan alamat organisasi.';
} else {
$institution_addr = trim($_POST['institution_address']);
}
// Cek kota organisasi
if (empty($_POST['institution_city'])) {
$errors[] = 'Anda lupa memasukkan kota/lokasi organisasi.';
} else {
$institution_city = trim($_POST['institution_city']);
}
// Cek region organisasi
if (empty($_POST['institution_region'])) {
$errors[] = 'Anda lupa memasukkan provinsi/region organisasi.';
} else {
$institution_region = trim($_POST['institution_region']);
}
// Cek kode pos organisasi
if (empty($_POST['institution_zip'])) {
$errors[] = 'Anda lupa memasukkan kode pos organisasi.';
} else {
$institution_zip = trim($_POST['institution_zip']);
}
// Cek negara orgnisasi
if ($_POST['institution_country'] == 'null') {
$errors[] = 'Anda belum memasukkan pilihan negara.';
} else {
$institution_country = trim($_POST['institution_country']);
}
// Cek alamat e-mail pemohon
if (empty($_POST['email'])) {
$errors[] = 'Anda lupa memasukkan alamat e-mail.';
} else {
$email = trim($_POST['email']);
}
// Cek nama depan
if (empty($_POST['first_name'])) {
$errors[] = 'Anda lupa memasukkan nama depan.';
} else {
$firstname = trim($_POST['first_name']);
}
// Cek nama depan
if (empty($_POST['last_name'])) {
$errors[] = 'Anda lupa memasukkan nama belakang.';
} else {
$lastname = trim($_POST['last_name']);
}
// Cek jabatan organisasi
if (empty($_POST['job_title'])) {
$errors[] = 'Anda lupa memasukkan jabatan.';
} else {
$jobtitle = trim($_POST['job_title']);
}
// Cek nomor telepon
if (empty($_POST['telp_number'])) {
$errors[] = 'Anda lupa memasukkan nomor telepon.';
} else {
$telpnumber = trim($_POST['telp_number']);
}
// ambil fax
$faxnumber = $_POST['fax_number'];
// Cek nama akun
if (empty($_POST['akun'])) {
$errors[] = 'Anda lupa memasukkan nama akun.';
} else {
$accountname = trim($_POST['akun']);
}
// Cek kecocokan kata sandi
if (!empty($_POST['password1'])) {
if ($_POST['password1'] != $_POST['password2']) {
$errors[] = 'Kata sandi Anda tidak sama.';
} else {
$password = trim($_POST['password1']);
}
} else {
$errors[] = "Anda lupa memasukkan kata sandi.";
}
// No error occured
if (empty($errors)) {
// Insert data into database
// Open connection
require_once('connect/pg_connect.php');
// Make the query
$q = "SELECT save_data_pemohon('$institution_country', '$cn', '$institution_name', '$institution_unit', '$institution_addr', '$institution_city', '$institution_region', '$institution_zip', '$accountname', '$password', '$firstname', '$lastname', '$email','$jobtitle', '$telpnumber', '$faxnumber')";
$r = pg_query($dbc, $q);
if ($r) { // If it ran OK.
echo "<div class=\"container\">
<div class=\"row\" style=\"padding-top:100px;\">
<div class=\"col-md-12\">
<div class=\"panel panel-default\">
<div class=\"panel-body\">";
echo '<h1 style="text-align: center;">Terima kasih</h1><p>Pengajuan permohonan sertifikat berhasil.</p><p><br /></p>';
echo "</div></div></div></div></div>";
} else { // If it did not run OK.
echo "<div class=\"container\">
<div class=\"row\" style=\"padding-top:100px;\">
<div class=\"col-md-12\">
<div class=\"panel panel-default\">
<div class=\"panel-body\">";
echo '<h1>Sistem error</h1><p style="font-weight: bold; color: #C00; background: #f0f0c0; text-align: center;">Pengajuan permohonan sertifikat tidak berhasil. Maaf atas ketidaknyamanannya.</p>';
echo "</div></div></div></div></div>";
// echo '<p>' . pg_last_error($dbc) . '<br /><br />Query: ' . $q . '</p>';
}
// Close connection
pg_close($dbc);
include('includes/footer.html');
exit();
} else {
// Show the errors
echo "<div class=\"container\">
<div class=\"row\" style=\"padding-top:100px;\">
<div class=\"col-md-12\">
<div class=\"panel panel-default\">
<div class=\"panel-body\">";
echo '<h1>Error!</h1><p style="font-weight: bold; color: #C00; background: #f0f0c0; text-align: center;">Ada kesalahan yang terjadi:<br />';
foreach ($errors as $msg) {
echo " - $msg<br />\n";
}
echo '</p><p style="text-align: center;">Mohon ulangi pengisian.</p><p><br /></p>';
echo "</div></div></div></div></div>";
}
}
?>
<!--Header-->
<div class="container">
<div class="row" style="padding-top:100px;">
<div class="col-md-12 ">
<div class="panel panel-default">
<div class="panel-body">
<form action="request_detail.php" method="POST">
<h3>Detail Organisasi</h3>
<div class="form-group">
<label class="control-label">Domain organisasi: </label>
<div class="controls">
<input class="form-control" type="text" name="institution_cn" value="<?php if (isset($_POST['institution_cn'])) echo $_POST['institution_cn']; ?>" />
</div>
</div>
<div class="form-group">
<label class="control-label">Nama organisasi: </label>
<div class="controls">
<input class="form-control" type="text" name="institution_name" value="<?php if (isset($_POST['institution_name'])) echo $_POST['institution_name']; ?>" />
</div>
</div>
<div class="form-group">
<label class="control-label">Bidang organisasi: </label>
<div class="controls">
<input class="form-control" type="text" name="institution_unit" value="<?php if (isset($_POST['institution_unit'])) echo $_POST['institution_unit']; ?>" />
</div>
</div>
<div class="form-group">
<label class="control-label">Alamat organisasi: </label>
<div class="controls">
<input class="form-control" type="text" name="institution_address" value="<?php if (isset($_POST['institution_address'])) echo $_POST['institution_address']; ?>" />
</div>
</div>
<div class="form-group">
<label class="control-label">Kota/Lokasi: </label>
<div class="controls">
<input class="form-control" type="text" name="institution_city" value="<?php if (isset($_POST['institution_city'])) echo $_POST['institution_city']; ?>" />
</div>
</div>
<div class="form-group">
<label class="control-label">Provinsi/Region: </label>
<div class="controls">
<input class="form-control" type="text" name="institution_region" value="<?php if (isset($_POST['institution_region'])) echo $_POST['institution_region']; ?>" />
</div>
</div>
<div class="form-group">
<label class="control-label">Kode Pos: </label>
<div class="controls">
<input class="form-control" type="text" name="institution_zip" value="<?php if (isset($_POST['institution_zip'])) echo $_POST['institution_zip']; ?>" />
</div>
</div>
<div class="form-group">
<label class="control-label">Negara: </label>
<div class="controls">
<?php
$q = "SELECT * FROM negara";
$result = pg_query($dbc, $q);
echo '<select name="institution_country">';
echo '<option value="null">Pilih negara</option>';
while ($row = pg_fetch_row($result)) {
echo '<option value="' . htmlspecialchars($row[0]) . '">' . htmlspecialchars($row[1]) . '</option>';
}
echo "</select>";
pg_close($dbc);
?>
</div>
</div>
<br />
<h3>Detail Pemohon (wakil organisasi)</h3>
<div class="form-group">
<label class="control-label">Alamat e-mail: </label>
<div class="controls">
<input class="form-control" type="text" name="email" value="<?php if (isset($_POST['email'])) echo $_POST['email']; ?>" />
</div>
</div>
<div class="form-group">
<label class="control-label">Nama Depan: </label>
<div class="controls">
<input class="form-control" type="text" name="first_name" value="<?php if (isset($_POST['first_name'])) echo $_POST['first_name']; ?>" />
</div>
</div>
<div class="form-group">
<label class="control-label">Nama Belakang: </label>
<div class="controls">
<input class="form-control" type="text" name="last_name" value="<?php if (isset($_POST['last_name'])) echo $_POST['last_name']; ?>" />
</div>
</div>
<div class="form-group">
<label class="control-label">Jabatan di organisasi: </label>
<div class="controls">
<input class="form-control" type="text" name="job_title" value="<?php if (isset($_POST['job_title'])) echo $_POST['job_title']; ?>" />
</div>
</div>
<div class="form-group">
<label class="control-label">Nomor telepon: </label>
<div class="controls">
<input class="form-control" type="text" name="telp_number" value="<?php if (isset($_POST['telp_number'])) echo $_POST['telp_number']; ?>" />
</div>
</div>
<div class="form-group">
<label class="control-label">Fax:</label>
<div class="controls">
<input class="form-control" type="text" name="fax_number" value="<?php if (isset($_POST['fax_number'])) echo $_POST['fax_number']; ?>" />
</div>
</div>
<h3>Detil Akun</h3>
<div class="form-group">
<label class="control-label">Nama akun: </label>
<div class="controls">
<input class="form-control" type="text" name="akun" value="<?php if (isset($_POST['akun'])) echo $_POST['akun']; ?>" />
</div>
<div class="form-group">
<label class="control-label">Kata sandi: </label>
<div class="controls">
<input class="form-control" type="password" name="password1" maxlength="20" />
</div>
<div class="form-group">
<label class="control-label">Ulangi kata sandi: </label>
<div class="controls">
<input class="form-control" type="password" name="password2" maxlength="20" />
</div>
<br />
<div class="pull-left">
<br /><input class="btn btn-success" type="submit" name="submit" value="Daftar"/>
<input type="hidden" name="submitted" value="TRUE" />
</div>
</div>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
<?php
include('includes/footer.html');
?>