<?php
include("topmenu.php");

?>

<div class="main_content_iner overly_inner ">
<div class="container-fluid p-0 ">

<div class="row">
<div class="col-12">
<div class="page_title_box d-flex align-items-center justify-content-between">
<div class="page_title_left">
<h3 class="f_s_30 f_w_700 text_white">Projects</h3>
<ol class="breadcrumb page_bradcam mb-0">
<li class="breadcrumb-item"><a href="javascript:void(0);">Al Barsha Electronics LLC </a></li>
<li class="breadcrumb-item"><a href="javascript:void(0);">Dashboard</a></li>
<li class="breadcrumb-item active">Projects</li>
<li class="breadcrumb-item active">Project </li>
</ol>

</div>
</div>

<div class="row">
    <div class="col-lg-12">
        <div class="card">
            <div class="card-header align-items-center d-flex card-header2">
                <h4 class="card-title mb-0 flex-grow-1">Update Project Details</h4>
                
            </div><!-- end card header -->

            
            <div class="card-body">
                <div class="live-preview">
                <form method="post" enctype="multipart/form-data">
                    <div class="row gy-4">
                    
                        
                        <!--end col-->
                        <?php
if(isset($_GET['id']))
{
$id=$_GET['id'];
$s=mysqli_query($db,"select * from addpjt where ID='$id'");
$r=mysqli_fetch_row($s);


$s1=mysqli_query($db,"select * from addcategory where id='$r[2]'");
$r1=mysqli_fetch_row($s1);

$s2=mysqli_query($db,"select * from service where id='$r[3]'");
$r2=mysqli_fetch_row($s2);
}
?>                   
                           
                           <div class="col-lg-6 ">
                            <div>
                                <label for="labelInput" class="form-label">Image(width-387px & height-400px or width-595px & height-400px)<span class="red">*</span></label>
                                <input type="file"  class="form-control" id="exampleInputdate" name="photo" >
                                <img src="../images/project/<?php echo $r[1]?>" width="150" height="150">
                            </div>
                        </div>
                        <div class="col-md-6">
                             <div>
                                <label for="labelInput" class="form-label">Select Type<span class="red">*</span></label>
                                <select class="form-select" id="inputGroupSelect01" name='a1'>
                                <option value="<?php echo $r1[0] ?>"><?php echo $r1[1] ?></option>

                                    <?php
$sqq=mysqli_query($db,"select * from addcategory " );
while($rqq=mysqli_fetch_row($sqq))
{
?>
                                        <option value="<?php echo $rqq[0] ?>"><?php echo $rqq[1] ?></option>
                                        <?php
}
?>
     
                                    </select>
                             </div>
                        </div>
                        <div class="col-lg-6">
                            <div class="input-group mb-3">    
                                <label class="input-group-text" for="inputGroupSelect01">Select Type</label>
                                    <select class="form-select" required id="inputGroupSelect01" name='a2'>
                                    <option value="<?php echo $r2[0] ?>"><?php echo $r2[3] ?></option>

                                    <?php
$sqq=mysqli_query($db,"select * from service");
while($rqq=mysqli_fetch_row($sqq))
{
?>
                                        <option value="<?php echo $rqq[0] ?>"><?php echo $rqq[3] ?></option>
                                        <?php
}
?>
     
                                    </select>
                            </div>
                        </div>
                        <div class="col-md-6">
                             <div>
                                <label for="labelInput" class="form-label">Title<span class="red">*</span></label>
                                     <input class="form-control" type="text" required name="a3" value="<?php echo $r[4]?>" >
                             </div>
                        </div>
                        </div>
