Commit 419df96f authored by carboncrafters's avatar carboncrafters

fix and test

parent ec4898bc
......@@ -106,6 +106,7 @@ $conn->close();
$descr = $row["descr"];
$user = $row["user"];
$id = $row["id"];
//$dl = $row["dl"];
}
if ($deleted=="0") {
$return["id"] = $id;
......@@ -114,7 +115,7 @@ $conn->close();
$return["views"] = $views;
$return["description"] = $descr;
$return["uid"] = $user;
//$return["dl"] = $dl;
echo json_encode($return);
}else{
$return["error"]="true";
......@@ -209,7 +210,7 @@ if ($result->num_rows > 0) {
}
if ($deleted=="0") {
$sql = "UPDATE videos SET views=views + 1 WHERE id='$id' ";
$sql = "UPDATE ids SET views=views + 1 WHERE id='$id' ";
if ($conn->query($sql) === TRUE) {
$return["error"]="false";
$return["type"]="200";
......
This diff is collapsed.
......@@ -17,7 +17,7 @@ $browlin = $_GET["v"];
$browlin = explode('/', $browlin);
//get json data
$json = file_get_contents("https://cdn.$domain/json/$browlin[0].json");
$json = file_get_contents("https://$domain/api/?get=basic&id=$browlin[0]");
if($json === FALSE) {
header("HTTP/1.0 404 Not Found");
......@@ -26,9 +26,10 @@ $json = file_get_contents("https://cdn.$domain/json/$browlin[0].json");
exit;
}
$obj = json_decode($json, true);
$uploaderid = $obj["uid"];
//end of json stuff
//get the data from the database
require $_SERVER["DOCUMENT_ROOT"].'/conn.php';
/*require $_SERVER["DOCUMENT_ROOT"].'/conn.php';
$sql = "SELECT * FROM videos WHERE id='$browlin[0]'";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
......@@ -53,7 +54,7 @@ if ($result->num_rows > 0) {
exit;
}
$conn->close();
$conn->close();*/
?>
<!-- meta tags and stuff -->
......@@ -61,10 +62,10 @@ $conn->close();
<meta property="og:title" content="Emalm video - <?= $title ?>">
<meta property="og:type" content="video">
<meta property="og:url" content="https://emalm.com/?v=<?= $obj["id"]?>">
<meta property="og:image" content="https://cdn.emalm.com/video/<?= $obj["id"]."/".$obj["id"]?>.png">
<meta property="og:description" content="Emalm video sharing.<br><?= nl2br($desc) ?>">
<meta property="og:image" content="https://cdn.emalm.com/video/<?= $obj["id"]."/".$obj["id"]?>.jpg">
<meta property="og:description" content="Emalm video sharing.<br><?= nl2br($obj["description"]) ?>">
<meta property="og:video" content="https://cdn.emalm.com/video/<?= $obj["id"]."/".$obj["id"]."-MUX-low.webm" ?>">
<meta name="description" content="Emalm video sharing.\n<br><?= nl2br($desc)?>">
<meta name="description" content="Emalm video sharing.\n<br><?= nl2br($obj["description"])?>">
<meta name="theme-color" content="#ffff00">
<meta name="keywords" content="">
<meta property="id" content="<?= $title ?>">
......@@ -73,14 +74,14 @@ $conn->close();
<meta content='text/html; charset=UTF-8' http-equiv='Content-Type' />
<meta name="twitter:card" content="player" />
<meta name="twitter:site" content="@emalm" />
<meta name="twitter:title" content="Emalm video - <?= $title ?>" />
<meta name="twitter:title" content="Emalm video - <?= $obj["title"] ?>" />
<meta name="twitter:image" content="https://cdn.emalm.com/video/<?= $obj["id"]."/".$obj["id"].".png" ?>" />
<meta name="twitter:image" content="https://cdn.emalm.com/video/<?= $obj["id"]."/".$obj["id"].".jpg" ?>" />
<meta name="twitter:player" content="https://emalm.com/vid/player.html?vid=<?= $obj["id"] ?>" />
<meta name="twitter:player:width" content="1280" />
<meta name="twitter:player:height" content="720" />
<meta name="description" content="<?php Print(nl2br($desc)) ; ?>">
<meta name="description" content="<?php Print(nl2br($obj["description"])) ; ?>">
<meta name="keywords" content="video sharing, <?php echo $obj["name"] ;?>">
<meta name="author" content="<?php echo $obj["uid"] ;?>">
......@@ -94,13 +95,14 @@ $conn->close();
<body class="push">
<?php
include $_SERVER["DOCUMENT_ROOT"].'/'.$displang.'/menu.html'; ?>
include $_SERVER["DOCUMENT_ROOT"].'menu.html'; ?>
<aside class="rside" >
<?php include $_SERVER["DOCUMENT_ROOT"].'/ad.php'; ?>
</aside >
<section class="left">
<iframe class="iframe-container" style="max-height:70vh;height:100vh; width:100%;margin-left:auto;margin-right:auto;left:auto;" src="https://emalm.com/vid/player.html?vid=<?=$id?>" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
<iframe class="iframe-container" style="max-height:70vh;height:100vh; width:100%;margin-left:auto;margin-right:auto;left:auto;" src="https://emalm.com/vid/player.html?vid=<?=$obj["id"]?>" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
<table width="100%">
<tr><td colspan="3">
......@@ -108,15 +110,10 @@ include $_SERVER["DOCUMENT_ROOT"].'/'.$displang.'/menu.html'; ?>
<tr width="90%"><td>
<b>Views:
<?php
//print out the views and count it
/*
print($obj["views"]++);
$json = json_encode($obj);
file_put_contents('/cdn/json/v_'.$browlin[0].'.json', $json);
/*/
echo $views++;
echo $obj["views"];
require $_SERVER["DOCUMENT_ROOT"].'/conn.php';
$sql = "UPDATE videos SET views='$views' WHERE id='$browlin[0]' ";
$sql = "UPDATE videos SET views=views + 1 WHERE id='$browlin[0]' ";
if ($conn->query($sql) === TRUE) {
} else {echo "Error: " . $sql . "<br>" . $conn->error;}
?>
......@@ -124,7 +121,8 @@ $sql = "UPDATE videos SET views='$views' WHERE id='$browlin[0]' ";
</td><td style="text-align:right">Votes:###</td><td style="text-align:right">
<?php
if(($loggedUser==$obj["uid"] && $obj["uid"] != 0 )||$priv=='1'){
echo"delet dis";
echo"<a href=\"https://emalm.com/delete.php?type=vid&id=$id\">delet dis</a>";
}
......@@ -161,6 +159,7 @@ $conn->close();
<td width="75%">
<!--download and stuff gotta change this later so itll obey the dl property in sql-->
<?php
if($uploaderid=='0'){echo"<h4>Anonymous</h4>";}else{
require $_SERVER["DOCUMENT_ROOT"].'/conn.php';
$sql = "SELECT * FROM users WHERE uid='$uploaderid'";
......@@ -189,7 +188,7 @@ echo '<e><a href="https://emalm.com/dl.php?type=vid&id='.$obj["id"].'&orig=0&ext
<tr>
<td text-align="left" >
<br>
<p draggable="true"> <?= nl2br($desc) ?></p>
<p draggable="true"> <?= nl2br($obj["description"]) ?></p>
</td>
</tr>
</table>
......@@ -256,60 +255,7 @@ You have to be logged in to comment!
</td>
</tr>
</table>
<?php
//include ($_SERVER["DOCUMENT_ROOT"].'/img/kep.php');
/*
require $_SERVER["DOCUMENT_ROOT"].'/conn.php';
$sql = "SELECT * FROM `comments` WHERE `id=$id` ORDER BY `comments`.`upl_date` DESC";
$result = $conn->query($sql);
/*
if ($result->num_rows > 0) {
// output data of each row
if (is_numeric($browlin[0])) {
$k=$browlin[0];
$j=$browlin[0]+10;
}else {
$k=0;
$j=10;
}
$i=0;
while(($row = $result->fetch_assoc()) && ($k < $j)) {
$uploaderid = $row["comments.uid"];
$comment = $row["comments.comment"];
$comm_date = ["comments.comm_date"];
$edited = ["comments.edited"];
$edit_date = ["comments.edit_date"];
$username = ["users.uname"];
$profimg = ["users.profimg"];
if ($pub == 1 ) {if ($i==$k) {
echo "<table>
<tr width='90%'>
<td width='5%' class='top'>
<a href='$uploaderid'>
<img class='img-circle' src='https://cdn.emalm.com/profimg/$profimg' >
</td><td width='95%''>
<h5><b>$uname</b></a> $time<br/></h5>
$comment
</td>
</tr>
</table>";
$k++;
}
$i++;
}
}
} else {
echo "The requested comment can not be found in our databse!";
}
$conn->close();*/
?>
</section>
</body>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment