-
Notifications
You must be signed in to change notification settings - Fork 0
/
profile.php
117 lines (104 loc) · 8.32 KB
/
profile.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
<?php include_once '_header.php'; ?>
<section class="text-gray-600 body-font">
<div class="container px-5 py-24 mx-auto flex flex-col">
<?php
// Include the db file
require_once 'includes/dbh.inc.php';
if ( isset( $_SESSION['userid'] ) || ( $_SESSION['useremail'] ) === true ) {
$sql = "SELECT * FROM users WHERE username = ? OR email = ?;";
$stmt = mysqli_stmt_init( $conn );
if ( !mysqli_stmt_prepare( $stmt, $sql ) ) {
echo "SQL Statment Failed!";
} else {
mysqli_stmt_bind_param( $stmt, "ss", $_SESSION['userid'], $_SESSION['useremail'] );
mysqli_stmt_execute( $stmt );
$result = mysqli_stmt_get_result( $stmt );
if ($row = mysqli_fetch_assoc( $result )) {
echo '<div class="sm:text-3xl text-2xl font-medium text-center title-font text-gray-600 mb-4">
<div class="w-20 h-20 rounded-full inline-flex items-center justify-center bg-gray-200 text-gray-400">
<svg fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"
stroke-width="2" class="w-10 h-10" viewBox="0 0 24 24">
<path d="M20 21v-2a4 4 0 00-4-4H8a4 4 0 00-4 4v2"></path>
<circle cx="12" cy="7" r="4"></circle>
</svg>
</div>
<div class="flex flex-col items-center text-center justify-center">
<h2 class="font-medium title-font mt-4 text-gray-900 text-lg">'.$row['fullname'].'
</h2>
<div class="w-12 h-1 bg-indigo-500 rounded mt-2 mb-4"></div>
<p class="text-base">Profile Information.</p>
</div>
</div>
<div class="flex flex-wrap lg:w-4/5 sm:mx-auto sm:mb-2 -mx-2">
<div class="p-2 sm:w-1/2 w-full">
<p><b>E-mail</b></p>
<div class="bg-gray-100 rounded flex p-4 h-full items-center">
<svg fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"
stroke-width="3" class="text-indigo-500 w-6 h-6 flex-shrink-0 mr-4" viewBox="0 0 24 24">
<path d="M22 11.08V12a10 10 0 11-5.93-9.14"></path>
<path d="M22 4L12 14.01l-3-3"></path>
</svg>
<span class="title-font font-medium">'.$row['email'].'</span>
</div>
</div>
<div class="p-2 sm:w-1/2 w-full">
<p><b>Username</b></p>
<div class="bg-gray-100 rounded flex p-4 h-full items-center">
<svg fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"
stroke-width="3" class="text-indigo-500 w-6 h-6 flex-shrink-0 mr-4" viewBox="0 0 24 24">
<path d="M22 11.08V12a10 10 0 11-5.93-9.14"></path>
<path d="M22 4L12 14.01l-3-3"></path>
</svg>
<span class="title-font font-medium">'.$row['username'].'</span>
<span class="title-font font-medium"></span>
</div>
</div>
<div class="p-2 sm:w-1/2 w-full mt-3">
<p><b>City</b></p>
<div class="bg-gray-100 rounded flex p-4 h-full items-center">
<svg fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"
stroke-width="3" class="text-indigo-500 w-6 h-6 flex-shrink-0 mr-4" viewBox="0 0 24 24">
<path d="M22 11.08V12a10 10 0 11-5.93-9.14"></path>
<path d="M22 4L12 14.01l-3-3"></path>
</svg>
<span class="title-font font-medium">'.$row['city'].'</span>
</div>
</div>
<div class="p-2 sm:w-1/2 w-full mt-3">
<p><b>Country</b></p>
<div class="bg-gray-100 rounded flex p-4 h-full items-center">
<svg fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"
stroke-width="3" class="text-indigo-500 w-6 h-6 flex-shrink-0 mr-4" viewBox="0 0 24 24">
<path d="M22 11.08V12a10 10 0 11-5.93-9.14"></path>
<path d="M22 4L12 14.01l-3-3"></path>
</svg>
<span class="title-font font-medium">'.$row['country'].'</span>
</div>
</div>
<div class="p-2 sm:w-1/2 w-full mt-4">
<p><b>Zip Code</b></p>
<div class="bg-gray-100 rounded flex p-4 h-full items-center">
<svg fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"
stroke-width="3" class="text-indigo-500 w-6 h-6 flex-shrink-0 mr-4" viewBox="0 0 24 24">
<path d="M22 11.08V12a10 10 0 11-5.93-9.14"></path>
<path d="M22 4L12 14.01l-3-3"></path>
</svg>
<span class="title-font font-medium">'.$row['zipcode'].'</span>
</div>
</div>
</div>';
} else {
$result = false;
return $result;
}
mysqli_stmt_close($stmt);
}
} else {
// Else redirect to home page
header('location: index.php');
exit;
}
?>
</div>
</section>
<?php include_once '_footer.php'; ?>