forked from D-Big-B/DARP
-
Notifications
You must be signed in to change notification settings - Fork 0
/
processing2.php
53 lines (40 loc) · 1.53 KB
/
processing2.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
<?php
require_once("includes/header.php");
require_once("includes/classes/VideoUploadData.php");
require_once("includes/classes/VideoProcessor.php");
if(!isset($_POST['postCheck'])) {
echo "No file Sent To Page !!";
exit();
}
else{
$videoProcessor = new VideoProcessor($con);
$wasSuccessful = $videoProcessor->uploadFileToIPFS($_POST['finalFilePath']);
if($wasSuccessful){
echo "Video uploaded successfully to IPFS";
$query = $con->prepare("UPDATE videos SET transactionStatus=1 WHERE id=:videoId");
$query->bindParam(":videoId", $_POST['videoId']);
$success = $query->execute();
$query2 = $con->prepare("UPDATE videos SET
uploaderEthAddress=:uploaderEthAddress, videoIndex=:videoIndexCount
WHERE id=:videoId");
$query2->bindParam(":uploaderEthAddress", $uploaderEthAddress);
$query2->bindParam(":videoIndexCount", $videoIndexCount);
$query2->bindParam(":videoId", $_POST['videoId']);
$videoId =$_POST['videoId'];
$uploaderEthAddress = $userLoggedInObj->getEthAddress();
$videoIndexCount = $userLoggedInObj->getVideoIndexCount();
//echo "<BR> UPDATE videos SET uploaderEthAddress=$uploaderEthAddress AND videoIndex=$videoIndexCount WHERE id=$videoId";
$success2 = $query2->execute();
$userLoggedInObj->incrementVideoIndexCount();
if(!$success || !$success2) {
echo "FAILED TO SET TRANSACTION STATUS=1 OR FAILED TO UPDATE VIDEO_INDEX\n";
} else {
//header("Location: watch.php?id=$videoId");
}
}
else{
echo "<br>IPFS UPLOAD FAILED";
}
}
?>
<?php require_once("includes/footer.php"); ?>