-
Notifications
You must be signed in to change notification settings - Fork 0
/
userAccount.php
145 lines (122 loc) · 3.8 KB
/
userAccount.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
<!DOCTYPE html>
<html>
<head>
<title>
RemindMe! | HomePage
</title>
<link rel="stylesheet" href="form.css">
</head>
<body>
<header>
<div class="container">
<div id="heading">
<h1>RemindMe!</h1>
</div>
</div>
</header>
<nav>
<ul>
<li class="current"><a href="home.html">Home</a></li>
<li><a href="calender.html">Calendar</a></li>
<li><a href="todo.html">To-Do</a></li>
<li><a href="contact.html">Contact Us</a></li>
<li><a href="faq.html">FAQ</a></li>
</ul>
</nav>
<?php
session_start();
if (!isset($_SESSION['user'])) {
echo "<p>You Have Not Logged In</p>
<br>
<a href='login.php'><button>Login</button></a>";
} else {
include('homepageDB/config.php');
/*$dbservername = "localhost";
$dbusername = "root";
$dbpassword = "";
$dbname = "RemindMe";*/
$con = new mysqli($dbservername, $dbusername, $dbpassword, $dbname);
$u = $_SESSION['user'];
/*
$f = "SELECT first_name FROM users WHERE email='$u'";
$l = "SELECT last_name FROM users WHERE email='$u'";
$t = "SELECT telNo FROM users WHERE email='$u'";
$e1 = "SELECT email FROM users WHERE email='$u'";
$p = "SELECT password FROM users WHERE email='$u'";
$fresult = $con->query($f);
$lresult = $con->query($l);
$tesult = $con->query($t);
$e1esult = $con->query($e1);
$presult = $con->query($p);*/
$sql = "SELECT first_name,last_name,telNo,email,password FROM users WHERE email='$u'";
$result = $con->query($sql);
while ($row = $result->fetch_assoc()) {
echo ("<form class='createAcc' id='createAccount' method='post' action='homepageDB/update.php'>
<div>
<h1>User Account</h1>
</div>
<div class='formrow'>
<label>First Name:</label>
<br>
<input type='text' name='firstname' id='f' required value=" . $row['first_name'] . ">
<br>
</div>
<div class='formrow'>
<label>Last Name:</label>
<br>
<input type='text' name='lastname' id='l' required value=" . $row['last_name'] . ">
<br>
</div>
<div class='formrow'>
<label>Email:</label>
<br>
<input type='email' name='email' id='em' required disabled value=" . $row['email'] . ">
<br>
</div>
<div class='formrow'>
<label>Tel No:</label>
<br>
<input type='tel' name='telNo' id='tel' required value=" . $row['telNo'] . ">
<br>
</div>
<div class='formrow'>
<label>Password:</label>
<br>
<input type='text' name='password' id='pass1' required value=" . $row['password'] . ">
<br>
</div>
<div>
<button type='submit'>Update</button>
</div>
<br>
<div>
<button type='submit'>Delete</button>
</div>
</form>");
}
$con->close();
}
?>
<?php
if (isset($_GET['updated'])) {
echo ("<div class='alert alert-success mt-3' role='alert' id='success'>
Details Updated Sucessfully !!
</div>");
}
?>
<?php
if (isset($_GET['failed'])) {
echo ("<div class='alert alert-success mt-3' role='alert' id='success'>
Update Failed !
</div>");
}
?>
<footer>
<p>RemindMe! , Copyright © 2023</p>
<br>
<script>
document.write(Date());
</script>
</footer>
</body>
</html>