forked from sreyas-cheviri/visionastraa-website
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdashboard.php
More file actions
231 lines (215 loc) · 7.16 KB
/
Copy pathdashboard.php
File metadata and controls
231 lines (215 loc) · 7.16 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
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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Dashboard</title>
<style>
body {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
background-color: #1c1c1c;
color: #e0e0e0;
margin: 0;
padding: 0;
}
.container {
max-width: 1000px;
margin: 50px auto;
padding: 20px;
background-color: #262626;
border-radius: 12px;
box-shadow: 0px 4px 15px rgba(0, 0, 0, 0.6);
}
h1 {
text-align: center;
font-size: 2.5rem;
color:rgb(255, 255, 255);
margin-bottom: 30px;
}
.user-details {
display: flex;
flex-wrap: wrap;
gap: 20px;
justify-content: space-between;
}
.user-card {
flex: 1 1 calc(45% - 20px);
background-color: #333;
padding: 15px;
border-radius: 10px;
box-shadow: 0px 2px 10px rgba(0, 0, 0, 0.5);
}
.user-card h2 {
font-size: 1.2rem;
color: #f4b400;
border-bottom: 2px solid #444;
margin-bottom: 10px;
padding-bottom: 5px;
}
.user-card p {
margin: 8px 0;
line-height: 1.5;
}
.user-card strong {
color: #f4b400;
}
.user-card a {
color: #add8e6;
text-decoration: none;
}
.user-card a:hover {
text-decoration: underline;
}
.links {
margin-top: 30px;
text-align: center;
}
.links a {
display: inline-block;
margin: 10px;
padding: 12px 25px;
background-color: #f4b400;
color: #1c1c1c;
text-decoration: none;
font-weight: bold;
border-radius: 8px;
transition: background-color 0.3s ease, transform 0.2s ease;
}
.links a:hover {
background-color: #e09400;
transform: translateY(-2px);
}
.popup {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba(0, 0, 0, 0.6);
display: flex;
justify-content: center;
align-items: center;
z-index: 9999;
}
.popup-content {
background: #2b2b2b;
padding: 20px;
border-radius: 10px;
text-align: center;
color: #ffffff;
}
.popup button {
background-color: #56a3ff;
padding: 12px 24px;
color: #ffffff;
border: none;
border-radius: 6px;
font-size: 16px;
cursor: pointer;
}
.popup button:hover {
background-color: #1c77cc;
}
@media (max-width: 768px) {
.user-card {
flex: 1 1 100%;
}
}
</style>
</head>
<body>
<?php
session_start();
if (!isset($_SESSION['user_id'])) {
header("Location: login.html");
exit();
}
$quiz_submitted = isset($_GET['quiz_submitted']) && $_GET['quiz_submitted'] == 1;
$host = 'localhost';
$db = 'u707137586_UserAccounts';
$user = 'u707137586_UserAccounts';
$pass = 'egtA*XgA+J>2';
$charset = 'utf8mb4';
$dsn = "mysql:host=$host;dbname=$db;charset=$charset";
$options = [
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,
PDO::ATTR_EMULATE_PREPARES => false,
];
try {
$pdo = new PDO($dsn, $user, $pass, $options);
} catch (PDOException $e) {
die("Database connection failed: " . $e->getMessage());
}
$user_id = $_SESSION['user_id'];
try {
$stmt = $pdo->prepare("SELECT * FROM users WHERE uid = ?");
$stmt->execute([$user_id]);
$user = $stmt->fetch();
if (!$user) {
session_destroy();
header("Location: login.html");
exit();
}
} catch (PDOException $e) {
die("Error fetching user data: " . $e->getMessage());
}
?>
<?php if ($quiz_submitted): ?>
<div class="popup">
<div class="popup-content">
<h2>Quiz has been submitted successfully ✅</h2>
<a href="dashboard.php" class="btn" style="color: #ffffff;">View Dashboard</a>
</div>
</div>
<?php endif; ?>
<header id="navbar-placeholder"></header>
<div class="container">
<h1>Welcome to Your VisionAstra Dashboard</h1>
<div class="user-details">
<div class="user-card">
<h2>Personal Info</h2>
<p><strong>Name:</strong> <?php echo htmlspecialchars($user['name']); ?></p>
<p><strong>Email:</strong> <?php echo htmlspecialchars($user['email']); ?></p>
<p><strong>Phone:</strong> <?php echo htmlspecialchars($user['phone']); ?></p>
</div>
<div class="user-card">
<h2>Professional Details</h2>
<p><strong>Role:</strong> <?php echo htmlspecialchars($user['role']); ?></p>
<p><strong>State:</strong> <?php echo htmlspecialchars($user['state']); ?></p>
</div>
<div class="user-card">
<h2>Education</h2>
<p><strong>College:</strong> <?php echo htmlspecialchars($user['college']); ?></p>
<p><strong>Degree:</strong> <?php echo htmlspecialchars($user['degree']); ?></p>
<p><strong>Specialization:</strong> <?php echo htmlspecialchars($user['specialization']); ?></p>
<p><strong>Graduation Year:</strong> <?php echo htmlspecialchars($user['graduation']); ?></p>
</div>
<div class="user-card">
<h2>About</h2>
<p><strong>Description:</strong> <?php echo htmlspecialchars($user['description']); ?></p>
<p><strong>LinkedIn:</strong> <a href="<?php echo htmlspecialchars($user['linkedin_profile_link']); ?>" target="_blank">View Profile</a></p>
</div>
</div>
<div class="links">
<a href="quiz.php">Start Quiz</a>
<a href="php/logout.php">Logout</a>
</div>
</div>
<script>
fetch('navbarcomp-VA/navbar.html')
.then(response => response.text())
.then(data => {
document.getElementById('navbar-placeholder').innerHTML = data;
const hamburger = document.getElementById("hamburger");
const navLinks = document.getElementById("nav-links");
if (hamburger && navLinks) {
hamburger.onclick = function () {
navLinks.classList.toggle("active");
};
}
})
.catch(error => console.error('Error loading navbar:', error));
</script>
</body>
</html>