MOON
Server: Apache
System: Linux nserver.cafsindia.com 4.18.0-553.104.1.lve.el8.x86_64 #1 SMP Tue Feb 10 20:07:30 UTC 2026 x86_64
User: cafsindia (1002)
PHP: 8.2.30
Disabled: NONE
Upload Files
File: /home/cafsindia/refimac_cafsjobs_com/user_create.php
<script type="text/JavaScript">
<!--

function randomPassword(length)
{
  chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNPQRSTUVWXYZ123456789";
  pass = "";
  for(x=0;x<length;x++)
  {
    i = Math.floor(Math.random() * 62);
    pass += chars.charAt(i);
  }
  return pass;
}
function formSubmit()
{
  document.getElementById('password').value = randomPassword(8);
  return false;
}

function getuser()
{
  var user=document.getElementById('user_name').value;
  location.href="home.php?mid=<?php echo $mid;?>&smid=<?php echo $smid;?>&pid=<?php echo $pid;?>&id="+user+"&up=1";
}


function frmgetlevel()
{
  var user=document.getElementById('user_name').value;
  var pass=document.getElementById('password').value;
 // var img_auth=document.getElementById('img_auth').value;
  var permission=document.getElementById('permission').value;
  <?php $encode1=base64_encode(time());$encode1=$encode1.base64_encode(time());$encode1=$encode1.base64_encode(time());$encode1=$encode1.base64_encode(time());?>
  location.href="landing.php?mid=<?php echo $mid;?>&smid=<?php echo $smid;?>&pid=<?php echo $pid;?>&pass=<?php echo $encode1;?>&permission="+permission+"&user="+user+"&pass="+pass+"&level=1";
}

function SetValues(Form, mCheckBox, CheckBox)
{
	var Value="";
	//if(document.form1.elements[mCheckBox].checked == false){
	//Value="true";}
	if(document.form1.elements[mCheckBox].checked == true) Value=true; else Value=false;
	
	var objCheckBoxes = document.form1.elements[CheckBox];
	var countCheckBoxes = objCheckBoxes.length;
	for(var i = 0; i < countCheckBoxes; i++)
	objCheckBoxes[i].checked = Value;
}


//-->
</script>
<script type="text/JavaScript">
<!--
function formget1()
{
var major_head = document.getElementById("menu").value;
if(major_head=="Other")
{
document.getElementById("menu1").disabled=false;
document.getElementById("menu1").value="";
}
else
{
document.getElementById("menu1").disabled=true;
document.getElementById("menu1").value="NIL";
}
}

function formget2()
{
var major_head = document.getElementById("submenu").value;
if(major_head=="Other")
{
document.getElementById("submenu1").disabled=false;
document.getElementById("submenu1").value="";
}
else
{
document.getElementById("submenu1").disabled=true;
document.getElementById("submenu1").value="NIL";
}
}

function formValidator(){
	// Make quick references to our fields
	var menu = document.getElementById('menu');
	var submenu = document.getElementById('submenu');
	var page_name = document.getElementById('page_name');

	// Check each input in the order that it appears in the form!
	
	if(madeSelection(menu, "Please Select Menu Name!")){
	if(madeSelection(submenu, "Please Select Submenu Name!")){
	if(notEmpty(page_name, "Please enter Page Name !")){
	return true;
	}
	}
	}
	return false;
}

function notEmpty(elem, helperMsg){
	if(elem.value.length == 0){
		alert(helperMsg);
		elem.focus(); // set the focus to this input
		return false;
	}
	return true;
}

function madeSelection(elem, helperMsg){
	if(elem.value == "Select"){
		alert(helperMsg);
		elem.focus();
		return false;
	}else{
		return true;
	}
}

//-->
</script>






 <div id="contentwrapper">
	    <div class="main_content">
       	  
		  
