MMCT TEAM
Server IP : 103.53.40.154  /  Your IP : 3.131.13.196
Web Server : Apache
System : Linux md-in-35.webhostbox.net 4.19.286-203.ELK.el7.x86_64 #1 SMP Wed Jun 14 04:33:55 CDT 2023 x86_64
User : ppcad7no ( 715)
PHP Version : 8.2.25
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON
Directory (0755) :  /home2/ppcad7no/biocareaqua.org/../agarsarbharat.com/../digitala2z.com/down-hrms/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /home2/ppcad7no/biocareaqua.org/../agarsarbharat.com/../digitala2z.com/down-hrms/add-user.php
<?php include("hr-header.php");?>
<?php
 $_SESSION['previousName'] = db_scalar("select admin_userid from tbl_admin where 1 and admin_id='$_REQUEST[userID]'");	
 if(isset($_POST['AddUserSubmit'])){
	 
	 $insSql = "insert into tbl_admin set
	             admin_name='$admin_name',
				 admin_mobile='$admin_mobile',
				 admin_userid='$admin_userid',
				 admin_password='$admin_password',
				 admin_user_type='Sub Admin',
				 admin_add_date='$crDate',
				 admin_status='$admin_status'";
				 db_query($insSql);
				 ?>
<script type="text/javascript">
			$(document).ready(function(e) {
				$("#AddSucc").show("slow");
            });
			</script>
<? } ?>
<?php
 if(isset($_POST['UpdateUserSubmit'])){
  
  $updateSql = "update tbl_admin set
	             admin_name='$admin_name',
				 admin_mobile='$admin_mobile',
				 admin_userid='$admin_userid',
				 admin_password='$admin_password',
				 admin_status='$admin_status',
				 admin_add_date='$crDate'
				 where 1 and admin_id='$_REQUEST[userID]'";
				 db_query($updateSql);
 $updatePSD = db_query("update party_statusdate set user_id='$admin_userid' where 1 and user_id='$_SESSION[previousName]'");
 $updateCAND = db_query("update tbl_candidates set candidates_user='$admin_userid' where 1 and candidates_user='$_SESSION[previousName]'");	
 $updateCOMNT = db_query("update tbl_comments set comment_user='$admin_userid' where 1 and comment_user='$_SESSION[previousName]'");			 
				 ?>
<script type="text/javascript">
			$(document).ready(function(e) {
				$("#AddSucc").show("slow");
            });
			</script>
<? } ?>
<?php if($_REQUEST['userID']!=''){ 
 $fetchSql =db_query("select * from tbl_admin where 1 and admin_id='".$_REQUEST['userID']."'");
  if(mysqli_num_rows($fetchSql)>0){
	  $data = mysqli_fetch_array($fetchSql);
  }
}
?>
<div class="container-fluid" style="margin-top:30px;">
  <div class="row">
    <div class="col-sm-12">
      <div class="col-sm-3" style="padding-left:0;">
        <?php include("hr-left-menu.php");?>
      </div>
      <div class="col-sm-9" id="ctID">
        <div class="row">
          <div class="col-sm-12">
            <div id="AddSucc" style="display:none;">
              <div class="alert alert-success"> <a href="#" class="close" data-dismiss="alert">&times;</a> <strong>Success ! Information updated successfully.</strong> </div>
            </div>
          </div>
        </div>
        <h3 class="page-header text-primary" style="margin-top:0;" id="faq-result">
          <?php if($_REQUEST['userID']==''){ ?>
          Add
          <? }else{ ?>
          Update
          <? } ?>
          User <small class="pull-right"><a href="manage-user.php">Back to Manage User</a></small> </h3>
        <div class="row">
          <div class="col-sm-12">
            <form class="form-horizontal" action="" method="post" enctype="multipart/form-data" onSubmit="return addUserValidate()">
              <div class="form-group">
                <label for="inputLoginid" class="control-label col-xs-3">Login Id</label>
                <div class="col-xs-9 col-sm-6">
                  <input type="text" name="admin_userid" id="admin_userid" <?php if($_REQUEST['userID']!=''){ ?>value="<?=$data['admin_userid']?>"<? } ?> class="form-control" id="inputLoginid">
                </div>
              </div>
              <div class="form-group">
                <label for="inputPassword" class="control-label col-xs-3">Login Password</label>
                <div class="col-xs-9 col-sm-6">
                  <input type="text" name="admin_password" id="admin_password" <?php if($_REQUEST['userID']!=''){ ?>value="<?=$data['admin_password']?>"<? } ?> class="form-control" id="inputPassword">
                </div>
              </div>
              <div class="form-group">
                <label for="inputName" class="control-label col-xs-3">Name</label>
                <div class="col-xs-9 col-sm-6">
                  <input type="text" name="admin_name" id="admin_name" <?php if($_REQUEST['userID']!=''){ ?>value="<?=$data['admin_name']?>"<? } ?> class="form-control" id="inputName">
                </div>
              </div>
              <div class="form-group">
                <label for="inputMobile" class="control-label col-xs-3">Mobile</label>
                <div class="col-xs-9 col-sm-6">
                  <input type="text" name="admin_mobile" id="admin_mobile" <?php if($_REQUEST['userID']!=''){ ?>value="<?=$data['admin_mobile']?>"<? } ?> class="form-control" id="inputMobile">
                </div>
              </div>
              <div class="form-group">
                <label for="inputEmp" class="control-label col-xs-3">Status</label>
                <div class="col-xs-9 col-sm-6">
                  <select class="form-control" name="admin_status" id="admin_status">
                    <option value="Active" selected>Active</option>
                    <option value="Inactive" <?php if($data['admin_status']=='Inactive'){ ?> selected<? } ?>>Inactive</option>
                  </select>
                </div>
              </div>
              <div class="form-group">
                <div class="col-xs-offset-3 col-xs-9">
                  <?php if($_REQUEST['userID']==''){ ?>
                  <button type="submit" name="AddUserSubmit" class="btn btn-primary btn-md">Add User</button>
                  <? }else{ ?>
                  <button type="submit" name="UpdateUserSubmit" class="btn btn-primary btn-md">Update User</button>
                  <? } ?>
                </div>
              </div>
            </form>
          </div>
        </div>
      </div>
    </div>
  </div>
</div>
<script type="text/javascript">
function addUserValidate(){	
   function trim(str){				
	 return str.replace(/^\s*|\s*$/g,'');
	}	
var loginID=trim(document.getElementById('admin_userid').value);
if(loginID=='')
  {
	  alert("Enter login Id !");
	  document.getElementById('admin_userid').focus();
	  return false;
  }
var loginPass=trim(document.getElementById('admin_password').value);
if(loginPass=='')
  {
	  alert("Enter login password !");
	  document.getElementById('admin_password').focus();
	  return false;
  }  	
var loginName=trim(document.getElementById('admin_name').value);
if(loginName=='')
  {
	  alert("Enter user name !");
	  document.getElementById('admin_name').focus();
	  return false;
  }
var mobno=trim(document.getElementById('admin_mobile').value);
if(trim(document.getElementById('admin_mobile').value)==0){
	alert("Enter user mobile no.!");
	document.getElementById('admin_mobile').focus();
	return false;
}
if(isNaN(document.getElementById('admin_mobile').value)){
	alert("Mobile no. should be no.!");
	document.getElementById('admin_mobile').focus();
	return false;
}
if(mobno.length < 10){
    alert("Mobile no. should be 10 digit long !");
	document.getElementById('admin_mobile').focus();
	return false;
}	
}
</script>
<?php include("hr-footer.php");?>

MMCT - 2023