-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathprofile.php
More file actions
165 lines (142 loc) · 4.38 KB
/
profile.php
File metadata and controls
165 lines (142 loc) · 4.38 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
<!--written by: Katherine -->
<html>
<head>
<link href="css/main.css" rel="stylesheet" type="text/css">
<title>GameFace</title>
</head>
<body>
<?php include_once('php_includes/header.php');
include_once('php_includes/nav.php');
include('php_includes/sessions.php');
include('php_includes/profileVal.php');
include('php_includes/addFriend.php');
include('php_includes/removeFriend.php');
include('php_includes/connection.php');
?>
<div id="wrapper3">
<div id="smallProfile">
<h3><?php echo "$firstname $lastname" ?></h3>
<br>
<img src="<?php echo $path ?>" style="width:17em;">
<?php echo $username ?><br>
<?php echo $major ?><br>
<?php echo $year ?><br>
<?php echo $email ?><br>
<?php
$usern = $_GET['user'];
$c2 = mysqli_connect($host, $user, $pw, $db);
$sql2 = "SELECT * FROM friendsList WHERE
friend1='".$self."' and friend2='".$usern."'";
$result2 = mysqli_query($c2, $sql2);
$count2 = mysqli_num_rows($result2);
if(($self != $usern) && ($count2 == 0)) {
echo "<form method=\"post\" action=\"";
echo "profile.php?user=$usern";
echo "\"><input type=\"submit\" name=\"addButton\" value=\"Add Friend\"></form>";
}
else if($self != $usern) {
echo "<form method=\"post\" action=\"";
echo "profile.php?user=$usern";
echo "\"><input type=\"submit\" name=\"removeButton\" value=\"Remove Friend\"></form>";
}
mysqli_free_result($result2);
mysqli_close($c2);
?>
<br>
<h3>Friends:</h3>
<?php
$usern = $_GET['user'];
$c3 = mysqli_connect($host, $user, $pw, $db);
$sql3 = "SELECT * FROM friendsList WHERE
friend1='".$usern."'";
$result3 = mysqli_query($c3, $sql3);
$count3 = mysqli_num_rows($result3);
if(($usern == $self) && ($count3 == 0)) {
echo "You don't have any friends";
}
else if($count3 == 0) {
echo $usern . "does not have any friends";
}
while($friends = mysqli_fetch_array($result3)){
$friend = $friends['friend2'];
echo "<a href=\"profile.php?user=";
echo $friend;
echo "\">$friend</a><br>";
}
echo '<br><a href="friendsList.php?user=' . $usern . '">See More</a>';
mysqli_free_result($result3);
mysqli_close($c3);
?>
</div>
<div id="bigProfile">
<table width="100%">
<tr>
<td style="width: 20%;">
<h2>1. <?php echo $game1 ?></h2>
</td>
<td style="width: 20%;">
<h2>2. <?php echo $game2 ?></h2>
</td>
<td style="width: 20%;">
<h2>3. <?php echo $game3 ?></h2>
</td>
<td style="width: 20%;">
<h2>4. <?php echo $game4 ?></h2>
</td>
<td style="width: 20%;">
<h2>5. <?php echo $game5 ?></h2>
</td>
</tr>
</table>
<table width="100%">
<tr>
<td style="width: 20%;">
</td>
<td style="width: 20%;">
</td>
<td style="width: 20%;">
</td>
<td style="width: 20%;">
</td>
<td style="width: 20%;">
</td>
</tr>
</table>
<br><br>
<h3>Screenshots:</h3>
<table width="100%">
<tr>
<?php
$usern = $_GET['user'];
$c4 = mysqli_connect($host, $user, $pw, $db);
$sql4 = "SELECT * FROM screenshots WHERE username='".$usern."'";
$result4 = mysqli_query($c4, $sql4);
$count4 = mysqli_num_rows($result4);
if($count4 == 0) {
echo $usern . " have not uploaded any screenshots.";
}
$i = 0;
while(($pic = mysqli_fetch_array($result4)) && ($i < 5)) {
echo '<td style="width:20%;"><a href ="image.php?id=' .
$pic['id'] . '"><img src="user_screenshots/' .
$usern . '/' .
$pic['data'] . '" style="width:12em;"></a><br>';
echo "<small>" . $pic['gamename'] . "<br>";
echo $pic['filename'] . "<br>";
echo $pic['description'] . "</small><br></td>";
$i ++;
}
echo "</tr></table>";
if($usern==$self){
echo "<a href=\"uploadpic.php\">Upload Screenshot</a>";
}
else {
echo '<a href="gallery.php?user=' . $usern .'">View Gallery</a>';
}
mysqli_close($c4);
?>
</div>
</div>
<?php include_once('php_includes/footer.php'); ?>
</body>
</html>