-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathview.php
More file actions
executable file
·153 lines (139 loc) · 5.76 KB
/
Copy pathview.php
File metadata and controls
executable file
·153 lines (139 loc) · 5.76 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
<?php
include 'config.php';
include 'headers.php';
// open connection to the database
include 'opendb.php';
$clip = NULL;
$media = $mediaDir;
$shortname = $_GET["video"];
try {
// get clip properties
$clipResult = mysqli_query($conn, "SELECT host, title, description, posted, user, views, extension FROM clips WHERE shortname='" . $shortname . "'");
if(mysqli_num_rows($clipResult) == 0){
$clip = NULL;
} else {
$clipRow = mysqli_fetch_row($clipResult);
$host = $clipRow[0];
$shareURL = "http://$WEBSITE_DOMAIN_NAME/view.php?video=$shortname";
$title = $clipRow[1];
$description = $clipRow[2];
$posted = $clipRow[3];
$userID = $clipRow[4];
$views = $clipRow[5];
$extension = $clipRow[6];
// get username
$userResult = mysqli_query($conn, "SELECT username FROM users WHERE id='" . $userID . "'");
$userRow = mysqli_fetch_row($userResult);
$username = $userRow[0];
// set the clip the filename
$clip = "$shortname.$extension";
// update view counter
mysqli_query($conn, "UPDATE clips SET views=views+1 WHERE shortname='" . $shortname . "'");
}
} catch (Exception $e) {
$clip = NULL;
}
?>
<!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.0">
<meta name="description" content="">
<meta name="author" content="">
<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon">
<link rel="icon" href="/favicon.ico" type="image/x-icon">
<title>Completely Digital Clips<?php if($clip != NULL){echo " - $title";} ?></title>
<!-- Bootstrap core CSS -->
<link href="/static/css/bootstrap.css" rel="stylesheet">
<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js"></script>
<![endif]-->
<!-- Custom styles for this template -->
<link href="/static/css/carousel.css" rel="stylesheet">
<script src="/lib/jquery.js"></script>
<script src="/lib/mediaelement-and-player.min.js"></script>
<link rel="stylesheet" href="./lib/mediaelementplayer.css" />
<script src="/static/js/bootstrap.min.js"></script>
</head>
<!-- NAVBAR
================================================== -->
<body>
<div class="navbar-wrapper">
<div class="container">
<div class="navbar navbar-inverse navbar-static-top" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<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="#">Completely Digital Clips</a>
<?php echo "<!-- Hosted by $APPLICATION_HOSTNAME -->"; ?>
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li><a href="/index.php">Home</a></li>
<?php if(isset($_COOKIE["PHPSESSID"])): ?>
<li><a href="/post.php">Post Video</a></li>
<li><a href="/logout.php">Logout</a></li>
<?php else: ?>
<li><a href="/login.php">Login</a></li>
<li><a href="/registration.php">Register</a></li>
<?php endif; ?>
</ul>
</div>
</div>
</div>
</div>
</div>
<br />
<div class="container marketing">
<hr class="featurette-divider">
<center>
<?php if($clip): ?>
<h1><?php echo htmlspecialchars($title) ?></h1>
<video src="<?php echo htmlspecialchars("http://$host$media/$clip") ?>" width="640" height="390" class="mejs-player" data-mejsoptions='{"alwaysShowControls": true}'></video>
<br />
<div style="max-width: 640px; height: 150px;">
<div style="float: left; max-width: 420px; width: 100%; height: 100%;">
<pre style="text-align: left; height: 100%;"><?php echo htmlspecialchars($description) ?></pre>
</div>
<div style="float: left; margin-left: 20px; max-width: 200px; width: 100%;">
<pre><b>Views: <?php echo htmlspecialchars($views) ?></b></pre>
<pre><b>Posted by: <a href="/user.php?username=<?php echo htmlspecialchars($username) ?>"><?php echo htmlspecialchars($username) ?></a></b></pre>
<b>Share </b><input type="text" name="share" value="<?php echo htmlspecialchars($shareURL)sssss ?>" disabled><br />
</div>
</div>
<script>
$(document).ready(function() {
var v = document.getElementsByTagName("video")[0];
new MediaElement(v, {success: function(media) {
<?php
if(isset($_GET["t"])){
$seconds = $_GET["t"];
echo "media.setCurrentTime($seconds);";
}
?>
media.play();
}});
});
</script>
<?php else: ?>
<h1>Sorry, we couldn't find that clip :(</h1>
<?php endif; ?>
</center>
<!-- FOOTER -->
<hr class="featurette-divider">
<footer>
<p class="pull-right"><a href="#">Back to top</a></p>
<p>© <?php echo date("Y"); ?> Completely Digital Clips · <a href="/privacy.php">Privacy</a> · <a href="/terms.php">Terms</a></p>
</footer>
</div>
</body>
</html>