<center><h1>Project Details</h1></center>
<div class="row gy-4">
<div class="col-lg- 3">
                            <div>
                                <label for="labelInput" class="form-label">Image(width-1220px & height-600px)<span class="red">*</span></label>
                                <input type="file"  class="form-control" id="exampleInputdate" name="photo1" >
                                <img src="../images/project/<?php echo $r[8]?>" width="150" height="150">

                                
                            </div>
                        </div>

                        <div class="col-lg-3">
                            <div>
                                <label for="labelInput" class="form-label">Description 1<span class="red">*</span></label>
                                <textarea type="text"  class="form-control" id="exampleInputdate" name="a4"required><?php echo $r[5]?></textarea>
                            </div>
                        </div> 

                        <div class="col-lg-3">
                            <div>
                                <label for="labelInput" class="form-label">Description 2<span class="red">*</span></label>
                                <textarea type="text"  class="form-control" id="exampleInputdate" name="a5"required><?php echo $r[6]?></textarea>
                            </div>
                        </div>
                        <div class="col-lg-3">
                            <div>
                                <label for="labelInput" class="form-label">Description 3<span class="red">*</span></label>
                                <textarea type="text"  class="form-control" id="exampleInputdate" name="a6"required><?php echo $r[7]?></textarea>
                            </div>
                        </div>

                        <div class="mt-3">
                        <input type="submit" class="btn btn-primary"  name="sub1" value="Submit">
                        <!-- staticBackdrop Modal -->
                        </div>

                    
                </form>
                </div>
                    <!--end row-->
               </div>
            </div>
        </div>   
        
        
        
    </div>
    </div>

    <?php


if(isset($_POST['sub1']))
{

    $a1=addslashes($_POST['a1']);
    $a2=addslashes($_POST['a2']);
    $a3=addslashes($_POST['a3']);
    $a4=addslashes($_POST['a4']);
    $a5=addslashes($_POST['a5']);
    $a6=addslashes($_POST['a6']);
    $fileName1=$_FILES['photo']['name'];
    $fileName2=$_FILES['photo1']['name'];
    
               




if(isset($_FILES['photo']['name']) && $_FILES['photo']['name']!="")
{
    $fileTmpPath1 = $_FILES['photo']['tmp_name'];
    
    $fileSize1 = $_FILES['photo']['size'];
    $fileType1 = $_FILES['photo']['type'];
    $fileNameCmps1 = explode(".", $fileName1);
    $fileExtension1 = strtolower(end($fileNameCmps1));
    
    
    
    $newFileName1 = md5(time() . $fileName1) . '.' . $fileExtension1;
    $allowedfileExtensions1 = array('jpg', 'gif', 'png','jpeg');
    if (in_array($fileExtension1, $allowedfileExtensions1))
    {
    $uploadFileDir1 = "../images/project/"; 
    $dest_path1 = $uploadFileDir1 . $newFileName1;

    list($width, $height, $type, $attr) = getimagesize($fileTmpPath1);
       
    
    if($width=="387" && $height=="400" or $width=="595" && $height=="400")
    {
    
    
    move_uploaded_file($fileTmpPath1, $dest_path1);
  
    $res2=mysqli_query($db,"UPDATE addpjt SET image='$newFileName1'WHERE id='$id' ");
    msg("Successfully updated","projects.php");
    }
    else
    {
    
    
        msg("Image Size should be in width - 387px & height - 400px or width=595 & height-400", "editpjt.php");
    }

}
else
{


    msg("Image extension should be jpg or png", "editpjt.php?id=$id");
}
}

if(isset($_FILES['photo1']['name']) && $_FILES['photo1']['name']!="")
{
    $fileTmpPath2 = $_FILES['photo1']['tmp_name'];
  
    $fileSize2 = $_FILES['photo1']['size'];
    $fileType2 = $_FILES['photo1']['type'];
    $fileNameCmps2 = explode(".", $fileName2);
    $fileExtension2 = strtolower(end($fileNameCmps2));
    $newFileName2 = md5(time() . $fileName2) . '.' . $fileExtension2;
    
    
    $allowedfileExtensions2 = array('jpg', 'gif', 'png','jpeg');
    if (in_array($fileExtension2, $allowedfileExtensions2))
    {
    $uploadFileDir2 = "../images/project/"; 
    $dest_path2 = $uploadFileDir2 . $newFileName2;

   
    list($width, $height, $type, $attr) = getimagesize($fileTmpPath2);
       
    
    if($width=="1220" && $height=="600")
    {
    
    
    move_uploaded_file($fileTmpPath2, $dest_path2);
  
    $res2=mysqli_query($db,"UPDATE addpjt SET img='$newFileName2'WHERE id='$id'");
    msg("Successfully updated","projects.php");
    }
    else
    {
    
    
        msg("Image Size should be in width - 1220px & height - 600px or width=595 & height-400", "editpjt.php");
    }

}
else
{


    msg("Image extension should be jpg or png", "editpjt.php?id=$id");
}
}
$ins=mysqli_query($db,"update addpjt set type='$a1',c1='$a2',c2='$a3',c3='$a4',c4='$a5',c5='$a6' where id='$id' ");
    
               msg("Successfully updated","projects.php");

}


