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/access_level.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?pid=9_2&id="+user+"&up=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'];
	$pages=array();
	$trans=array();
	$trans1=array();
	$mms=array();
	$sms=array();
	if($up==1&&$id!="")
	{
		$sqlt="select * from serviceapp_levels where level_name='".$id."'";
		$qut=mysql_query($sqlt);
		while($rt=mysql_fetch_array($qut))
		{
		$per1=$rt['level_name'];
		$page=$rt['pid'];
		$trans=$rt['trans'];
		$status1=$rt['status'];
		$company=explode(",",$comp);
		$mines=explode(",",$mine);
		$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>Access Levels                                         
                                        <small>Create your custom roles.</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-4">
																<label>Access Privilege  Name :</label>
																<input name="permission" type="text" id="permission" class="form-control required" value="<?php echo $per1;?>" <?php if($up==1) echo "disabled='disabled'";?> />
																 <span class="help-block">
                        <input name="per1" type="hidden" id="per1" value="<?php echo $per1;?>"  />
                        Please enter user access privillage level </span>		
																	 </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"><i class="icon-plus"></i>
                                  </div></th>
                                  <th><div align="center"><i class="icon-pencil"></i>
                                  </div></th>
                                  <th><div align="center"><i class="icon-trash"></i>
                                  </div></th>
                                  <th><div align="center"><i class="icon-shield"></i>
                                  </div></th>
                                  <th><div align="center"><i class="icon-user"></i>
                                  </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">Access Level Name </div></th>
                  <th width="359"><div align="center">Update By  </div></th>
                  <th width="306"><div align="center">Update Time </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_levels where status='Y' order by level_name";
				$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['level_name'];?></div></td>
                  <td nowrap="nowrap"><div align="center" class="table_text_12px1"><?php echo $rd['update_by'];?></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['level_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['level_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>