Server IP : 128.199.20.84 / Your IP : 172.69.6.16 Web Server : Apache/2.4.41 (Ubuntu) System : Linux competent-maruti 5.4.0-128-generic #144-Ubuntu SMP Tue Sep 20 11:00:04 UTC 2022 x86_64 User : www-data ( 33) PHP Version : 8.0.20 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare, MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF Directory (0775) : /var/www/html/file_upload/../admin_panel/ |
[ Home ] | [ C0mmand ] | [ Upload File ] |
---|
<?php include('header.php'); include('left_sidebar.php'); $button=@$_GET["mode"]=="edit"? "Update": "Submit"; if(@$_GET["objID"]!="") { $CatRs=mysqli_query($con,"select * from tp_gallery where id='".$_GET["objID"]."'") ; $CatRow=mysqli_fetch_assoc($CatRs) ; } if($_POST["Submit"]=="Update") { extract($_POST); $cQuery="update tp_gallery set category_id='".mysqli_real_escape_string($con,$_REQUEST["category_id"])."', type='".mysqli_real_escape_string($con,$_REQUEST["type"])."', status='".mysqli_real_escape_string($con,$_REQUEST["status"])."'"; $cQuery.=" where id='".$_GET["objID"]."'" ; $RowCons=mysqli_query($con,$cQuery) or die(mysql_error()); if($RowCons) { $lastid= $_GET["objID"]; foreach ($_FILES["file"]["error"] as $key => $error) { if ($error == UPLOAD_ERR_OK ){ $name = $lastid.$_FILES['file']['name'][$key]; $target_dir = "../file_upload/gallery/"; $target = "file_upload/gallery/"; $sql2 = "INSERT INTO tp_gallery_image(pro_id,image) VALUES ('".$lastid."','".$target.$name."')"; $result2 = mysqli_query($con,$sql2) or die(mysqli_error($connection)); move_uploaded_file($_FILES['file']['tmp_name'][$key],$target_dir.$name); } } $_SESSION["msg"]="record is updated successfully "; header("location:view_gallery.php"); exit() ; } }else if(isset($_POST["Submit"])=="Submit") { extract($_POST); $cQuery="insert into tp_gallery set category_id='".mysqli_real_escape_string($con,$_REQUEST["category_id"])."', type='".mysqli_real_escape_string($con,$_REQUEST["type"])."', status='".mysqli_real_escape_string($con,$_REQUEST["status"])."'"; $RowCons=mysqli_query($con,$cQuery) or die(mysql_error()); if($RowCons) { $lastid= $con->insert_id; foreach ($_FILES["file"]["error"] as $key => $error) { if ($error == UPLOAD_ERR_OK ){ $name = $lastid.$_FILES['file']['name'][$key]; $target_dir = "../file_upload/gallery/"; $target = "file_upload/gallery/"; $sql2 = "INSERT INTO tp_gallery_image(pro_id,image) VALUES ('".$lastid."','".$target.$name."')"; $result2 = mysqli_query($con,$sql2) or die(mysqli_error($connection)); move_uploaded_file($_FILES['file']['tmp_name'][$key],$target_dir.$name); } } $_SESSION["msg"]="One Record Is Inserted "; header("location:view_gallery.php"); exit() ; } } ?> <!-- ============================================================== --> <!-- Page wrapper --> <!-- ============================================================== --> <div class="page-wrapper"> <!-- ============================================================== --> <!-- Container fluid --> <!-- ============================================================== --> <div class="container-fluid"> <!-- ============================================================== --> <!-- Bread crumb and right sidebar toggle --> <!-- ============================================================== --> <div class="row page-titles"> <div class="col-md-5 col-8 align-self-center"> <h3 class="text-themecolor">New Products gallery</h3> <ol class="breadcrumb"> <li class="breadcrumb-item"><a href="javascript:void(0)">Home</a></li> <li class="breadcrumb-item active">New Products gallery</li> </ol> </div> </div> <!-- ============================================================== --> <!-- End Bread crumb and right sidebar toggle --> <!-- ============================================================== --> <!-- ============================================================== --> <!-- Start Page Content --> <!-- ============================================================== --> <!-- Row --> <div class="row"> <div class="col-sm-12"> <div class="card"> <div class="card-body"> <h4 class="card-title">New Products gallery</h4> <form class="form" method="post" action="" enctype="multipart/form-data"> <?php if(isset($_SESSION["msg"])) { ?> <div class="alert alert-danger"> <?php echo $_SESSION["msg"]; ?> <button type="button" class="close" data-dismiss="alert" aria-label="Close"> <span aria-hidden="true">×</span> </button> </div> <?php unset($_SESSION["msg"]); } ?> <div class="form-group row"> <label for="example-search-input" class="col-2 col-form-label">Main Category</label> <div class="col-10"> <select class="custom-select col-12" id="inlineFormCustomSelect" name="category_id" required> <option value=""> --Select-- </option> <?php $CatRs2=mysqli_query($con,"select * from tp_category where status='1' order by category_id desc") ; while($categories=mysqli_fetch_assoc($CatRs2)){?> <option value='<?php echo $categories['id'];?>' <?php if($CatRow['category_id']==$categories['id']){ echo "Selected";}?>> <?php echo $categories['category_id'];?> - (<?php echo $categories['subcategory'];?>)</option>"; <?php } ?> </select> </div> </div> <div class="form-group row"> <label for="example-search-input" class="col-2 col-form-label">Type</label> <div class="col-10"> <select class="custom-select col-12" id="inlineFormCustomSelect" name="type" required> <!-- <option value='Full view' <?php if($CatRow['type']=='Full view'){ echo "Selected";}?>> Full view</option> --> <option value='Exterior' <?php if($CatRow['type']=='Exterior'){ echo "Selected";}?>> Exterior</option> <option value='Interior' <?php if($CatRow['type']=='Interior'){ echo "Selected";}?>> Interior</option> </select> </div> </div> <!-- <div class="form-group row"> <label for="example-tel-input" class="col-2 col-form-label">Title:</label> <div class="col-10"> <input class="form-control" type="text" name="album" value="<?php echo htmlspecialchars($CatRow["album"]);?>" id="example-tel-input" placeholder="title" > </div> </div> --> <div class="form-group row"> <label for="example-text-input" class="col-2 col-form-label">Image</label> <div class="col-7"> <input class="form-control" type="file" id="example-file-input" name="file[]" multiple> </div> </div> <div class="form-group row"> <label for="example-text-input" class="col-2 col-form-label"></label> <div class="col-10"> <?php $query2 = mysqli_query($con,"SELECT * FROM tp_gallery_image where pro_id='".$CatRow["id"]."'"); while($CatRow2 = mysqli_fetch_array($query2)){ ?> <div class="col-2 imgss"> <img src="../<?=$CatRow2["image"];?>" height="80"> </div> <?php } ?> </div> </div> <div class="form-group row"> <label for="example-search-input" class="col-2 col-form-label">Status</label> <div class="col-10"> <select class="custom-select col-12" id="inlineFormCustomSelect" name="status" required> <?php if($CatRow['status']=='1'){ ?> <option value="1" selected >Active</option> <option value="0">Deactive</option> <?php }else if($CatRow['status']=='0'){?> <option value="0" selected >Deactive</option> <option value="1" >Active</option> <?php }else{ ?> <option value="1" selected>Active</option> <option value="0">Deactive</option> <?php } ?> </select> </div> </div> <input name="Submit" type="hidden" value="<?=$button;?>"/> <button type="submit" name="submit" class="btn btn-info waves-effect waves-light ">Submit</button> </form> </div> </div> </div> </div> <!-- ============================================================== --> <!-- End PAge Content --> <!-- ============================================================== --> <?php include('footer.php');?>