-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmyprofile.php
executable file
·187 lines (184 loc) · 6.62 KB
/
myprofile.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
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
<?php
include 'includes.php';
require 'block.class.php';
include 'like.class.php';
require_once 'recommendation.class.php';
session_start();
?>
<script src = "image.js"></script>
<?php
$users = new Users();
$block = new Block();
$likes = new Like();
$rec = new Recommend();
if ($_SESSION['status'] != true)
header ("Location: index.php");
if (!isset($_GET['user']))
$user = $_SESSION['uid'];
else
$user = $_GET['user'];
if ($user != $_SESSION['uid'])
$compatible = $users->checkCompatibility($_SESSION['uid'], $user);
else
{
$myProfile = true;
$compatible = -1;
}
if ($block->checkUser($_SESSION['uid'], $user))
header ("Location: index.php");
if (!$compatible)
header ("Location: index.php");
$userEmail = $users->getUserById($user)[2];
$match = !$myProfile ? $rec->match($user, $_SESSION['uid']) : FALSE;
include 'header.php';
?>
<script>
var myuser = "<?php echo $_SESSION['uid']; ?>";
var destuser = "<?php echo $_GET['user']; ?>";
</script>
<script src = "like.js"></script>
<script src = "block.js"></script>
<?php
if ($compatible && !$match && !$myProfile)
echo "<script src = 'watch.js' type = 'text/javascript'></script>";
?>
<script src = "stalk.js"></script>
<div class="container">
<?php echo "<h1>" . $users->getUserById($user)[0] . " " . $users->getUserById($user)[1] . "</h1>"; ?>
<hr>
<div class="row">
<!-- left column -->
<form action = "update.php" method = "POST" role = "form" class = "form-horizontal" id = "profile" enctype = "multipart/form-data">
<div class="col-md-3">
<div class="text-center">
<img src="<?php echo $users->getPhoto($user, 'profile'); ?>" class="avatar img-circle img-responsive" alt="avatar" id = "image_profile">
</div>
</div>
<!-- edit form column -->
<div class="col-md-9 personal-info">
<?php
if ($myProfile)
echo "<a href = 'profile.php'><button type = 'button' class = 'btn btn-default pull-right'>Edit my profile</button></a>";
else
echo "<a href = '#'><button id = 'like' type = 'button' class = 'btn btn-default pull-right'>Damn, son</button></a>";
if ($match)
echo "<a href = '#'><button id = 'unlike' type = 'button' class = 'btn btn-default pull-right'>HATE YOU!</button></a>";
if ($match)
echo "<button id = 'match' type = 'button' class = 'btn btn-default pull-right'>Chat</button>";
?>
<script>
function post(path, params, method) {
method = method || "post";
var form = document.createElement("form");
form.setAttribute("method", method);
form.setAttribute("action", path);
for(var key in params) {
if(params.hasOwnProperty(key)) {
var hiddenField = document.createElement("input");
hiddenField.setAttribute("type", "hidden");
hiddenField.setAttribute("name", key);
hiddenField.setAttribute("value", params[key]);
form.appendChild(hiddenField);
}
}
document.body.appendChild(form);
form.submit();
}
$("#match").click(function() {
post("chat.php", {
from: myuser,
to: destuser
});
});
</script>
<h3>Personal info</h3>
<div class="form-group">
<label class="col-lg-3 control-label">Bio :</label>
<div class="col-lg-8">
<textarea name = "bio" class="form-control" type="paragraph" readonly><?php echo $users->getBio($userEmail); ?></textarea>
</div>
</div>
<div class="form-group">
<label class="col-lg-3 control-label">Gender: </label>
<div class="col-lg-8">
<div class="ui-select">
<div id = "gender" class = "form-control"></div>
<script>
var option = "<?php echo $users->getGender($userEmail); ?>";
if (option == "f")
$("#gender").text('Female');
else if (option == 'm')
$("#gender").text('Male');
else if (option == 'o')
$("#gender").text('Other');
else if (option == 'a')
$("#gender").text('Did you just assume my gender?');
else if (option == 'p')
$("#gender").text('Person');
</script>
</select>
</div>
</div>
</div>
<div class="form-group">
<label class="col-lg-3 control-label">Sexual orientation: </label>
<div class="col-lg-8">
<div class="ui-select">
<div id = "orientation" class = "form-control"></div>
<script>
var option = "<?php echo $users->getOrientation($userEmail); ?>";
if (option == 'h')
$("#orientation").text('Heterosexual');
else if (option == 'x')
$("#orientation").text('Homosexual');
else if (option == 'b')
$("$orientation").text('Bisexual');
else if (option == 'e')
$("#orientation").text('I just want to fuck, give me anything!');
</script>
</select>
</div>
</div>
</div>
<div class="form-group">
<label class="col-md-3 control-label">Interests:</label>
<div class="col-md-8">
<div class = "form-control bootstrap-tagsinput" data-role = "tagsinput"><?php echo $users->getTags($userEmail); ?></div>
<!--</div>-->
<div class="form-group">
<label class="col-md-3 control-label">People who think this is hot:</label>
<div class="col-md-8">
<div id = "likenr" class = "form-control bootstrap-tagsinput" data-role = "tagsinput"><?php echo $likes->getLikes($user); ?></div></div>
</div>
<div class="col-md-3">
<div class="text-center">
<img src="<?php echo $users->getPhoto($user, '1'); ?>" class="avatar img-circle img-responsive" alt="avatar" id = "image_1">
</div>
</div>
<div class="col-md-3">
<div class="text-center">
<img src="<?php echo $users->getPhoto($user, '2'); ?>" class="avatar img-circle img-responsive" alt="avatar" id = "image_2">
</div>
</div>
<div class="col-md-3">
<div class="text-center">
<img src="<?php echo $users->getPhoto($user, '3'); ?>" class="avatar img-circle img-responsive" alt="avatar" id = "image_3">
</div>
</div>
<div class="col-md-3">
<div class="text-center">
<img src="<?php echo $users->getPhoto($user, '4'); ?>" class="avatar img-circle img-responsive" alt="avatar" id = "image_4">
</div>
</div>
<div class="form-group">
<label class="col-md-3 control-label"></label>
</div>
<?php
if (!$myProfile)
echo "<a href = '#'><button id = 'block' type = 'button' class = 'btn btn-default pull-right'>Block the user</button></a>";
?>
</form>
</div>
</div>
</div>
<hr>