-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathdeleteProfile.php
More file actions
93 lines (72 loc) · 2.63 KB
/
deleteProfile.php
File metadata and controls
93 lines (72 loc) · 2.63 KB
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
<?php
session_start();
include 'loginFunctions.php';
if(isset($_POST['guestBtn'])){
$_SESSION['loggedIn'] = "No";
header('Location: home.php');
}
?>
<!DOCTYPE html>
<html>
<head>
<title>Scoot</title>
<link rel="stylesheet" type="text/css" href="styles/style.css">
<link href="https://fonts.googleapis.com/css?family=Nunito" rel="stylesheet">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
</head>
<body>
<header>
<div class="top">
<img src="images/scoot.png" id="logo" onclick="window.location.href='home.php'" style="cursor:pointer">
</div>
</header>
<nav id="nav">
<a style='margin-right:200px'href='profile.php'> My Profile </a>
<a href='logout.php'> Logout </a>
</nav>
<div class="center">
<h3>Are you sure you want to delete your account?</h3>
<br>
<form method="POST" class="login">
<input type="radio" name="answer" value="yes"> Yes
<input type="radio" name="answer" value="no"> No<br>
<br><br>
<button type="button" id="submitBtn" value="submit">Submit</button>
</form>
</div>
<div class="error">
</div>
</body>
</html>
<script>
$("#submitBtn").click(onButtonClicked);
function onButtonClicked() {
if($('input[name=answer]:checked').val() == "yes"){
var jsonData = {
"answer" : "yes"
};
$.ajax({
// The URL for the request
url: "settingsFunctions.php",
// Whether this is a POST or GET request
type: "POST",
// The type of data we expect back
dataType: "json",
contentType: "application/json",
data: JSON.stringify(jsonData),
})
.done(function(data) {
if(data["data"] == "true"){
window.location.replace("index.php");
}
else{
$(".error").empty();
$(".error").append("<h2>Error</h2>");
}
})
.always(function(data, status) {
console.log(data);
});
}
}
</script>