<?php
 session_start();
if(isset($_SESSION['Admin']))
{
    // $db=mysqli_connect("localhost","root","","behniwal") or die('Unable To connect');
    include "connection.php";
?>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=Edge">
    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
    <title>Add Video</title>
    <!-- Favicon-->
    <link rel="icon" href="favicon.ico" type="image/x-icon">

    <!-- Google Fonts -->
    <link href="https://fonts.googleapis.com/css?family=Roboto:400,700&subset=latin,cyrillic-ext" rel="stylesheet" type="text/css">
    <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet" type="text/css">

    <!-- Bootstrap Core Css -->
    <link href="admin_plugins/bootstrap/css/bootstrap.css" rel="stylesheet">

    <!-- Waves Effect Css -->
    <link href="admin_plugins/node-waves/waves.css" rel="stylesheet" />

    <!-- Animation Css -->
    <link href="admin_plugins/animate-css/animate.css" rel="stylesheet" />

    <!-- Morris Chart Css-->
    <link href="admin_plugins/morrisjs/morris.css" rel="stylesheet" />

    <!-- Custom Css -->
    <link href="admin_css/style.css" rel="stylesheet">

    <!-- AdminBSB Themes. You can choose a theme from css/themes instead of get all themes -->
    <link href="admin_css/themes/all-themes.css" rel="stylesheet" />
   
     <style>
       .container{
            justify-content: center;
            margin-top:20px;
        }
        #cn{
           
            border:1px solid silver;
            border-radius: 5px;
            text-justify: center;
            width:400px;
            height:480px;
            box-shadow:3px 3px 5px 6px #ccc; 
            margin-top:80px; 

                }
        .form-group{
            font-size: 14px;
            font-family:Cambria, Cochin, Georgia, Times, 'Times New Roman', serif;
            
            
        }
        .l{
        font-size:medium; 
        }
        #h{
            padding:10px;
        }
        .btn{
            cursor:pointer;
            width:140px;
            margin-left:110px;
            font-weight:200px;
            margin-top:20px;
        }
        .btn:hover{
            color:orangered;
        }
        h6{
            font-family:cursive;
            color:green;
        }
       
     </style>
</head>

<body class="theme-red">
  <!-- header -->
    <?php
        include "admin_header.php";
    ?>
    <!-- header -->
  <section >
        <div class="container">
            
            <div class="container" id="cn">
                <div class="form-group ">
                
                    <center><h2 id="h">Add Video</h2></center><hr>
                </div>
                <?php
                include "connection.php";
                if(isset($_POST['submit']))
                {
                    if($_POST['title']=='' or $_POST['link']=='' or $_POST['desc']=='')
                    {
                        echo "<script>alert('Fill all the fields.')</script>";
                        exit;
                    }
                    else
                    {
                        $title = $_POST['title'];
                        $link = $_POST['link'];
                        $desc = $_POST['desc'];
                        $date = date('y.m.d');
                        $query = "INSERT INTO `video`(title,link,descr,date) values ('$title','$link','$desc','$date')";
                        if(mysqli_query($db,$query))
                        {
                            echo"<h6>New Video has been inserted..</h6>";
                            // echo"<script>window.open('index.php?view=view','_self')</script>";
                        }
                    }
                }
             ?>
                <div class="form-group" >

                    <form name="form" method="post" action="add_video.php" enctype="multipart/form-data"> 
                    <div class="form-group">
                        <label for="title">Title</label>
                        <input type="text" name="title" placeholder="title of video" class="form-control l" required>
                    </div>
                   <div class="form-group">
                        <label for="link">Link</label>
                        <input type="text" name="link"class="form-control l" required>
                    </div>

                    <div class="form-group">
                        <label for="link">Desription</label>
                        <input type="text" name="desc"class="form-control l" required>
                    </div>
                  
                   
                     <br><input type="submit" class="btn  col-md-4 offset-md-4" id="submit" name="submit">
                   
                    </form>
                    
                </div>
            </div>
        </div>
    </section>
           
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js" integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49" crossorigin="anonymous"></script>
    <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js" integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy" crossorigin="anonymous"></script>
    
    <!-- Jquery Core Js -->
    <script src="admin_plugins/jquery/jquery.min.js"></script>

    <!-- Bootstrap Core Js -->
    <script src="admin_plugins/bootstrap/js/bootstrap.js"></script>

    <!-- Select Plugin Js -->
    <script src="admin_plugins/bootstrap-select/js/bootstrap-select.js"></script>

    <!-- Slimscroll Plugin Js -->
    <script src="admin_plugins/jquery-slimscroll/jquery.slimscroll.js"></script>

    <!-- Waves Effect Plugin Js -->
    <script src="admin_plugins/node-waves/waves.js"></script>

    <!-- Jquery CountTo Plugin Js -->
    <script src="admin_plugins/jquery-countto/jquery.countTo.js"></script>

    <!-- Morris Plugin Js -->
    <script src="admin_plugins/raphael/raphael.min.js"></script>
    <script src="admin_plugins/morrisjs/morris.js"></script>

    <!-- ChartJs -->
    <script src="admin_plugins/chartjs/Chart.bundle.js"></script>

    <!-- Flot Charts Plugin Js -->
    <script src="admin_plugins/flot-charts/jquery.flot.js"></script>
    <script src="admin_plugins/flot-charts/jquery.flot.resize.js"></script>
    <script src="admin_plugins/flot-charts/jquery.flot.pie.js"></script>
    <script src="admin_plugins/flot-charts/jquery.flot.categories.js"></script>
    <script src="admin_plugins/flot-charts/jquery.flot.time.js"></script>

    <!-- Sparkline Chart Plugin Js -->
    <script src="admin_plugins/jquery-sparkline/jquery.sparkline.js"></script>

    <!-- Custom Js -->
    <script src="admin_js/admin.js"></script>
    <script src="admin_js/pages/index.js"></script>

    <!-- Demo Js -->
    <script src="admin_js/demo.js"></script>
</body>

</html>
               					
<?php
}
else
{
	echo "<br>";
}
?>