
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);
require_once '../includes/settings/PDODB.php';
include '../includes/modules/functions.php';
$function = new FUNCTIONS();
if(empty($_SESSION['adminId'])){
header("Location: ../index.php");
exit();
}
if(isset($_POST['btnAddUsr'])){
//print_r($_POST); exit;
$username= !empty($_POST['username'])?trim($_POST['username']):"";
$mobile= !empty($_POST['mobile'])?trim($_POST['mobile']):"";
$email= !empty($_POST['email'])?trim($_POST['email']):"";
$pdodb = PDODB::getInstance();
$sql = "INSERT INTO `users` SET username='$username', mobile='$mobile', email='$email'"; //exit;
$result = $pdodb->query($sql);
if ($result == true) {
$error_msg = "Successfully Added.";
}
}
?>
<!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'; ?>
<link href="../css/plugins/switchery/switchery.css" rel="stylesheet">
</head>
<body>
<div id="wrapper">
<?php $currentPage = 'user-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-8">
<h2>Create New User</h2>
</div>
</div>
<div class="row">
<div class="col-lg-8">
<div class="ibox float-e-margins">
<div class="ibox-title back-change">
</div>
<div class="ibox-title back-change">
<?php if (!empty($error_msg)) { ?>
<div class="alert alert-success" id="alert-success">
<a href="#" class="close" data-dismiss="alert" aria-label="close" title="close">×</a>
<strong><?=$error_msg;?></strong>
</div>
<?php } ?>
</div>
<div class="ibox-content">
<div class="row">
<form method="POST" action="" enctype="multipart/form-data" id="addUser">
<div class="col-sm-6">
<div class="form-group">
<label>Name *</label>
<input type="text" placeholder="Name" name="username" id="username" class="form-control">
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
<label>Mobile Number*</label>
<input type="text" placeholder="Mobile Number" name="mobile" id="mobile" class="form-control">
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
<label>Email ID</label>
<input type="text" placeholder="Email ID" name="email" id="email" class="form-control">
</div>
</div>
<div class="col-sm-12">
<div class="form-group">
<div>
<button class="btn btn-lg btn-danger pull-right m-t-n-xs" name="btnAddUsr" id="btnAddUsr" type="submit"><strong>SUBMIT</strong></button>
</div>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
<?php include_once '../layout/script.php'; ?>
<!-- Switchery -->
<script src="../js/plugins/switchery/switchery.js"></script>
<!-- Page-Level Scripts -->
<script type="text/javascript">
$("#addUser").validate({
rules: {
username: {
required: true
},
mobile: {
required: true,
minlength: 10,
maxlength: 10,
digits: true
}
},
messages: {
username: {
required: "Please Enter Name"
},
mobile: {
required: "Please enter mobile No",
minlength: "Mobile No Must Contain at least 10 digit",
maxlength: "Mobile No Must Not Exceed 10 digit",
digits: "Please enter only digit"
}
},
submitHandler: function(form) {
form.submit();
}
});
$("#successmsg").delay(5000).fadeOut();
</script>
</body>
</html>


PK 99