session_start();
$user_id = $_SESSION['id'];
$username = $_SESSION['usr'];
if($_SESSION['id']){
// header("Location: ./index.php");
// die();
//echo "session id exists
";
} else { // echo "no session id
";
header("Location: index.php");
exit;
}
require_once('Encoding.php');
use \ForceUTF8\Encoding; // It's namespaced now.
ini_set("default_charset", "UTF-8");
//mb_internal_encoding("UTF-8");
//ini_set('display_errors', 1);
//ini_set('display_startup_errors', 1);
//error_reporting(E_ALL);
$video_id = $_GET['v'];
if(isset($_GET['logoff']))
{
$_SESSION = array();
session_destroy();
header("Location: index.php");
exit;
}
//if(!$_SESSION['id']){
// header("Location: ./index.php");
// die();
// }
$db = mysqli_connect ("localhost", "pack", "watch3r");
mysqli_select_db ($db, "pack");
mysqli_set_charset($db, 'utf8mb4');
// check if you own this video
//$checker = mysqli_query("SELECT * FROM pack_engine LIMIT 1");
// while ($gather = mysqli_fetch_array($checker)) {
//$enginestatus = $gather["status"];
// }
// if($enginestatus == 'DOWN'){
// header("Location: ./index.php");
// die();
// }
// if(!$_SESSION[id]){
// header("Location: ./index.php");
// die();
// }
$videosystem = 0;
$query = mysqli_query($db,"SELECT * FROM pack_song WHERE status LIKE '%PHASE%' order by status");
while ($gather = mysqli_fetch_array($query)) {
$videosystem++;
}
$d = $_GET['d'];
$rb = $_GET['rb'];
$yt = $_GET['yt'];
$dyt = $_GET['dyt'];
$pri = $_GET['pri'];
$pyt = $_GET['pyt'];
$alv = $_GET['alv'];
$dlv = $_GET['dlv'];
$pm = $_GET['pm'];
//$user_id = $_GET['id'];
// Change from public to private. Should back this up with Session ID IF
if ($pri) {
$query = "UPDATE pack_song set privacy = '$pri' WHERE id = '$pyt'";
mysqli_query($db, $query);
$video_id = $pyt;
}
####################################
// DELETE VIDEO FUNCTION: CHECKS IF YOU ARE THE OWNER
#######################################
if ($d) {
// Check to see if the user from the SESSION ID owns this video:
$exchecker = mysqli_query($db, "SELECT * FROM pack_song WHERE id = '$d'");
while ($seesaw = mysqli_fetch_array($exchecker)) {
$video_owner = $seesaw["user_id"];
}
if ($video_owner = $user_id){
//echo "Video ID:" . $id;
$result = mysqli_query($db, "SELECT * FROM pack_song WHERE id = '$d'");
while ($boo = mysqli_fetch_array($result)) {
$music_file = $boo["music_file"];
$video_link = $boo["video_link"];
$archive_flag = $boo["metadata"];
}
## DELETE THE MUSIC FILE
$dir = "/home/mvgen/public/mvgen.com/public/music_uploads/";
$file = $dir . $music_file;
//echo $file;
if (file_exists($file))
{
unlink ($file);
clearstatcache();
}
## DELETE THE OTHER MUSIC FILE
$process_audio = substr($music_file,0,-4);
$dir = "/home/mvgen/public/mvgen.com/public/music/";
$file3 = $dir . $process_audio . ".wav";
//echo $file;
if (file_exists($file3))
{
unlink ($file3);
clearstatcache();
}
## DELETE THE VIDEO FILE
if ($archive_flag){
$output = shell_exec("python /var/www/amazon_delete.py " . $d . " 2>&1" );
echo $output;
} else {
$dir = "/home/mvgen/public/mvgen.com/public/video/";
$file2 = $dir . $video_link;
//echo $file2;
if (file_exists($file2))
{
unlink($file2);
}
}
## DELETE THE ENTRY IN THE DATABASE
$query = "DELETE FROM pack_song WHERE id = '$d'";
mysqli_query($db, $query);
} else { echo "YOU ARE NOT THE OWNER"; }
}
#################################################################
// DELETE YOUTUBE VIDEO // BROKEN
#####################################################################
if ($dyt){
# get youtube ID link for deletions
$query = mysqli_query($db, "SELECT * FROM pack_song WHERE id = '$dyt'");
while ($image_data = mysqli_fetch_array($query)) {
$video_link = $image_data["youtube_link"];
}
$stringOne = split("=",$video_link);
$youtube_id = $stringOne[1];
$youtube_id = trim($youtube_id);
echo $youtube_id;
###################################################
### We will need to check this out : the python script
#########################################################
// $output = shell_exec("python /var/www/erase.py --id " . $youtube_id . " 2>&1" );
//echo $output;
# update and wipe that youtubelink!
//$query = "UPDATE pack_song set youtube_link = '' WHERE id = '$dyt'";
//mysqli_query($db, $query);
}
############################################################################
// REBUILD THIS VIDEO
#######################################################################
if ($rb) {
$video_id = $rb;
$ctitle = $_GET['title'];
$cartist = $_GET['artist'];
$cdatabase = $_GET['database'];
$ccolor = $_GET['color'];
$cspeed = $_GET['speed'];
$ceffect = $_GET['effect'];
$clens = $_GET['lens'];
$cfilter = $_GET['filter'];
$ctitlemode = $_GET['titlemode'];
if ($ctitle){
$query = "UPDATE pack_song set title = '$ctitle' WHERE id = '$rb'";
mysqli_query($db, $query);
}
if ($cartist){
$query = "UPDATE pack_song set title = '$cartist' WHERE id = '$rb'";
mysqli_query($db, $query);
}
$prep = array($cdatabase , $ccolor , $cspeed, $ceffect, $cfilter, $clens, $ctitlemode);
$options = implode(":" , $prep);
$status = "INITIALIZATION PHASE: 0%";
$frame = "mvgen.gif";
mysqli_query($db,"UPDATE pack_filters set counter = counter + 1 WHERE filtername = '$cfilter'");
mysqli_query($db,"UPDATE pack_filters set counter = counter + 1 WHERE filtername = '$ccolor'");
mysqli_query($db,"UPDATE pack_filters set counter = counter + 1 WHERE filtername = '$cspeed'");
mysqli_query($db,"UPDATE pack_filters set counter = counter + 1 WHERE filtername = '$ceffect'");
mysqli_query($db,"UPDATE pack_filters set counter = counter + 1 WHERE filtername = '$ctitlemode'");
mysqli_query($db,"UPDATE pack_filters set counter = counter + 1 WHERE filtername = '$clens'");
mysqli_query($db,"UPDATE pack_filters set counter = counter + 1 WHERE filtername = '$csource'");
$query = "UPDATE pack_song set creation_date = NOW() WHERE id = '$rb' ";
mysqli_query($db,$query);
$query = "UPDATE pack_song set process_flag = 0 WHERE id = '$rb' ";
mysqli_query($db,$query);
$query = "UPDATE pack_song set status = '$status' WHERE id = '$rb'";
mysqli_query($db,$query);
$query = "UPDATE pack_song set frame = '$frame' WHERE id = '$rb'";
mysqli_query($db,$query);
$query = "UPDATE pack_song set options = '$options' WHERE id = '$rb'";
mysqli_query($db,$query);
//$query = "UPDATE pack_song set process_flag = '0' WHERE id = '$rb'";
//mysqli_query($db, $query);
}
############################################################################// REUPLOAD TO YOUTUBE!
#########################################################################
if ($yt) {
$output = shell_exec("python /var/www/youtube_upload_byid.py " . $yt . " 2>&1");
# debug
echo $output;
}
if ($alv) {
## a list of updates from the form if its just title and artist, then dont change anything.
$query = "UPDATE pack_song set live = '1' WHERE id = '$alv'";
mysqli_query($db, $query);
$video_id = $alv;
}
if ($dlv) {
## a list of updates from the form if its just title and artist, then dont change anything.
$query = "UPDATE pack_song set live = '0' WHERE id = '$dlv'";
mysqli_query($db, $query);
$video_id = $dlv;
}
if ($pm) {
## a list of updates from the form if its just title and artist, then dont change anything.
## check if KEEP already is 4
## this maybe costs credits! subtract 10 credits. When you get a subscription to MVGEN you get like 100 credits
$query = "UPDATE pack_song set keep = '4' WHERE id = '$pm'";
mysqli_query($db, $query);
$video_id = $pm;
}
?>
$ip = getenv('REMOTE_ADDR');
#$video_id = $_GET["id"];
$db = mysqli_connect ("localhost", "pack", "watch3r");
mysqli_select_db ($db,"pack");
####
###
$result = mysqli_query($db,"SELECT * FROM pack_song where id = '$video_id'");
$ratch = mysqli_fetch_array($result);
$artist = $ratch["artist"];
$title = $ratch["title"];
$running_time = $ratch["running_time"];
$video_link = $ratch["video_link"];
$youtube_link = $ratch["youtube_link"];
$creation_date = $ratch["creation_date"];
$lyrics = $ratch["lyrics"];
$options = $ratch["options"];
$video_status = $ratch["status"];
$live = $ratch["live"];
$keep = $ratch["keep"];
$live_status = explode(":",$video_status);
$main_artist = $artist;
$videothumbnail = $ratch["video_still"];
$metadata = $ratch["metadata"];
$privacy = $ratch["privacy"];
# look up the username/icon for the user.
$video_user_id = $ratch["user_id"];
$video_url = "../video/" . $video_link;
$video_long_url = "http://www.mvgen.com/video/" . $video_link;
if ($metadata == "ARCHIVE"){
$video_long_url = "http://mvgenvideos.s3-website-us-west-2.amazonaws.com/" . $video_link;
}
$crack = mysqli_query($db,"SELECT * FROM pack_song_views where id = '$video_id'");
$vidtab = mysqli_fetch_array($crack);
$views = $vidtab["views"];
$likes = $vidtab["likes"];
?>
$stuff = mysqli_query($db,"SELECT * FROM pack_user where id = '$video_user_id'");
while ($ratch = mysqli_fetch_array($stuff)) {
$account_id = $ratch["id"];
$createdby = $ratch["usr"];
}
$box = mysqli_query($db,"SELECT * FROM pack_user_extended where user_id = '$account_id'");
while ($rite = mysqli_fetch_array($box)) {
$account_id = $rite["id"];
$logo = $rite["logo"]; $photo = $rite["photo"];
}
?>
//$user_id = $_SESSION['id'];
// really this user id needs to match
//if ($privacy == "private" && $user_id != $video_user_id){
// header( 'Location: http://www.mvgen.com' ) ;
//}
?>
$stuff = mysqli_query($db,"SELECT * FROM pack_user where id = '$user_id'");
while ($ratch = mysqli_fetch_array($stuff)) {
$account_id = $ratch["id"];
$email = $ratch["email"];
$name = $ratch["usr"];
$password = $ratch["password"];
$df = $ratch["df"];
}
// pull all the info
$box = mysqli_query($db, "SELECT * FROM pack_user_extended where user_id = '$account_id'");
while ($rite = mysqli_fetch_array($box)) {
$extended_account_id = $rite["id"];
$logo = $rite["logo"];
$website = $rite["website"];
$facebook = $rite["facebook"];
$soundcloud = $rite["soundcloud"];
$youtube = $rite["youtube"];
$bandcamp = $rite["bandcamp"];
$twitter = $rite["twitter"];
$instagram = $rite["instagram"];
$snapchat = $rite["snapchat"];
$introflag = $rite["introflag"];
$status = $rite["status"];
$profile = $rite["profile"];
$photo = $rite["photo"];
$spotify = $rite["spotify"];
$cellphone = $rite["cellphone"];
$itunes = $rite["itunes"];
$mailinglist = $rite["mailinglist"];
$credits = $rite["credits"];
$coins = $rite["coins"];
}
$crack = mysqli_query($db, "SELECT * FROM pack_song where user_id = '$user_id' and process_flag = 2 ORDER BY creation_date DESC");
$number_of_videos = mysqli_num_rows($crack);
$total_views = 0;
$total_likes = 0;
$crack = mysqli_query($db, "SELECT * FROM pack_song where user_id = '$user_id' and process_flag = 2 ORDER BY creation_date DESC");
while ($turtle = mysqli_fetch_array($crack)) {
$old_video = $turtle["id"];
# now go into pack_song_views
$tabulate = mysqli_query($db, "SELECT * FROM pack_song_views where id = '$old_video'");
while ($pip = mysqli_fetch_array($tabulate)) {
$vs = $pip["views"];
$ls = $pip["likes"];
$total_views = $total_views + $vs;
$total_likes = $total_likes + $ls;
}
}
// need to pull views and likes!
?>
MVGEN: Video Manager: echo $title; ?>
include "./sidenav.php"; ?>
echo $title; ?> by echo Encoding::toUTF8($artist); ?>
- Views echo $views; ?>
- Likes echo $likes; ?>
- Uploaded echo date('F j ,Y', strtotime($creation_date) ); ?>
-
if ($privacy == "public") {?>
Public: YES } else { ?> Private: YES } ?>
- Youtube YES
- Running Time echo gmdate("H:i:s", $running_time); ?>
- MVGEN Live: YES
- Status: echo $live_status[0]; ?>
[ echo $live_status[1]; ?>]
if ($video_status == "COMPLETE!: 100 %"){ ?>
VIDEO SETTINGS