-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdaftarkan_akun.php
125 lines (63 loc) · 1.44 KB
/
daftarkan_akun.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
<?PHP
session_start();
if (isset($_SESSION["logged_in"]) AND $_SESSION["logged_in"]==true)
{
header("location:home.php");
}
else
{
if(!isset($_POST["nama_lengkap"]))
{
header("location:buatakun.php");
}
else
{
//BACA VARIABEL AWAL
$nama_lengkap=$_POST["nama_lengkap"];
$email=$_POST["email"];
$password=$_POST["password"];
$db_tabel_user="data_user";
//ANTI CROSS SITE SCRIPTING
$nama_lengkap=htmlspecialchars($nama_lengkap);
$email=htmlentities($email);
$password=htmlspecialchars($password);
require "koneksi_ke_mysql.php";
/*if(!$link)
{
//die("Gagal tersambung ke database!");
echo "Koneksi gagal!";
}
else
{*/
$tambah_akun=
mysqli_query(
$link,
"INSERT INTO ".$db_tabel_user."
(nama_lengkap,email,password, foto_profil)
VALUES ('".$nama_lengkap."','".$email."','".$password."','profile_pic_default.png')");
if($tambah_akun)
{
header("location:logging_in.php?email=".$email."&password=".$password);
}
else
{
header("location:index.php?status=daftargagal");
}
//}
echo
//HTML
"
<!DOCTYPE html>
<html>
<head>
<title>Daftarkan Akun - Tel-Med</title>
</head>
<body>
<h1>Pendaftaran Akun Tel-Med</h1>
".$pesan."
</body>
</html>
";
}
}
?>