
PK 
<?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)){
//print_r($_FILES); exit;
$title = !empty($_POST['title'])?trim($_POST['title']):"";
$file = $_FILES['file'];
$error_msg = "";
$newfilename = uniqid('crlrmin-',false);
$foldername = "../uploads/circularsminutes/";
$imggg = $function->uploadPdfFile($newfilename, $foldername, 'file');
//print_r($imggg[2]); exit();
$pdodb = PDODB::getInstance();
//echo "cmdm"; exit;
$sql = "INSERT INTO tb_circulars_minutes SET title='".$title."',file='".$imggg[2]."'";
//print_r($sql); exit;
$result = $pdodb->query($sql);
//print_r($result); exit;
PDODB::closeInstance();
if($result) {
$error_msg = "Successfully Added.";
//header("Location: index.php");
}
}
?>
<!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 = 'circularsminutes-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 Circulars & Minutes 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($error_msg))?$error_msg:'';?>
<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="addCirculrmin">
<div class="col-sm-6 b-r">
<div class="form-group"><label>Title</label> <input type="text" placeholder="Enter Title" name="title" id="title" class="form-control">
</div>
<div class="form-group"><label>File Attact</label>
<input type="file" id="file" class="btn btn-primary" name="file">
</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">
$("#addCirculrmin").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