-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprofile.php
More file actions
58 lines (55 loc) · 1.29 KB
/
profile.php
File metadata and controls
58 lines (55 loc) · 1.29 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
<!DOCTYPE html>
<html>
<head>
<title>Profile</title>
<link rel="stylesheet" href="style.css">
<style>
.box {
width: 28%;
border: 4px solid #fd8585e3;
height: auto;
padding: 40px;
margin-left: auto;
margin-right: auto;
}
</style>
</head>
<body>
<?php
$con=mysqli_connect("us-cdbr-iron-east-04.cleardb.net","b966a2a16a969f","01d02abd","heroku_0b7502a16e114a3");
session_start();
// Check connection
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error(); }
elseif(isset($_SESSION["uid"]))
{
$uid = $_SESSION["uid"];
$sql="SELECT * FROM users WHERE userID = '$uid' LIMIT 1";
$res = mysqli_query($con,$sql);
if(!$res)
{
die('Error: ' . mysqli_error($con));
}
else
{
echo '<button class="btn" onclick="history.go(-1)">Back</button>';
echo '<div class="pro"> Profile </div>';
echo '<br><div class="box">';
while($row = mysqli_fetch_array($res))
{
echo '<div class="txt">';
echo 'UserID: '.$row['userID'].'<br>';
echo 'Firstname: '.$row['fName'].'<br>';
echo 'Lastname: '.$row['lName'].'<br>';
echo 'Date of birth: '.$row['DOB'].'<br>';
echo 'Email: '.$row['email'];
echo '</div>';
}
echo "</div>";
}
}
mysqli_close($con);
?>
</body>
</html>