-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdaftarkanakun.php
81 lines (41 loc) · 1.04 KB
/
daftarkanakun.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
<?PHP
if(!isset($_POST["nama_lengkap"]))
{
header("location:buatakun.php");
}
else
{
//BACA VARIABEL AWAL
$nama_lengkap=$_POST["nama_lengkap"];
$email=$_POST["email"];
$password=$_POST["password"];
//ANTI CROSS SITE SCRIPTING
$nama_lengkap=htmlspecialchars($nama_lengkap);
$email=htmlentities($email);
$password=htmlspecialchars($password);
//VARIABEL UNTUK MYSQL
$db_host="localhost";
$db_user="root";
$db_password="";
$db_namadb="latcv1_telmed";
$db_tabel="data_user";
//LINK
$link="mysqli_connect($db_host,$db_user,$db_password,$db_namadb)";
if(!link)
{
die("Gagal tersambung ke database!");
}
else
{
$tambah_akun=mysqli_query($link,"INSERT INTO ".$db_tabel." (nama_lengkap, email, password) VALUES ('".$nama_lengkap."','".$email."','".$password."')");
if($tambah_akun)
{
$pesan="Akun ".$nama_lengkap." berhasil didaftarkan!";
}
else
{
$pesan="Akun ".$nama_lengkap." gagal didaftarkan!";
}
}
}
?>