?>


</div>
</div>
</div>
</div>
    









<div id="back-top" style="display: none;">
<a title="Go to Top" href="#">
<i class="ti-angle-up"></i>
</a>
</div>

<div class="footer_part">
                <div class="container-fluid">
                <div class="row">
                <div class="col-lg-12">
                <div class="footer_iner text-center">
                <p>2023 © Al Barsha Electronics LLC  - Designed by <a href="https://www.oracuz.com/">Oracuz</a></p>
                </div>
                </div>
                </div>
                </div>
                </div>
                </section>

<script src="js/jquery1-3.4.1.min.js"></script>

<script src="js/popper1.min.js"></script>

<script src="js/bootstrap.min.php"></script>

<script src="js/metisMenu.js"></script>

<script src="vendors/count_up/jquery.waypoints.min.js"></script>

<script src="vendors/chartlist/Chart.min.js"></script>

<script src="vendors/count_up/jquery.counterup.min.js"></script>

<script src="vendors/niceselect/js/jquery.nice-select.min.js"></script>

<script src="vendors/owl_carousel/js/owl.carousel.min.js"></script>

<script src="vendors/datatable/js/jquery.dataTables.min.js"></script>
<script src="vendors/datatable/js/dataTables.responsive.min.js"></script>
<script src="vendors/datatable/js/dataTables.buttons.min.js"></script>
<script src="vendors/datatable/js/buttons.flash.min.js"></script>
<script src="vendors/datatable/js/jszip.min.js"></script>
<script src="vendors/datatable/js/pdfmake.min.js"></script>
<script src="vendors/datatable/js/vfs_fonts.js"></script>
<script src="vendors/datatable/js/buttons.php5.min.js"></script>
<script src="vendors/datatable/js/buttons.print.min.js"></script>

<script src="vendors/datepicker/datepicker.js"></script>
<script src="vendors/datepicker/datepicker.en.js"></script>
<script src="vendors/datepicker/datepicker.custom.js"></script>
<script src="js/chart.min.js"></script>
<script src="vendors/chartjs/roundedBar.min.js"></script>

<script src="vendors/progressbar/jquery.barfiller.js"></script>

<script src="vendors/tagsinput/tagsinput.js"></script>

<script src="vendors/text_editor/summernote-bs4.js"></script>
<script src="vendors/am_chart/amcharts.js"></script>

<script src="vendors/scroll/perfect-scrollbar.min.js"></script>
<script src="vendors/scroll/scrollable-custom.js"></script>

<script src="vendors/vectormap-home/vectormap-2.0.2.min.js"></script>
<script src="vendors/vectormap-home/vectormap-world-mill-en.js"></script>

<script src="vendors/apex_chart/apex-chart2.js"></script>
<script src="vendors/apex_chart/apex_dashboard.js"></script>
<script src="vendors/echart/echarts.min.js"></script>
<script src="vendors/chart_am/core.js"></script>
<script src="vendors/chart_am/charts.js"></script>
<script src="vendors/chart_am/animated.js"></script>
<script src="vendors/chart_am/kelly.js"></script>
<script src="vendors/chart_am/chart-custom.js"></script>

<script src="js/dashboard_init.js"></script>
<script src="js/custom.js"></script>
</body>

<!-- Mirrored from demo.dashboardpack.com/sales.php/ by HTTrack Website Copier/3.x [XR&CO'2014], Wed, 15 Feb 2023 12:12:37 GMT -->
</html>