<?php
	$up=$_REQUEST['up'];
	$id=$_REQUEST['id'];
	$level=$_REQUEST['level'];
	$company=array();
	$mines=array();
	$pages=array();
	$trans=array();
	$trans1=array();
	$mms=array();
	$sms=array();
	
	$company=array();
	$etacompany=array();
	$branchs=array();
	$products=array();
	$pages=array();
	$trans1=array();
	
	if($up==1&&$id!="")
	{
		$sqlt="select * from serviceapp_login where user_name='".$id."'";
		$qut=mysql_query($sqlt);
		while($rt=mysql_fetch_array($qut))
		{
		$user_name=$rt['user_name'];
		$password=$rt['password'];
		$per1=$rt['per'];
		$img_auth=$rt['img_auth'];
		$comp=$rt['company'];
		$etacomp=$rt['etacompany'];
		$branch=$rt['branchs'];
		$product=$rt['products'];
		$page=$rt['pid'];
		$trans=$rt['trans'];
		$status1=$rt['status'];
		$company=explode(",",$comp);
		$etacompany=explode(",",$etacomp);
		$branchs=explode(",",$branch);
		$products=explode(",",$product);
		$pages=explode(",",$page);
		$trans1=explode(",",$trans);
		}
		foreach($pages as $value2)
		{
			$mmpage=str_split($value2, 2);
			$smpage=str_split($value2, 4);
			//echo $smpage[0].",";
			if(!in_array($mmpage[0],$mms)){$a1=array_push($mms,$mmpage[0]);}
			if(!in_array($smpage[0],$sms)){$a2=array_push($sms,$smpage[0]);}
		}
	}
	if($level==1)
	{
	$user_name=$_REQUEST['user'];
	$password=$_REQUEST['pass'];
	$per1=$_REQUEST['permission'];
	$img_auth=$_REQUEST['img'];
	if($per1!="")
	{
		$sqlt1="select * from 	serviceapp_levels where level_name='".$per1."' and status='Y'";
		$qut1=mysql_query($sqlt1);
		while($rt1=mysql_fetch_array($qut1))
		{
		$page=$rt1['pid'];
		$trans=$rt1['trans'];
		}
		$pages=explode(",",$page);
		$trans1=explode(",",$trans);
		foreach($pages as $value2)
		{
			$mmpage=str_split($value2, 2);
			$smpage=str_split($value2, 4);
			//echo $smpage[0].",";
			if(!in_array($mmpage[0],$mms)){$a1=array_push($mms,$mmpage[0]);}
			if(!in_array($smpage[0],$sms)){$a2=array_push($sms,$smpage[0]);}
		}
	}
	}

	?>
	                      <div class="page-head">
                                <div class="container">
                                    <!-- BEGIN PAGE TITLE -->
                                    <div class="page-title">
                                        <h1>User Creation                                          
                                        <small>Create your Users.</small></h1>
                                    </div>
                                   
                                </div>
                            </div>
                           
			 <div class="page-content">
                                <div class="container">
								
								<div class="row-fluid">
			<div class="span12">
				<?php 
				if($nav=="1"||$nav=="3")
				echo "<div class='alert alert-success'>
				<span>Given information successfully updated !</span>
				</div>";
				elseif($nav=="2"||$nav=="4"||$nav=="6")
				echo "<div class='alert alert-warning'>
				<span>sorry, given information not updated, please try again !</span>
				</div>";
				elseif($nav=="5")
				echo "<div class='alert alert-danger'>
				<span>Selected Record successfully deleted !</span>
				</div>";
				?>
			</div>
		  </div>

                                    
                                    <div class="page-content-inner">
				
				<form name="form1" action="<?php if($up==1)echo "up"; else echo "ad";?>d_details.php?mid=<?php echo $mid;?>&smid=<?php echo $smid;?>&pid=<?php echo $pid;?>" method="post">
					<div class="portlet light">
					  
						 <div class="row">
                          <div class="col-md-12">

								<div class="col-md-3">
											<label> User Name :</label>
											<input name="user_name" type="text" id="user_name" class="form-control required" value="<?php echo $user_name;?>" />
											<span class="help-block">Please enter new user name </span>									
											<input name="page_id" type="hidden"  value="<?php if($up==1) echo $id;?>" />
								</div>
								
									<div class="col-md-3">
											<label> Password :</label>
											<input name="password" type="text" class="form-control required :max_length;50" id="password" value="<?php echo $password;?>" />
								          <input type="button" name="Button" value=" Generate Password " onclick="formSubmit()" />
								            <span class="help-block">Please enter password </span>		
											
								   </div>
								   
								   <div class="col-md-3">
								   
								   
								 <label>  Access Privillage </label>                                
                                <select name="permission" class="form-control select2" id="permission" <?php if($up=="") echo "onchange='frmgetlevel()'";?>>
								<option value="">Select</option>
                                  <?php if($per=="Super Admin"){?>
                                  <option <?php if($per1=="Super Admin") echo "selected='selected'";?> value="Super Admin">Super Admin</option>
                                  <?php }?>
								  <?php
									$sql="select * from serviceapp_levels where status='Y' order by level_name";
									$qu=mysql_query($sql);
									while($r=mysql_fetch_array($qu))
									{
									?>
                                  <option <?php if($per1==$r['level_name']) echo "selected='selected'";?> value="<?php echo $r['level_name'];?>"><?php echo $r['level_name'];?></option>
                                  <?php }?>
								</select>                                		
											
								   </div>
								   
								   
								   
                       				  </div>
					      </div>
					 </div>
					
					<div class="portlet light">
						<div class="row-fluid">
						  <div class="span12">
						    <table width="977" class="table table-striped table-bordered" id="dt_d">
                             <thead>
                <tr>
                                  <th><div align="center">Module Name</div></th>
                                  <th><div align="center">Sub Module Name </div></th>
                                  <th><div align="center">Page Name </div></th>
                                  <th><div align="center"><span class=""></span>
                                  </div></th>
                                  <th><div align="center"><span class=""></span>
                                  </div></th>
                                  <th><div align="center"><span class=""></span>
                                  </div></th>
                                  <th><div align="center"><span class=""></span>
                                  </div></th>
                                  <th><div align="center"><span class=""></span>
                                  </div></th>
                                 </tr>
              </thead>
			   <tbody>
                                <?php
					  $l=1;
					  $sql1="select distinct(menu_name) from serviceapp_pages where status='Y' order by refer_name";
					  $qu1=mysql_query($sql1);
					  $i=1;
					  while($r1=mysql_fetch_array($qu1))
					  {
					  $sql2="select distinct(submenu_name) from serviceapp_pages where menu_name='".$r1['menu_name']."' and status='Y' order by refer_name";
					  //echo $sql2;
					  $qu2=mysql_query($sql2);
					  $j=1;
					  while($r2=mysql_fetch_array($qu2))
					  {
					  $sql3="select * from serviceapp_pages where menu_name='".$r1['menu_name']."' and submenu_name='".$r2['submenu_name']."' and status='Y' order by refer_name";
					  //echo $sql2;
					  $qu3=mysql_query($sql3);
					  $k=1;
					  while($r3=mysql_fetch_array($qu3))
					  {
					  $trans=explode("|",$r3['ava_trans']);
					  ?>
					 
                                <tr id="611307">
                                  <td nowrap="nowrap" class="table_text_11px"><div align="center">
                                      <?php if($j==1&&$k==1){?>
                                      <table width="100%" border="0" cellspacing="0" cellpadding="0">
                                        <tr>
                                          <td width="25%">
                                              <div align="left">
                                                <?php $mm="";?>
                                                <input type="checkbox" name="<?php echo "mm$i";?>" value="<?php if($i<=9)$mm="0$i"; else $mm="$i"; echo $mm;?>"  onclick="SetValues('form1','<?php echo "mm$i";?>', '<?php echo "sm$i";?>[]');" <?php if(in_array($mm,$mms))echo "checked='checked'";?>>
                                          <?php echo $r1['menu_name'];?></div></td>
                                        </tr>
                                      </table>
                                    <?php }?>
                                  </div></td>
                                  <td nowrap="nowrap" class="table_text_11px"><div align="left">
                                      <?php if($k==1){?>
                                      <table width="100%" border="0" cellpadding="0" cellspacing="0" class="tgrid3">
                                        <tr>
                                          <td width="24%">
                                              <div align="left">
                                                <?php $sm="";?>
                                                <input type="checkbox" name="<?php echo "sm$i";?>[]" value="<?php if($i<=9){$sm="0$i";}else{$sm="$i";}if($j<=9){$sm.="0$j";}else{$sm.="$j";}echo $sm;?>" <?php if(in_array($sm,$sms))echo "checked='checked'";?> />
                                          <?php echo $r2['submenu_name'];?></div></td>
                                        </tr>
                                      </table>
                                    <?php }?>
                                  </div></td>
                                  <td nowrap="nowrap" class="table_text_11px" ><div align="left">
                                      <table width="100%" border="0" cellspacing="0" cellpadding="0" class="tgrid3">
                                        <tr>
                                          <td width="15%">
                                              <div align="left">
                                                <?php $pn="";?>
                                                <input type="checkbox" name="pids[<?php echo "$l";?>]" id="pids[<?php echo "$l";?>]" value="<?php if($i<=9){$pn="0$i";}else{$pn="$i";}if($j<=9){$pn.="0$j";}else{$pn.="$j";}if($k<=9){$pn.="0$k";}else{$pn.="$k";}echo $pn;?>" <?php if(in_array($pn,$pages))echo "checked='checked'";?> />
                                          <?php echo $r3['page_name'];?></div></td>
                                        </tr>
                                      </table>
                                  </div></td>
                                  <td nowrap="nowrap" class="table_text_11px"><div align="center">
                                      <?php if($trans[0]=='Y'){?>
                                    <input name="<?php echo "opt$pn";?>[]" type="checkbox" value="<?php $pn1="$pn-I"; echo $pn1;?>" <?php if(in_array($pn1,$trans1))echo "checked='checked'";?> />
                                    <?php }?>
                                  </div></td>
                                  <td nowrap="nowrap" class="table_text_11px"><div align="center">
                                      <?php if($trans[1]=='Y'){?>
                                    <input name="<?php echo "opt$pn";?>[]" type="checkbox" value="<?php $pn2="$pn-U"; echo $pn2;?>" <?php if(in_array($pn2,$trans1))echo "checked='checked'";?> />
                                    <?php }?>
                                  </div></td>
                                  <td nowrap="nowrap" class="table_text_11px"><div align="center">
                                      <?php if($trans[2]=='Y'){?>
                                    <input name="<?php echo "opt$pn";?>[]" type="checkbox" value="<?php $pn3="$pn-D"; echo $pn3;?>" <?php if(in_array($pn3,$trans1))echo "checked='checked'";?> />
                                    <?php }?>
                                  </div></td>
                                  <td nowrap="nowrap" class="table_text_11px"><div align="center">
                                      <?php if($trans[3]=='Y'){?>
                                    <input name="<?php echo "opt$pn";?>[]" type="checkbox" value="<?php $pn4="$pn-V"; echo $pn4;?>" <?php if(in_array($pn4,$trans1))echo "checked='checked'";?> />
                                    <?php }?>
                                  </div></td>
                                  <td nowrap="nowrap" class="table_text_11px"><div align="center">
                                      <?php if($trans[4]=='Y'){?>
                                    <input name="<?php echo "opt$pn";?>1[]" type="checkbox" value="<?php $pn5="$pn-A"; echo $pn5;?>" onclick="SetValues('form1','<?php echo "opt$pn";?>1[]', '<?php echo "opt$pn";?>[]');" <?php if(in_array($pn5,$trans1))echo "checked='checked'";?> />
                                    <?php }?>
                                  </div></td>
                                </tr>
                                <?php
					$k++;
					$l++;
					}
					$j++;
					}
					$i++;
					}
					?>
                              </tbody>
                            </table>
						  </div>
						</div>
						 <div class="form-actions">
						<button class="btn btn-inverse" type="submit">Update this page</button>
						<button class="btn">Cancel</button>
					</div>
					  </div>
					  
					 
				</form>
				
				
				
				
				
                                        <div class="row portlet light">
										  <div class="col-md-12">
	
        <h3 class="heading">View / Search / Update Levels </h3>
		
			<table  class="table table-striped table-bordered table-hover dt-responsive" id="sample">
              <thead>
                <tr>
                  <th width="152"><div align="center">Username </div></th>
                  <th width="359"><div align="center">Password </div></th>
                  <th width="306"><div align="center">Access Level </div></th>
                  <th width="63"><div align="center">Update</div></th>
                  <th width="73"><div align="center">Delete</div></th>
                </tr>
              </thead>
              <?php
				$sql1="select * from serviceapp_login where status='Allowed' ";
				$qu1=mysql_query($sql1);
				$i=1;
				while($rd=mysql_fetch_array($qu1))
				{
				?>
              <tbody>
                <tr>
                  <td nowrap="nowrap"><div align="center" class="table_text_12px1"><?php echo $rd['user_name'];?></div></td>
				  <td nowrap="nowrap"><div align="center" class="table_text_12px1"><?php echo "*****";?></div></td>
                  <td nowrap="nowrap"><div align="center" class="table_text_12px1"><?php echo $rd['per'];?></div></td>
                  <td nowrap="nowrap"><div align="center" class="table_text_12px1"><?php echo $rd['update_time'];?></div></td>
                  <td nowrap="nowrap"><div align="center" class="table_text_12px1"><a href="landing.php?smid=<?php echo $smid;?>&pid=<?php echo $pid;?>&amp;id=<?php echo $rd['user_name'];?>&amp;up=1"><i class="icon-pencil"></i></a></div></td>
                  <td nowrap="nowrap"><div align="center" class="table_text_12px1"><a href="del_detail.php?mid=<?php echo $mid;?>&smid=<?php echo $smid;?>&pid=<?php echo $pid;?>&amp;id=<?php echo $rd['user_name'];?>" onclick="return confirm('Are you sure you wish to delete this user account?')"><i class="icon-trash"></i></a></div></td>
                </tr>
                <?php
				}
				?>
              </tbody>
            </table>
		    </div>
			</div>
	    
				
								</div>
						 </div>

		</div>
</div>
</div>

  
<script>

$(document).ready(function()
{
if ( $.fn.dataTable.isDataTable( '#sample' ) ) {
    table = $('#sample').DataTable();
}
else {
    table = $('#sample').DataTable( {
      dom: 'Bfrtip',
        buttons: [
            'copy', 'csv', 'excel', 'pdf', 'print'
        ]
    } );
}
});

</script>