MMCT TEAM
Server IP : 103.53.40.154  /  Your IP : 3.146.152.119
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/generalmotorsju.com/wknadmin/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /home2/ppcad7no/generalmotorsju.com/wknadmin/sub_user_list.php
<?php
ob_start();
require_once("../includes/dbsmain.inc.php");
if(isset($_POST['Delete'])){
	$arr_ids = $_REQUEST['arr_p_id'];
	if(is_array($arr_ids)) {
		$str_ids = implode(',', $arr_ids); 
			db_query("delete from tbl_admin where admin_id in ($str_ids)");
	}
	header("Location: ".$_SERVER['HTTP_REFERER']);
	exit;
}
if(isset($_POST['Activate'])){
	$arr_ids = $_REQUEST['arr_p_id'];
	if(is_array($arr_ids)) {
		$str_ids = implode(',', $arr_ids); 
			db_query("update tbl_admin set admin_status = 'Active' where admin_id in ($str_ids)");
	}
	header("Location: ".$_SERVER['HTTP_REFERER']);
	exit;
}

if(isset($_POST['Deactivate'])){
	$arr_ids = $_REQUEST['arr_p_id'];
	if(is_array($arr_ids)) {
		$str_ids = implode(',', $arr_ids); 
			db_query("update tbl_admin set admin_status = 'Inactive' where admin_id in ($str_ids)");
	}
	header("Location: ".$_SERVER['HTTP_REFERER']);
	exit;
}

if($submit=='Create'){
@extract($_POST);
 if(isset($_GET['id'])){ 
if(is_array($access)){ $acc_type=implode(",",$access); }
    $sql="update tbl_admin set 
	         admin_password = '$admin_password',
			 admin_userid='$admin_userid',
			 admin_access='$acc_type',
			 admin_add_date=now(),
			 admin_user_type='$admin_user_type' 
			 where admin_id= '$_GET[id]'";
             db_query($sql);
			 set_session_msg("Record updated successfully.");
             header("Location:sub_user_list.php");
             exit;
}else{
@extract($_POST);
$cntUser=db_scalar("select count(*) from tbl_admin where 1 and admin_userid='$_POST[admin_userid]'");
 if($cntUser > 0){
    set_session_msg("Sorry ! user already exist.");
 }else{
 if(is_array($access)){ $acc_type=implode(",",$access); }
    $sql="insert into tbl_admin set 
	         admin_password ='$admin_password',
			 admin_access='$acc_type',
			 admin_userid='$admin_userid',
			 admin_add_date=now(),
			 admin_user_type='$admin_user_type'";
			 db_query($sql);
			 set_session_msg("Record added successfully.");
			 header("Location:sub_user_list.php");
			 exit;
    }
  }
}     
if(isset($_GET[id])){
$sql="select * from tbl_admin where admin_id='$_GET[id]'";
$result2=db_query($sql);
$data_new=mysqli_fetch_array($result2);
}
?>
<link href="styles.css" rel="stylesheet" type="text/css">
<script language="JavaScript" type="text/javascript" src="../includes/general.js"></script>
<script language="javascript" type="text/javascript">
function select_one(){

if(document.getElementById('admin_userid').value==0){		
alert("Enter Username !");
document.getElementById('admin_userid').focus();
return false;
}
if(document.getElementById('admin_password').value==0){		
alert("Enter Password !");
document.getElementById('admin_password').focus();
return false;
}

var chks = document.getElementsByName('access[]');
var hasChecked = false;
for (var i = 0; i < chks.length; i++){
if (chks[i].checked){
hasChecked = true;
break;
}else{
hasChecked = false;
}
}
if (hasChecked == false){
alert("Please select at least one access !");
return false;
}else{
return true;
}
}
</script>
<?php include("top.inc.php");?>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td id="pageHead"><div id="txtPageHead"> Sub Admin list </div></td>
  </tr>
