-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathprofile.php
executable file
·100 lines (94 loc) · 3.45 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
<?php
include_once("session.php");
session_start();
$me = $_SESSION["user"]->getName();
$you = '';
if( isset($_GET['user']) && trim($_GET['user']) ){
$you = pg_escape_string($_GET['user']);
if( $me != $you && !$_SESSION["user"]->query("select userExists('$you');", "boolean") ){
header("Location: profile.php?user=$me");
}
}
else{
header("Location: profile.php?user=$me");
}
?>
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>eHarbinger</title>
<link rel="stylesheet" type="text/css" href="css/meg.css">
<script type="text/javascript" src = "design.js"></script>
<link href="font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css">
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
<link rel="stylesheet" href="main.css">
<script src="js/vendor/modernizr-2.8.3.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
</head>
<body>
<!-- need connection to back end for messages -->
<section id = 'banner'>
<div class = 'inner split'>
<section>
<h2> User Profile </h2>
</section>
<section>
<form action="userauth.php" method="post">
<button type="submit"> Log Out </button>
<input type="hidden" name="type" value="logout">
</form>
</section>
</div>
</section>
<div class = 'wrapper'>
<div class = 'inner split'>
<section>
<img src = 'images/plainPic.gif'>
</section>
<section>
<?php
$username = $_GET["user"];
$profile = $_SESSION["user"]->query("select * from getprofile('$username');", "array");
$description = $profile["description"];
$display = $profile['name'];
$location = $profile['location'];
$languages = $profile['languages'];
$rating = $_SESSION["user"]->query("select getrating('$username');", "array");
if (!$rating) {$rating = '0';}
echo "Username: $username<br>";
echo "Display name: $display<br/>";
echo "Location: $location<br/>";
echo "Languages: $languages<br/>";
echo "Feedback: " . $rating["getrating"] . "<br>";
echo "About the gamer: " . $description . "<br>";
if ($username != $me){
echo "<form id='likeMatch' action='rateuser.php' method='post'>";
echo "<input type='hidden' name='rateduser' value='$username'>";
echo "<input type='hidden' name='rating' value='1'>";
echo "<button>Good match</button>";
echo "</form>";
echo "<form id='unlikeMatch' action='rateuser.php' method='post'>";
echo "<input type='hidden' name='rateduser' value='$username'>";
echo "<input type='hidden' name='rating' value='-1'>";
echo "<button>I didn't like my match</button>";
echo "</form>";
echo "<form id='message' action='messages.php' method='get'>";
echo "<button onclick = 'send()'> Message </button>";
echo "<input type='hidden' name='user' value='$username'>";
echo "</form>";
}
else{
echo "<form id='message' action='createprofile.php'>";
echo "<button onclick = 'send()'> Edit Profile </button>";
echo "</form>";
}
echo "<br><br><br>";
?>
</section>
</div>
</div>
</body>
<footer><?php include('footer.html');?></footer>
</html>