File "my_tube.php"

Full Path: /home/u275821840/domains/padmaclasses.in/public_html/panel/my_tube.php
File size: 2.72 KB
MIME-type: text/x-php
Charset: utf-8

<?php
ob_start();
session_start();

if(!isset($_SESSION['username']))
{
	header('location:login.php');
}
include_once("../connect.php");

?>

<!DOCTYPE html>
<html lang="en">
  <head>
    <title>PCC</title>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js" integrity="sha384-wfSDF2E50Y2D1uUdj0O3uMBJnjuUD4Ih7YwaYd1iqfktj0Uod8GCExl3Og8ifwB6" crossorigin="anonymous"></script>  
<link href="../css/custom_style.css" rel="stylesheet">
  
  </head>
  <body>

<div class='container-fluid'>
<?php include_once("edit_menu.php"); ?>


<div class="row">
<div class="col-md-12">
<form action="my_tube.php" method="post" enctype="multipart/form-data" class="" />
<table class="table-condensed table-striped" style="width: 100%;"> 
<tr>
<td><input style='width:100%' type='text' name='video' placeholder="ADD VIDEO LINK HERE"/></td>
<td><input class="btn-danger" name="submit" type="submit" /></td>
</tr>

</table>
</form>
</div>
</div>

<div class='row'>
<?php
$sql = "SELECT * FROM my_tube where testim = 0 order by id desc";
$sql_run = mysqli_query($db,$sql);
$sql_count = mysqli_num_rows($sql_run);

if($sql_count > 0)
{

	for($x=1;$x<=$sql_count;$x++)
	{
		$row = mysqli_fetch_array($sql_run);
		$video = $row['video'];
		$id = $row['id'];
		
		echo "
		<div class='col-md-4' style='margin-bottom:10px;' align='center'>
		<iframe style='width:100%;height:250px' src='https://www.youtube.com/embed/$video' frameborder='0' allowfullscreen></iframe>
		<a href='my_tube.php?delx=$id' id='del' class='btn btn-danger'>Delete</a>
		</div>
		";
	}	
}
?>
</div>
</div>
</body>

<?php 
if(isset($_POST['submit'])) 
{	
$video = $_POST['video'];

if (strpos($video, '=') == true) 
	{
	$video_string = explode('=',$video);
	$vid = $video_string[1];
	    if (strpos($vid, '&') == true) 
	    {
	        $vidnew = explode('&',$vid);
	        $vid = $vidnew[0];
	    }
	}
	else
	{
	$video_string = explode('.be/',$video);
	$vid = 	$video_string[1];
	    if (strpos($vid, '&') == true) 
	    {
	        $vidnew = explode('&',$vid);
	        $vid = $vidnew[0];
	    }
	}
		
$sql = "INSERT INTO my_tube (video) VALUE ('$vid')";
		
	if ($runsql = mysqli_query($db, $sql)) 
	{	echo "<script>window.location='my_tube.php'</script>";
		header("location:my_tube.php");
	} 
}		
?>


<?php
if(isset($_GET['delx']))
	{

		$x = $_GET['delx'];

		$sql = mysqli_query($db,"delete from my_tube where id = '$x'");

		header("location:my_tube.php");

	}

?>