-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathprofile.php
141 lines (120 loc) · 5.43 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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
<?php
session_start(); //Use this for creating the session
// Include config file
require_once "database.php";
if($_SESSION['id'] == " ") {
//header("Location: users.php");
header("location: register.php");
}
$getSingleUser = "SELECT * FROM user WHERE user_id='". $_GET['id']. "'";
$getWinks = "SELECT * FROM wink WHERE user2_id = '". $_GET['id']. "'";
$getAllOtherUsers = "SELECT * FROM user WHERE user_id != '".$_GET['id']."'";
$result = $connection->query($getSingleUser);
while($row = $result->fetch_assoc()) { ?>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<meta name="description" content="">
<meta name="author" content="">
<link rel="icon" href="../../favicon.ico">
<link rel="canonical" href="https://getbootstrap.com/docs/3.4/examples/jumbotron/">
<title>Dating Sites</title>
<!-- Bootstrap core CSS -->
<link href="css/bootstrap.css" rel="stylesheet">
<link href="css/style.css" rel="stylesheet">
<!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
<link href="css/ie10-viewport-bug-workaround.css" rel="stylesheet">
<!-- Custom styles for this template -->
<link href="css/jumbotron.css" rel="stylesheet">
<!-- Just for debugging purposes. Don't actually copy these 2 lines! -->
<!--[if lt IE 9]><script src="../../assets/js/ie8-responsive-file-warning.js"></script><![endif]-->
<script src="js/ie-emulation-modes-warning.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
<nav class="navbar navbar-inverse">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="homepage.php"><img src="images/logo.png"></a>
</div>
<div id="navbar" class="navbar-collapse collapse">
<form class="form-inline mt-2 mt-md-0 navbar-form navbar-right" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]); ?>" method="get" >
<!-- <input class="form-control mr-sm-2" type="text" placeholder="Search" aria-label="Search" name="search">-->
<!-- <button class="btn btn-outline-success my-2 my-sm-0" type="submit">Search</button>-->
<a href="logout.php"><button type="button" id="formButton" class="btn btn-success">Sign Out</button></a>
<a href="profile.php?id=<?php echo $_SESSION['id']; ?>"><button type="button" id="formButton" class="btn btn-success">My Profile</button></a>
</form>
<!--<a href="logout.php" class="btn btn-outline-success my-2 my-sm-0">
Sign Out</a>
<a href="profile.php?id=<?php echo $_SESSION['id']; ?>" class="btn btn-outline-success my-2 my-sm-0">
My profile</a>-->
</div><!--/.navbar-collapse -->
</div>
</nav>
<div class="container">
<div class="col-md-4"></div>
<div class="col-md-4 view-user-bg">
<div class="card mb-4 shadow-sm">
<img src="images/<?php echo $row["picture"]; ?>">
<div class="card-body">
<h4><?php echo $row["first_name"] . ' ' . $row["last_name"]; ?>
<a href="editName.php?id=<?php echo $row["user_id"]; ?>">Edit Name</a></h4>
<h6><?php echo $row["gender"]; ?></h6>
<h6><?php echo $row["date_of_birth"]; ?></h6>
<h6><?php echo $row["email"]; ?></h6>
<h6><?php echo $row["city"] .', '.$row["state"];?> </h6>
<h6>Membership :
<?php if($row["regular"] === 'y')
{
echo "Regular";
}
else
{
echo "Premium";
}?></h6>
</div>
</div>
<div class="wink-box">
<?php
$winkCountResult = $connection->query($getWinks);
$winkers = array();
while ($row1 = $winkCountResult->fetch_assoc())
{
array_push($winkers,$row1['user_id']);
}
$winkerResult = $connection->query($getAllOtherUsers);
while($row2 = $winkerResult->fetch_assoc())
{
foreach ($winkers as $value)
{
if($row2['user_id'] == $value)
{
echo $row2['first_name']." winked at you<br>";
}
}
}?>
</div>
</div>
<?php
}?>
<div class="col-md-4"></div>
<?php
require_once('footer.php');
?>
</body>
</html>