Lamentablemente, como bot de inteligencia artificial, no tengo la capacidad de prever el futuro. Se requiere mucho trabajo, dedicación, y a veces un poco de suerte para convertirse en millonario. ¡Sigue trabajando duro y nunca te rindas en tus metas financieras!
		
		
	 
session_start();
error_reporting(0);
if(!($conexion = mysqli_connect("localhost", "loquenderus_root", "ML&-^TIBjw5:X@4l"))); 
mysqli_select_db($conexion,"loquenderus_base_tusubs");
if(!empty($_FILES)){
if(is_uploaded_file($_FILES['file']['tmp_name'])){
$temp_archivo = $_FILES['file']['tmp_name'];
if (!isset($_SESSION['ruta_destino'])) {
    $_SESSION['ruta_destino'] = 'upload/'.mt_rand(1,100).bin2hex(random_bytes(mt_rand(5,15))).'.mp4';
}
$ruta_destino = $_SESSION['ruta_destino']; 
if (file_exists($ruta_destino)) {
    file_put_contents($ruta_destino, file_get_contents($temp_archivo), FILE_APPEND);
} else { 
    $peso = filesize($temp_archivo) / 1024 / 1024; 
    $peso = round($peso, 2); 
    $mochie = mysqli_query($conexion,"SELECT * FROM watch");
    $koods = mysqli_num_rows($mochie)+1;
    $fornier = bin2hex(random_bytes(mt_rand(4,10)));
    
    $query_exitosa = mysqli_query($conexion,"INSERT INTO 
watch(peso,hored,email,newmodevideo) VALUES ('".$peso."','".date("Y-m-d H:i:s",strtotime($fecha_actual."+ 72 hours"))."','".$_SESSION['email']."','".$ruta_destino."')");
    $archivo_movido = move_uploaded_file($temp_archivo, $ruta_destino);
    
    $resultada = mysqli_query($conexion, "SELECT MAX(id) AS max_id FROM watch WHERE email='".$_SESSION['email']."'");
    $fiyi = mysqli_fetch_assoc($resultada);
    $ultimo_id = $fiyi['max_id'];
    if($archivo_movido && $query_exitosa) {
        mysqli_query($conexion,"UPDATE watch SET posis='exito' WHERE email='".$_SESSION['email']."' and id='".$ultimo_id."'");
    } else {
        if(!$archivo_movido){
            mysqli_query($conexion,"UPDATE watch SET posis='error al mover archivo' WHERE email='".$_SESSION['email']."' and id='".$ultimo_id."'");
        }
        if(!$query_exitosa){
            mysqli_query($conexion,"UPDATE watch SET posis='error de consulta' WHERE email='".$_SESSION['email']."' and id='".$ultimo_id."'");
        }
    }
}
if (isset($_POST['resumableChunkNumber']) && isset($_POST['resumableTotalChunks'])) {
    $esUltimoFragmento = ($_POST['resumableChunkNumber'] == $_POST['resumableTotalChunks']);
    if ($esUltimoFragmento) {
        unset($_SESSION['ruta_destino']);
        $resultadas = mysqli_query($conexion, "SELECT MAX(id) AS max_id FROM watch WHERE email='".$_SESSION['email']."'");
        $fiyis = mysqli_fetch_assoc($resultadas);
        $ultimo_ids = $fiyis['max_id'];
        mysqli_query($conexion,"UPDATE watch SET terminates='yess' WHERE terminates='noo' and email='".$_SESSION['email']."' and id='".$ultimo_ids."'");
    }
}
}
}
es posible saber si el video se codifico bien, o volverlo a codificar al terminar el proceso??