-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathprofile.php
executable file
·69 lines (68 loc) · 3.65 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
<!doctype html>
<html>
<head>
<?php
require_once("includes/db.connect.inc.php");
$TITLE = 'Profile: '.$_GET['username'];
?>
<link rel="stylesheet" type="text/css" href="/css/style.css">
<meta name="keywords" content="profile contributor author blindcomputing info information <?php echo $_GET['username']; ?>">
<title>BlindComputing | Profile: <?php echo $_GET['username']; ?></title>
</head>
<body>
<?php
include_once("includes/nav.inc.php");
?>
<main id="content">
<?php
$contributor_error = '<h1>404 - Contributer Not Found</h1><p>Sorry, the contributor you\'re looking for does not appear to exist. Make sure you:</p><ol><li>Provided a username to this page</li><li>Spelled the username correctly</li></ol>';
$multiple_contributor_error = '<h1>Multiple contributors found: something is very very wrong!</h1><p>Please contact the blind computing team to report this error and give them the address of the page. Then just click the back button and forget about this.</p>';
if(isset($_GET['username'])) {
$username = $_GET['username'];
// set up the database query and run it.
$userResults = $db->prepare("select * from contributors where username=? limit 1;");
$userResults->execute([$username]);
if($userResults->rowCount() == 1) {
$user = $userResults->fetchObject();
echo '<header class="profile-info">';
if($user->imguri != NULL) {
echo '<img class="profile-img" width="15%" aria-label="Profile picture for '.$user->username.'." src="'.$user->imguri.'">';
}
echo '<h2 class="profile-header">'.$user->username.'\'s Profile</h2>';
if($user->fullName != NULL) {
echo '<h3 class="profile-subheader">'.$user->fullName.'</h3>';
}
echo '<table class="profile-information"><tbody>';
if($user->email != NULL) {
echo '<tr><th class="profile-th">Email: </th><td><a target="blank" href="mailto:'.$user->email.'" title="Email '.$user->username.'">'.$user->email.'</a></td></tr>';
}
if($user->github != NULL) {
$githubUsername = substr(parse_url($user->github,PHP_URL_PATH),1);
echo '<tr><th class="profile-th">Github: </th><td><a href="'.$user->github.'" title="Go to the GitHub profile for '.$user->username.'">@'.$githubUsername.'</a></td></tr>';
}
if($user->twitter != NULL) {
$twitterUsername = substr(parse_url($user->twitter,PHP_URL_PATH),1);
echo '<tr><th class="profile-th">Twitter: </th><td><a href="'.$user->twitter.'" title="Go to the Twitter Profile for '.$user->username.'">@'.$twitterUsername.'</a></td></tr>';
}
if($user->discordID != NULL && $user->discordName != NULL) {
echo '<tr><th class="profile-th">Discord: </th><td>@'.$user->discordName.'#'.$user->discordID.'</a></td></tr>';
}
if($user->youtube != NULL) {
echo '<tr><th class="profile-th">YouTube: </th><td><a href="'.$user->youtube.'" title="Go to '.$user->username.'\'s YouTube Channel">'.$user->username.'\'s Channel</a></td></tr>';
}
echo '</tbody></table>
<hr>
</header>
<article class="profile-description">'.$user->description.'</article>';
} else if($userResults->rowCount() > 1) {
echo $multiple_contributor_error;
} else {
echo $contributor_error;
}
} else {
echo $contributor_error;
}
?>
</main>
</body>
</html>