-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathproses_registrasi.php
61 lines (47 loc) · 1.6 KB
/
proses_registrasi.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
<?php
session_start();
if( isset($_POST['tombol'])) {
if(($_SESSION['security_code'] == $_POST['security_code']) && (!empty($_SESSION['security_code'])) ) {
// Insert you code for processing the form here
include "koneksi_db.php";
function clean($str) {
$str = @trim($str);
if(get_magic_quotes_gpc()) {
$str = stripslashes($str);
}
return mysql_real_escape_string($str);
}
//Sanitize the POST values
$username = clean($_POST['username']);
$password = $_POST['password'];
$nama_user = clean($_POST['nama_user']);
$usia = clean($_POST['usia']);
$jenis_kelamin = clean($_POST['jenis_kelamin']);
$alamat = clean($_POST['alamat']);
$pertanyaan = clean($_POST['pertanyaan']);
$jawaban = clean($_POST['jawaban']);
//If there are input validations, redirect back to the registration form
if($errflag) {
$_SESSION['ERRMSG_ARR'] = $errmsg_arr;
session_write_close();
header("location: user_index.php");
exit();
}
//Create INSERT query
$qry = "INSERT INTO data_user
VALUES('$username', '".md5($_POST['password'])."', '$nama_user', '$usia', '$jenis_kelamin', '$alamat','$pertanyaan', '".md5($_POST['jawaban'])."')";
$result = mysql_query($qry);
//Check whether the query was successful or not
if($result) {
echo "<meta http-equiv=\"refresh\" content=\"0; url=index.php?page=berhasil\">";
exit();
}else {
echo "<meta http-equiv=\"refresh\" content=\"0; url=index.php?page=gagal2\">";
}
} else {
// Insert your code for showing an error message here
echo "<meta http-equiv=\"refresh\" content=\"0; url=index.php?page=gagal\">";
}
} else {
}
?>