PK

ADDRLIN : /home/questend/public_html/domains/rwa40.com/admin/gallery/
FLL :
Current File : /home/questend/public_html/domains/rwa40.com/admin/gallery/create.php

<?php
   ob_start();
   //error_reporting(E_ALL ^ E_NOTICE);
   @session_start();
   ini_set('allow_url_include',1);    
   date_default_timezone_set("Asia/Kolkata");
   set_time_limit(600);
   ini_set('max_execution_time',600);
   include '../includes/settings/constant.php';
   //include '../includes/settings/db.php';
   require_once '../includes/settings/PDODB.php';
   include '../includes/modules/functions.php';
   
   if (!empty($_SESSION['adminId']) && !empty($_SESSION['admin_role_id'])) {
     if($_SESSION['admin_role_id']==1){
      //header("Location: index.php");
    }elseif($_SESSION['admin_role_id']==2){
      header("Location: ../dashboard/index.php");
    }
   }else{
    header("Location: ../index.php");
    exit();
   }

   $function = new FUNCTIONS();
   
   if(isset($_POST['btnAddCrlrmin']) && !empty($_POST)){
        // Include the database configuration file
        //include_once 'dbConfig.php';
        //print_r($_FILES); exit;
        $title = !empty($_POST['title'])?trim($_POST['title']):"";
        // File upload configuration
        $targetDir = "../uploads/gallery/";
        $allowTypes = array('jpg','png','jpeg','gif');
        
        $statusMsg = $errorMsg = $insertValuesSQL = $errorUpload = $errorUploadType = '';
        if(!empty(array_filter($_FILES['files']['name']))){
            foreach($_FILES['files']['name'] as $key=>$val){              
                // File upload path
                $fileName = basename($_FILES['files']['name'][$key]);
                $targetFilePath = $targetDir . $fileName;
                
                // Check whether file type is valid
                $fileType = pathinfo($targetFilePath,PATHINFO_EXTENSION);
                if(in_array($fileType, $allowTypes)){                  
                    // Upload file to server
                    if(move_uploaded_file($_FILES["files"]["tmp_name"][$key], $targetFilePath)){
                        // Image db insert sql
                        $insertValuesSQL .= "('".$title."','".$fileName."', NOW()),";
                    }else{
                        $errorUpload .= $_FILES['files']['name'][$key].', ';
                    }
                }else{
                    $errorUploadType .= $_FILES['files']['name'][$key].', ';
                }
            }
            
            if(!empty($insertValuesSQL)){              
                $insertValuesSQL = trim($insertValuesSQL,',');
                // Insert image file name into database
                $pdodb = PDODB::getInstance();

                $sql = "INSERT INTO images (title, file_name, uploaded_on) VALUES $insertValuesSQL";
                //exit;
                $result = $pdodb->query($sql);

                //$insert = $pdodb->query("INSERT INTO images (file_name, uploaded_on) VALUES $insertValuesSQL");

                //exit;
                if($result){
                    $errorUpload = !empty($errorUpload)?'Upload Error: '.$errorUpload:'';
                    $errorUploadType = !empty($errorUploadType)?'File Type Error: '.$errorUploadType:'';
                    $errorMsg = !empty($errorUpload)?'<br/>'.$errorUpload.'<br/>'.$errorUploadType:'<br/>'.$errorUploadType;
                    $statusMsg = "Files are uploaded successfully.".$errorMsg;
                }else{
                    $statusMsg = "Sorry, there was an error uploading your file.";
                }
            }
        }else{
            $statusMsg = 'Please select a file to upload.';
        }        
        // Display status message
        //echo $statusMsg;
    }
?>
<!DOCTYPE html>
<html>
   <head>
      <meta charset="utf-8">
      <meta name="viewport" content="width=device-width, initial-scale=1.0">
      <title>INSPINIA | Basic Form</title>
      <?php include_once '../layout/style.php'; ?>
   </head>
   <body>
      <div id="wrapper">
         <?php $currentPage = 'gallery-create'; include_once '../layout/side-bar.php'; ?>
         <div id="page-wrapper" class="gray-bg">
            <?php include_once '../layout/header.php'; ?>
            <div class="row wrapper border-bottom white-bg page-heading">
               <div class="col-lg-10">
                  <h2>Add Gallery Form</h2>                  
               </div>
               <div class="col-lg-2">
               </div>
            </div>           
            <div class="row">
               <div class="col-lg-12">
                <div class="ibox float-e-margins">
                    <div class="ibox-title  back-change">
                        <!-- <h5>Image cropper <small>http://fengyuanchen.github.io/cropper/</small></h5> -->
                        <p style="color:red; text-align: center;"><?=(!empty($statusMsg))?$statusMsg:'';?>
                        <div class="ibox-tools">
                            <a class="collapse-link">
                                <i class="fa fa-chevron-up"></i>
                            </a>
                            <a class="dropdown-toggle" data-toggle="dropdown" href="#">
                                <i class="fa fa-wrench"></i>
                            </a>
                            <ul class="dropdown-menu dropdown-user">
                                <li><a href="#">Config option 1</a>
                                </li>
                                <li><a href="#">Config option 2</a>
                                </li>
                            </ul>
                            <a class="close-link">
                                <i class="fa fa-times"></i>
                            </a>
                        </div>
                    </div>
                    <div class="ibox-content">
                        <div class="row">
                          <form method="POST" action="" enctype="multipart/form-data" id="addGallery">
                            <div class="col-sm-6 b-r">
                              <div class="form-group"><label>Gallery Title</label> <input type="text" placeholder="Enter Title" name="title" id="title" class="form-control">
                              </div>
                              <div class="form-group"><label>Select Images</label>
                                <input type="file" class="btn btn-primary" name="files[]" multiple>
                              </div>
                              <div>
                                <button class="btn btn-sm btn-primary pull-right m-t-n-xs" name="btnAddCrlrmin" id="btnAddCrlrmin" type="submit"><strong>Submit</strong></button>
                              </div>
                            </div>                           
                          </form>
                        </div>
                    </div>
                </div>
            </div>
            </div>
         </div>         
      </div>
      <?php include_once '../layout/script.php'; ?>
      <script>
         function tossterMsgAlert(msg='Welcome',title='') {
             toastr.options = {
                 closeButton: true,
                 //debug: false,
                 newestOnTop: false,
                 //progressBar: false,
                 positionClass: 'toast-top-center',
                 preventDuplicates: true,
                 //onclick: null,
                 //showDuration: 300,
                 //hideDuration: 1000,
                 timeOut: 2000,
                 //extendedTimeOut: 1000,
                 //showEasing: 'swing',
                 //hideEasing: 'linear',
                 //showMethod: 'fadeIn',
                 hideMethod: 'fadeOut'
             };
             toastr.warning(title,msg);
         }
      </script>
      <script type="text/javascript">     
        $("#addGallery").validate({
          rules: {
              title: {
                  required: true
              },
              file: {
                  required: true
              }
          },
          messages: {
              title: {
                  required: "Please Enter News Title"
              },
              file: {
                  required: "Please Upload Photo"
              }       
          },
          submitHandler: function(form) { 
            form.submit();
          }   
        });
      </script>
   </body>
</html>


PK 99
E-SHOP || DASHBOARD
404

Page Not Found

It looks like you found a glitch in the matrix...

← Back to Home