Şuanki Dizin: /home/wwwdreamtechnolo/www/yashdeveloper.com/mis_software7_dts-unts/project/dashboard/ |
Şuanki Dosya : /home/wwwdreamtechnolo/www/yashdeveloper.com/mis_software7_dts-unts/project/dashboard/add-agent.php |
<?php require_once('lib/functions.php'); $db = new class_functions(); $flag = 0; if(!isset($_SESSION['current_login_admin'])) { header("Location:auth/signin.php"); } $aadhar_front=""; $aadhar_back =""; $pan_file=""; $profile_file=""; $other_one=""; $other_two=""; if(isset($_POST['submit_btn'])) { $agent_type = $_POST['agent_type']; $emp_code = $_POST['emp_code']; $full_name = $_POST['full_name']; $email_id = $_POST['email_id']; $mobile_no = $_POST['mobile_no']; $address = $_POST['address']; $password = $_POST['password']; $other = $_POST['other']; $user_id = $_POST['user_id']; function generateRandomString($length = 5) { $characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; $charactersLength = strlen($characters); $randomString = ''; for ($i = 0; $i < $length; $i++) { $randomString .= $characters[rand(0, $charactersLength - 1)]; } return $randomString; } $valid_formats = array("jpg","png","gif","bmp","jpeg","pdf","mp4","JPEG","JPG","BMP","PNG","GIF","PDF","MP4"); if(isset($_POST) and $_SERVER['REQUEST_METHOD'] == "POST") { $name = $_FILES['aadhar_front']['name']; $size = $_FILES['aadhar_front']['size']; if(strlen($name)) { list($txt, $ext) = explode(".", $name); if(in_array($ext,$valid_formats)) { $current_random_string = generateRandomString(); $aadhar_front = $name."-".$current_random_string.".".strtolower($ext); $tmp = $_FILES['aadhar_front']['tmp_name']; $img_Dir = "agents_documents/"; if(!file_exists($img_Dir)) { mkdir($img_Dir); } if(move_uploaded_file($tmp,$img_Dir.$aadhar_front)) { } else { $image_error = "failed" ; $flag = 1; } } else { $image_error = "Invalid file format"; $flag = 1; } } } if(isset($_POST) and $_SERVER['REQUEST_METHOD'] == "POST") { $name = $_FILES['aadhar_back']['name']; $size = $_FILES['aadhar_back']['size']; if(strlen($name)) { list($txt, $ext) = explode(".", $name); if(in_array($ext,$valid_formats)) { $current_random_string = generateRandomString(); $aadhar_back = $name."-".$current_random_string.".".strtolower($ext); $tmp = $_FILES['aadhar_back']['tmp_name']; $img_Dir = "agents_documents/"; if(!file_exists($img_Dir)) { mkdir($img_Dir); } if(move_uploaded_file($tmp,$img_Dir.$aadhar_back)) { } else { $image_error = "failed" ; $flag = 1; } } else { $image_error = "Invalid file format"; $flag = 1; } } } if(isset($_POST) and $_SERVER['REQUEST_METHOD'] == "POST") { $name = $_FILES['pan_file']['name']; $size = $_FILES['pan_file']['size']; if(strlen($name)) { list($txt, $ext) = explode(".", $name); if(in_array($ext,$valid_formats)) { $current_random_string = generateRandomString(); $pan_file = $name."-".$current_random_string.".".strtolower($ext); $tmp = $_FILES['pan_file']['tmp_name']; $img_Dir = "agents_documents/"; if(!file_exists($img_Dir)) { mkdir($img_Dir); } if(move_uploaded_file($tmp,$img_Dir.$pan_file)) { } else { $image_error = "failed" ; $flag = 1; } } else { $image_error = "Invalid file format"; $flag = 1; } } } if(isset($_POST) and $_SERVER['REQUEST_METHOD'] == "POST") { $name = $_FILES['profile_file']['name']; $size = $_FILES['profile_file']['size']; if(strlen($name)) { list($txt, $ext) = explode(".", $name); if(in_array($ext,$valid_formats)) { $current_random_string = generateRandomString(); $profile_file = $name."-".$current_random_string.".".strtolower($ext); $tmp = $_FILES['profile_file']['tmp_name']; $img_Dir = "agents_documents/"; if(!file_exists($img_Dir)) { mkdir($img_Dir); } if(move_uploaded_file($tmp,$img_Dir.$profile_file)) { } else { $image_error = "failed" ; $flag = 1; } } else { $image_error = "Invalid file format"; $flag = 1; } } } if(isset($_POST) and $_SERVER['REQUEST_METHOD'] == "POST") { $name = $_FILES['other_one']['name']; $size = $_FILES['other_one']['size']; if(strlen($name)) { list($txt, $ext) = explode(".", $name); if(in_array($ext,$valid_formats)) { $current_random_string = generateRandomString(); $other_one = $name."-".$current_random_string.".".strtolower($ext); $tmp = $_FILES['other_one']['tmp_name']; $img_Dir = "agents_documents/"; if(!file_exists($img_Dir)) { mkdir($img_Dir); } if(move_uploaded_file($tmp,$img_Dir.$other_one)) { } else { $image_error = "failed" ; $flag = 1; } } else { $image_error = "Invalid file format"; $flag = 1; } } } if(isset($_POST) and $_SERVER['REQUEST_METHOD'] == "POST") { $name = $_FILES['other_two']['name']; $size = $_FILES['other_two']['size']; if(strlen($name)) { list($txt, $ext) = explode(".", $name); if(in_array($ext,$valid_formats)) { $current_random_string = generateRandomString(); $other_two = $name."-".$current_random_string.".".strtolower($ext); $tmp = $_FILES['other_two']['tmp_name']; $img_Dir = "agents_documents/"; if(!file_exists($img_Dir)) { mkdir($img_Dir); } if(move_uploaded_file($tmp,$img_Dir.$other_two)) { } else { $image_error = "failed" ; $flag = 1; } } else { $image_error = "Invalid file format"; $flag = 1; } } } $isexist = $db->get_emp_code_exist_from_agent($user_id); if ($isexist == "") { if ($db->insert_new_agent($agent_type, $emp_code, $full_name, $email_id, $mobile_no, $address, $password, $other, $aadhar_front, $aadhar_back, $pan_file, $profile_file, $other_one, $other_two, $user_id)) { $flag = 1; } else { $flag = 3; echo '<script>alert ("Failed to insert new agent. Please try again.");</script>'; } } else { $flag = 2; echo '<script>alert ("User ID already exists. Please choose a different one.");</script>'; } } ?> <!doctype html> <html lang="en" dir="ltr"> <head> <?php require_once('header-common.php'); ?> </head> <body class=" "> <aside class="sidebar sidebar-default sidebar-white sidebar-base navs-rounded-all "> <div class="sidebar-header d-flex align-items-center justify-content-start"> <a href="index.php" class="navbar-brand"> <img src="images/<?php echo $logo; ?>" class="software_logo" style="height:90px; width:220px;" /> </a> <div class="sidebar-toggle" data-toggle="sidebar" data-active="true"> <i class="icon"> <svg width="20" height="20" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"> <path d="M4.25 12.2744L19.25 12.2744" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></path> <path d="M10.2998 18.2988L4.2498 12.2748L10.2998 6.24976" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></path> </svg> </i> </div> </div> <?php require_once('left-side.php'); ?> <div class="sidebar-footer"></div> </aside> <main class="main-content"> <?php require_once('navbar.php'); ?> <div class="conatiner-fluid content-inner mt-n5 py-0"> <div class="row"> <div class="col-sm-12"> <div class="card"> <?php if($flag ==1) { ?> <div class="mb-3 alert alert-left alert-success alert-dismissible fade show" role="alert" style="width:80%; margin:auto; margin-top:25px;"> <span>Advisor Record Saved Successfully</span> <button type="button" class="btn-close btn-close-white" data-bs-dismiss="alert" aria-label="Close"></button> </div> <?php } else if($flag==3) { ?> <div class="alert alert-warning d-flex align-items-center" role="alert" style="width:80%; margin:auto; margin-top:25px;"> <svg class="flex-shrink-0 bi me-2 icon-24" width="24" height="24"> <use xlink:href="#exclamation-triangle-fill" /> </svg> <div> Advisor Record Already Exist </div> </div> <?php } else if($flag ==3) { ?> <?php } ?> <div class="card-header d-flex justify-content-between flex-wrap"> <div class="header-title"> <h4 class="card-title mb-0">Add Advisor Record</h4> </div> <div class="card-body"> <div class="table-responsive"> <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" enctype="multipart/form-data"> <div class="row"> <div class="col-lg-6"> <label>Advisor Type</label> <br> <select style="margin-top: 10px;" class="form-control" name="agent_type" id="agent_type"> <option value="Select Agent Type">Select Advisor Type</option> <option value="Team Leader">Team Leader</option> <option value="Advisor">Advisor</option> <option value="Supervisor">Supervisor</option> </select> <span class="err" style="color: #E45056;" id="error_agent_type"></span> </div> <div class="col-lg-6"> <div class="form-group"> <label for="full-name" class="form-label">Advisor Code</label> <input type="text" name="emp_code" class="form-control" id="full-name" placeholder=" " required /> </div> </div> <div class="col-lg-6"> <div class="form-group"> <label for="full-name" class="form-label">User Id </label> <input type="text" name="user_id" class="form-control" id="full-name" placeholder=" " required /> </div> </div> <div class="col-lg-6"> <div class="form-group"> <label for="last-name" class="form-label">Advisor Full Name</label> <input type="text" name="full_name" class="form-control" id="last-name" placeholder=" " required /> </div> </div> <div class="col-lg-6"> <div class="form-group"> <label for="email" class="form-label">Advisor Email</label> <input type="email" name="email_id" class="form-control" id="email" placeholder=" " required /> </div> </div> <div class="col-lg-6"> <div class="form-group"> <label for="phone" class="form-label">Advisor Mobile No.</label> <input type="text" class="form-control" name="mobile_no" id="phone" placeholder=" " required /> </div> </div> <div class="col-lg-6"> <div class="form-group"> <label for="password" class="form-label">Advisor Address</label> <input type="text" class="form-control" name="address" id="password" placeholder=" " required /> </div> </div> <div class="col-lg-6"> <div class="form-group"> <label for="password" class="form-label">Password</label> <input type="password" name="password" class="form-control" id="password" placeholder=" " /> </div> </div> <div class="col-lg-6"> <div class="form-group"> <label for="other" class="form-label">Other</label> <input type="text" name="other" class="form-control" id="other" placeholder=" " /> </div> </div> <div class="col-lg-6"> <div class="form-group"> <label for="other" class="form-label">Other Description</label> <input type="text" name="otherd" class="form-control" id="other" placeholder=" " /> </div> </div> <div class="col-lg-6"> <div class="form-group"> <label for="other" class="form-label">Attach AadharCard-Front </label> <input type="file" name="aadhar_front" class="form-control" id="aadhar_front" placeholder=" " /> </div> </div> <div class="col-lg-6" > <div class="form-group"> <label for="other" class="form-label">Attach AadharCard-Back</label> <input type="file" name="aadhar_back" class="form-control" id="aadhar_back" placeholder="" /> </div> </div> <div class="col-lg-6"> <div class="form-group"> <label for="pan_file" class="form-label">Attach PAN </label> <input type="file" name="pan_file" class="form-control" id="pan_file" placeholder=" " /> </div> </div> <div class="col-lg-6"> <div class="form-group"> <label for="profile_file" class="form-label">Attach Profile </label> <input type="file" name="profile_file" class="form-control" id="profile_file" placeholder=" " /> </div> </div> <div class="col-lg-6"> <div class="form-group"> <label for="other1" class="form-label">Other </label> <input type="file" name="other_one" class="form-control" id="other1" placeholder=" " /> </div> </div> <div class="col-lg-6"> <div class="form-group"> <label for="other2" class="form-label">Other </label> <input type="file" name="other_two" class="form-control" id="other2" placeholder=" " /> </div> </div> </div> <div class="d-flex justify-content-center"> <input type="submit" name="submit_btn" id="submit_btn" class="btn btn-primary" value="Create New Advisor"> </div> <br /> </form> </div> </div> </div> </div> </div> </div> <!-- Library Bundle Script --> <script src="../assets/js/core/libs.min.js"></script> <!-- External Library Bundle Script --> <script src="../assets/js/core/external.min.js"></script> <!-- Widgetchart Script --> <script src="../assets/js/charts/widgetcharts.js"></script> <!-- mapchart Script --> <script src="../assets/js/charts/vectore-chart.js"></script> <script src="../assets/js/charts/dashboard.js" ></script> <!-- fslightbox Script --> <script src="../assets/js/plugins/fslightbox.js"></script> <!-- Settings Script --> <script src="../assets/js/plugins/setting.js"></script> <!-- Slider-tab Script --> <script src="../assets/js/plugins/slider-tabs.js"></script> <!-- Form Wizard Script --> <script src="../assets/js/plugins/form-wizard.js"></script> <!-- AOS Animation Plugin--> <script src="../assets/vendor/aos/dist/aos.js"></script> <!-- App Script --> <script src="../assets/js/hope-ui.js" defer></script> <style> .sidebar.sidebar-default .nav-link:not(.static-item).active , .sidebar.sidebar-default .nav-link:not(.static-item).active, .sidebar.sidebar-default .nav-link:not(.static-item)[aria-expanded=true] { background-color:#FE6600 !important; } </style> <script type="text/javascript"> $(document).ready(function(){ $("#submit_btn").click(function(){ $("#error_agent_type").text(""); var var_agent_type = $("#agent_type").val(); if(var_agent_type == "Select Agent Type"){ $("#error_agent_type").text("Select Agent Type"); $("#agent_type").focus(); return false; } }); }); </script> </body> </html>
Linux 65-254-81-4.cprapid.com 5.14.0-284.11.1.el9_2.x86_64 #1 SMP PREEMPT_DYNAMIC Tue May 9 05:49:00 EDT 2023 x86_64
Apache
65.254.81.4