</table>
<div style="font-size:13px;"><strong class="msg" style="margin-left:500px;">
  <?=display_sess_msg()?>
  </strong></div>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td id="content"><form method="post" name="form1" id="form1" onSubmit="confirm_submit(this)">
        <table width="100%"  border="0" cellpadding="0" cellspacing="1" class="tableList" style="border:1px outset #fff;">
          <tr>
            <th width="6%" nowrap="nowrap" style="font-size:12px; padding:9px;">Sl No</th>
            <th width="15%" nowrap="nowrap" style="font-size:12px; padding:9px;">Username</th>
            <th width="15%" nowrap="nowrap" style="font-size:12px; padding:9px;">Password</th>
            <th width="48%" nowrap="nowrap" style="font-size:12px; padding:9px;">Access</th>
            <th width="8%" nowrap="nowrap" style="font-size:12px; padding:9px;">Status</th>
            <th width="4%">&nbsp;</th>
            <th width="4%"><input name="check_all" type="checkbox" id="check_all" value="1" onClick="checkall(this.form)" /></th>
          </tr>
          <?php
						  $sql="select * from tbl_admin where admin_user_type!='Admin'";
						   $result=db_query($sql);
						   if(mysqli_num_rows($result)>0){
						   $k=0;
						   while($data=mysqli_fetch_array($result)){
						   @extract($data);
						   $k++;
						   $css = ($css=='trOdd')?'trEven':'trOdd';
						 ?>
          <tr class="<?=$css?>" align="center">
            <td style="font-size:12px;"><?=$k?></td>
            <td style="font-size:12px;"><?=$admin_userid?></td>
            <td style="font-size:12px;"><?=$admin_password?></td>
            <td style="font-size:11px;"><?php
							  $msg="";  
							  if(check_access("$data[admin_access]","1")=='true')
							  {  $msg.= "Manage Site Features,&nbsp;"; }
							  if(check_access("$data[admin_access]","2")=='true')
							  {  $msg.= "Manage Static Pages,&nbsp;"; }
							  if(check_access("$data[admin_access]","3")=='true')
							  {  $msg.= "Manage Category / Products,&nbsp;"; }
							  if(check_access("$data[admin_access]","4")=='true')
							  {  $msg.= "Manage Enquiry,&nbsp;"; }
							  if(check_access("$data[admin_access]","5")=='true')
							  {  $msg.= "Manage SEO Work,&nbsp;"; }
							  if(check_access("$data[admin_access]","6")=='true')
							  {  $msg.= "Manage Header,&nbsp;"; }
							  if(check_access("$data[admin_access]","7")=='true')
							  {  $msg.= "Manage Header Flash,&nbsp;"; }
							  if(check_access("$data[admin_access]","8")=='true')
							  {  $msg.= "Manage Video,&nbsp;"; }
							  if(check_access("$data[admin_access]","9")=='true')
							  {  $msg.= "Manage Gallery,&nbsp;"; }
							  if(check_access("$data[admin_access]","10")=='true')
							  {  $msg.= "Manage Footer,&nbsp;"; }
							  if(check_access("$data[admin_access]","11")=='true')
							  {  $msg.= "Manage Testimonials,&nbsp;"; }
							  if(check_access("$data[admin_access]","12")=='true')
							  {  $msg.= "Manage News,&nbsp;"; }
							  if(check_access("$data[admin_access]","13")=='true')
							  {  $msg.= "Manage Job Openings,&nbsp;"; }
							  if(check_access("$data[admin_access]","22")=='true')
							  {  $msg.= "Upload Catalog,&nbsp;"; }
							  if(check_access("$data[admin_access]","14")=='true')
							  {  $msg.= "Manage Contact,&nbsp;"; }
							  if(check_access("$data[admin_access]","15")=='true')
							  {  $msg.= "Change Admin Password,&nbsp;"; }
							  if(check_access("$data[admin_access]","16")=='true')
							  {  $msg.= "Manage Client Logo Page,&nbsp;"; }
							  if(check_access("$data[admin_access]","17")=='true')
							  {  $msg.= "Manage Certificate Page,&nbsp;"; }
							  if(check_access("$data[admin_access]","18")=='true')
							  {  $msg.= "Mng Inner Header Flash,&nbsp;"; }
							  if(check_access("$data[admin_access]","19")=='true')
							  {  $msg.= "Backup Site+Table,&nbsp;"; }
							  if(check_access("$data[admin_access]","20")=='true')
							  {  $msg.= "Manage Contact Us Map,&nbsp;"; }
							  if(check_access("$data[admin_access]","21")=='true')
							  {  $msg.= "Manage Site Down,&nbsp;"; }
							   print "$msg";
								?>
            </td>
            <td style="font-size:12px;"><b>
              <?=$admin_status?>
              </b></td>
            <td align="center" style="font-size:12px;"><a href="sub_user_list.php?id=<?=$admin_id?>"><img src="images/icons/edit.png" alt="Edit" width="16" height="16" border="0" /></a></td>
            <td align="center"><input type="checkbox" name="arr_p_id[]" value="<?=$data['admin_id']?>" /></td>
          </tr>
          <? } ?>
        </table>
        <table width="100%" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td align="right" style="padding:2px; padding-top:5px; padding-bottom:5px;"><input type="submit" name="Activate" value="Activate" class="button" onClick="return select_chk()" style="font-size:12px; font-weight:bold; height:26px; background-color:#1F3E00; border-radius:4px; cursor:pointer; width:100px;"/>
              <input type="submit" name="Deactivate" value="Deactivate" class="button" onClick="return select_chk()" style="font-size:12px; font-weight:bold; height:26px; background-color:#FF6F6F; border-radius:4px; cursor:pointer; width:100px;" />
              <input type="submit" name="Delete" value="Delete" class="button" onClick="return select_chk()" style="font-size:12px; font-weight:bold; height:26px; background-color:#CA0000; border-radius:4px; cursor:pointer; width:100px;"/>
            </td>
          </tr>
        </table>
        <? }else{ ?>
        <table width="100%" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td align="center" style="padding:20px;"><span style="font-size:15px; font-weight:bold; color:#CE0000;">No Sub Admin Found !</span></td>
          </tr>
        </table>
        <? } ?>
      </form>
      <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td colspan="2" class="tdLabel" id="pageHead"><div id="txtPageHead">Create Sub Admin </div></td>
        </tr>
        <form action="" method="post" name="form1" id="form1">
          <tr>
            <td class="tdLabel" align="right" style="padding:6px; padding-top:10px; font-size:12px; font-weight:bold; color:#004B97;">Admin Type : </td>
            <td style="padding:6px; padding-top:10px;"><select name="admin_user_type" style="width:220px; height:25px;">
                <option value="Sub Admin" selected="selected">Sub Admin</option>
              </select>
            </td>
          </tr>
          <tr>
            <td class="tdLabel" align="right" style="padding:6px; font-size:12px; font-weight:bold; color:#004B97;">Username : </td>
            <td style="padding:6px;"><input type="text" name="admin_userid" id="admin_userid" style="width:220px; height:25px;" value="<?=$data_new[admin_userid]?>"  /></td>
          </tr>
          <tr>
            <td class="tdLabel" align="right" style="padding:6px; font-size:12px; font-weight:bold; color:#004B97;">Password : </td>
            <td style="padding:6px;"><input type="text" id="admin_password" name="admin_password" style="width:220px; height:25px;" value="<?=$data_new[admin_password]?>">
            </td>
          </tr>
          <tr>
            <td valign="top" class="label" align="right" style=" font-size:12px; font-weight:bold; color:#004B97;"><span style="margin-right:7px;">Access :</span> </td>
            <td><table width="100%" border="0" cellspacing="0" cellpadding="2">
                <tr>
                  <td width="3%" scope="col"><input type="checkbox" name="access[]" <?php if(check_access("$data_new[admin_access]","1")=='true') { ?> checked="checked"<? } ?> value="1" /></td>
                  <td width="23%">Manage Site Features</td>
                  <td width="3%" scope="col"><input type="checkbox" name="access[]" value="2" <?php if(check_access("$data_new[admin_access]","2")=='true') { ?> checked="checked"<? } ?>/></td>
                  <td width="71%">Manage Static Pages</td>
                </tr>
                <tr>
                  <th scope="row"><input type="checkbox" name="access[]" value="3" <?php if(check_access("$data_new[admin_access]","3")=='true') { ?> checked="checked"<? } ?>/></th>
                  <td>Manage Category / Products</td>
                  <td><input type="checkbox" name="access[]" value="4" <?php if(check_access("$data_new[admin_access]","4")=='true') { ?> checked="checked"<? } ?>/></td>
                  <td>Manage Enquiry</td>
                </tr>
                <tr>
                  <th scope="row"><input type="checkbox" name="access[]" value="5" <?php if(check_access("$data_new[admin_access]","5")=='true') { ?> checked="checked"<? } ?>/></th>
                  <td>Manage SEO Work</td>
                  <td><input type="checkbox" name="access[]" value="6" <?php if(check_access("$data_new[admin_access]","6")=='true') { ?> checked="checked"<? } ?>/></td>
                  <td>Manage Header</td>
                </tr>
                <tr>
                  <th scope="row"><input type="checkbox" name="access[]" value="7" <?php if(check_access("$data_new[admin_access]","7")=='true') { ?> checked="checked"<? } ?>/></th>
                  <td>Manage Header Flash</td>
                  <td><input type="checkbox" name="access[]" value="8" <?php if(check_access("$data_new[admin_access]","8")=='true') { ?> checked="checked"<? } ?>/></td>
                  <td>Manage Video</td>
                </tr>
                <tr>
                  <th scope="row"><input type="checkbox" name="access[]" value="9" <?php if(check_access("$data_new[admin_access]","9")=='true') { ?> checked="checked"<? } ?>/></th>
                  <td>Manage Gallery</td>
                  <td><input type="checkbox" name="access[]" value="10" <?php if(check_access("$data_new[admin_access]","10")=='true') { ?> checked="checked"<? } ?>/></td>
                  <td>Manage Footer</td>
                </tr>
                <tr>
                  <th scope="row"><input type="checkbox" name="access[]" value="11" <?php if(check_access("$data_new[admin_access]","11")=='true') { ?> checked="checked"<? } ?>/></th>
                  <td>Manage Testimonials</td>
                  <td><input type="checkbox" name="access[]" value="12" <?php if(check_access("$data_new[admin_access]","12")=='true') { ?> checked="checked"<? } ?>/></td>
                  <td>Manage News</td>
                </tr>
                <tr>
                  <th scope="row"><input type="checkbox" name="access[]" value="13" <?php if(check_access("$data_new[admin_access]","13")=='true') { ?> checked="checked"<? } ?>/></th>
                  <td>Manage Job Openings</td>
                  <td><input type="checkbox" name="access[]" value="14" <?php if(check_access("$data_new[admin_access]","14")=='true') { ?> checked="checked"<? } ?>/></td>
                  <td>Manage Contact</td>
                </tr>
                <tr>
                  <th scope="row"><input type="checkbox" name="access[]" value="20" <?php if(check_access("$data_new[admin_access]","20")=='true') { ?> checked="checked"<? } ?>/></th>
                  <td>Manage Contact Us Map</td>
                  <td><input type="checkbox" name="access[]" value="21" <?php if(check_access("$data_new[admin_access]","21")=='true') { ?> checked="checked"<? } ?>/></td>
                  <td>Manage Site Down</td>
                </tr>
                <tr>
                  <th scope="row"><input type="checkbox" name="access[]" value="16" <?php if(check_access("$data_new[admin_access]","16")=='true') { ?> checked="checked"<? } ?>/></th>
                  <td>Manage Client Logo Page</td>
                  <td><input type="checkbox" name="access[]" value="17" <?php if(check_access("$data_new[admin_access]","17")=='true') { ?> checked="checked"<? } ?>/></td>
                  <td>Manage Certificate Page</td>
                </tr>
                <tr>
                  <th scope="row"><input type="checkbox" name="access[]" value="18" <?php if(check_access("$data_new[admin_access]","18")=='true') { ?> checked="checked"<? } ?>/></th>
                  <td>Mng Inner Header Flash</td>
                  <td><input type="checkbox" name="access[]" value="19" <?php if(check_access("$data_new[admin_access]","19")=='true') { ?> checked="checked"<? } ?>/></td>
                  <td>Backup Site+Table</td>
                </tr>
                <tr>
                  <th scope="row"><input type="checkbox" name="access[]" value="15" <?php if(check_access("$data_new[admin_access]","15")=='true') { ?> checked="checked"<? } ?>/></th>
                  <td>Change Admin Password</td>
                  <td><input type="checkbox" name="access[]" value="22" <?php if(check_access("$data_new[admin_access]","22")=='true') { ?> checked="checked"<? } ?>/></td>
                  <td>Upload Catalog</td>
                </tr>
                <tr>
                  <th scope="row"><input name="check_all" type="checkbox" id="check_all" value="check_all" onclick="checkall(this.form)" /></th>
                  <td><b>Select All</b></td>
                  <td>&nbsp;</td>
                  <td>&nbsp;</td>
                </tr>
              </table></td>
          </tr>
          <tr>
            <td class="label">&nbsp;</td>
            <td><input type="submit" value="Create" onclick="return select_one()" name="submit" class="button" style="font-size:14px; font-weight:bold; height:29px; background-color:#003264; border-radius:4px; cursor:pointer; width:100px; margin-bottom:20px; margin-left:7px; margin-top:5px;" />
            </td>
          </tr>
        </form>
      </table></td>
  </tr>
</table>
<?php include("bottom.inc.php");?>
<script language="javascript">
function select_chk(){
			var chks = document.getElementsByName('arr_p_id[]');
			var hasChecked = false;
			for (var i = 0; i < chks.length; i++){
			if (chks[i].checked){
				hasChecked = true;
				break;
				}
			}
			if (hasChecked == false){
			alert("Please Select At Least One.");
			return false;
			}
}
</script>

MMCT - 2023