Current File : /home/users/kundensystem/www/admin/admin_role.php
<?php
include './inc/header.php';
include './inc/sidebar.php';

if($adminData['role']!='1'){
    ?><script>location.href="index.php";</script><?php
    exit;
}

$msg='';
if(isset($_POST['rand'])&&$_SESSION['rand']==$_POST['rand']){
    mysqli_query($conn, "UPDATE ".$dbtablex001." 
                            SET lizenz   = '".(isset($_POST['co_lizenz']) ? 1 : 0)."',
                                shop     = '".(isset($_POST['co_shop']) ? 1 : 0)."',
                                script   = '".(isset($_POST['co_script']) ? 1 : 0)."',
                                contact  = '".(isset($_POST['co_contact']) ? 1 : 0)."',
                                system   = '".(isset($_POST['co_system']) ? 1 : 0)."',
                                other    = '".(isset($_POST['co_other']) ? 1 : 0)."',
                                service  = '".(isset($_POST['co_service']) ? 1 : 0)."',
                                cms      = '".(isset($_POST['co_cms']) ? 1 : 0)."',
                                backup      = '".(isset($_POST['co_backup']) ? 1 : 0)."',
                                products      = '".(isset($_POST['co_products']) ? 1 : 0)."'
                            WHERE role = '2'"
                );

    mysqli_query($conn, "UPDATE ".$dbtablex001." 
                            SET lizenz   = '".(isset($_POST['re_lizenz']) ? 1 : 0)."',
                                shop     = '".(isset($_POST['re_shop']) ? 1 : 0)."',
                                script   = '".(isset($_POST['re_script']) ? 1 : 0)."',
                                contact  = '".(isset($_POST['re_contact']) ? 1 : 0)."',
                                system   = '".(isset($_POST['re_system']) ? 1 : 0)."',
                                other    = '".(isset($_POST['re_other']) ? 1 : 0)."',
                                service  = '".(isset($_POST['re_service']) ? 1 : 0)."',
                                cms      = '".(isset($_POST['re_cms']) ? 1 : 0)."',
                                backup      = '".(isset($_POST['re_backup']) ? 1 : 0)."',
                                products      = '".(isset($_POST['re_products']) ? 1 : 0)."'
                            WHERE role = '3'"
                );

    $msg='<div class="alert alert-success alert-dismissible fade show"><b>Hinweis</b>: Userrechte wurde erfolgreich geändert!</div>';
}

$coData = mysqli_fetch_assoc(mysqli_query($conn, "SELECT * FROM ".$dbtablex001." WHERE role='2'"));
$reData = mysqli_fetch_assoc(mysqli_query($conn, "SELECT * FROM ".$dbtablex001." WHERE role='3'"));
?>

<main id="main" class="main">

    <div class="pagetitle">
      <h1>Rechte verwalten</h1>
      <nav>
        <ol class="breadcrumb">
          <li class="breadcrumb-item"><a href="index.php">Home</a></li>
          <li class="breadcrumb-item">Rechte verwalten</li>
          <li class="breadcrumb-item">Rechte verwalten</li>
        </ol>
      </nav>
    </div><!-- End Page Title -->

    <section class="section dashboard">
        <div class="row">
            <div class="col-lg-2"> </div>
            <div class="col-lg-8"> 
                <div class="card">
                    <div class="card-body">
                        <h5 class="card-title">Rechte verwalten</h5>

                        <?php if($msg!='') echo $msg; ?>

                        <form class="form-horizontal" method="post" enctype="multipart/form-data">
                            <div class="row m-bot15">
                                <div class="col-lg-12 m-bot15">Co-Admin</div>
                                <div class="col-lg-4">
                                    <div class="form-check form-switch">
                                        <input class="form-check-input" type="checkbox" id="co_lizenz" name="co_lizenz" <?php if($coData['lizenz']=='1') echo 'checked';?>>
                                        <label class="form-check-label" for="co_lizenz">Lizenz</label>
                                    </div>                                
                                </div>
                                <div class="col-lg-4">
                                    <div class="form-check form-switch">
                                        <input class="form-check-input" type="checkbox" id="co_shop" name="co_shop" <?php if($coData['shop']=='1') echo 'checked';?>>
                                        <label class="form-check-label" for="co_shop">Shops</label>
                                    </div>                                
                                </div>
                                <div class="col-lg-4">
                                    <div class="form-check form-switch">
                                        <input class="form-check-input" type="checkbox" id="co_script" name="co_script" <?php if($coData['script']=='1') echo 'checked';?>>
                                        <label class="form-check-label" for="co_script">Scripte</label>
                                    </div>                                
                                </div>
                                <div class="col-lg-4">
                                    <div class="form-check form-switch">
                                        <input class="form-check-input" type="checkbox" id="co_contact" name="co_contact" <?php if($coData['contact']=='1') echo 'checked';?>>
                                        <label class="form-check-label" for="co_contact">Kontaktanfragen</label>
                                    </div>                                
                                </div>
                                <div class="col-lg-4">
                                    <div class="form-check form-switch">
                                        <input class="form-check-input" type="checkbox" id="co_system" name="co_system" <?php if($coData['system']=='1') echo 'checked';?>>
                                        <label class="form-check-label" for="co_system">System-Einstellungen</label>
                                    </div>                                
                                </div>
                                <div class="col-lg-4">
                                    <div class="form-check form-switch">
                                        <input class="form-check-input" type="checkbox" id="co_other" name="co_other" <?php if($coData['other']=='1') echo 'checked';?>>
                                        <label class="form-check-label" for="co_other">Sonstiges</label>
                                    </div>                                
                                </div>
                                <div class="col-lg-4">
                                    <div class="form-check form-switch">
                                        <input class="form-check-input" type="checkbox" id="co_service" name="co_service" <?php if($coData['service']=='1') echo 'checked';?>>
                                        <label class="form-check-label" for="co_service">Service</label>
                                    </div>                                
                                </div>
                                <div class="col-lg-4">
                                    <div class="form-check form-switch">
                                        <input class="form-check-input" type="checkbox" id="co_cms" name="co_cms" <?php if($coData['cms']=='1') echo 'checked';?>>
                                        <label class="form-check-label" for="co_cms">Content-Editor</label>
                                    </div>                                
                                </div>
                                <div class="col-lg-4">
                                    <div class="form-check form-switch">
                                        <input class="form-check-input" type="checkbox" id="co_backup" name="co_backup" <?php if($coData['backup']=='1') echo 'checked';?>>
                                        <label class="form-check-label" for="co_backup">Backup</label>
                                    </div>                                
                                </div>
                                <div class="col-lg-4">
                                    <div class="form-check form-switch">
                                        <input class="form-check-input" type="checkbox" id="co_products" name="co_products" <?php if($coData['products']=='1') echo 'checked';?>>
                                        <label class="form-check-label" for="co_products">Products</label>
                                    </div>                                
                                </div>
                            </div>
                            <hr>
                            <div class="row m-bot15">
                                <div class="col-lg-12 m-bot15">Reseller</div>
                                <div class="col-lg-4">
                                    <div class="form-check form-switch">
                                        <input class="form-check-input" type="checkbox" id="re_lizenz" name="re_lizenz" <?php if($reData['lizenz']=='1') echo 'checked';?>>
                                        <label class="form-check-label" for="re_lizenz">Lizenz</label>
                                    </div>                                
                                </div>
                                <div class="col-lg-4">
                                    <div class="form-check form-switch">
                                        <input class="form-check-input" type="checkbox" id="re_shop" name="re_shop" <?php if($reData['shop']=='1') echo 'checked';?>>
                                        <label class="form-check-label" for="re_shop">Shops</label>
                                    </div>                                
                                </div>
                                <div class="col-lg-4">
                                    <div class="form-check form-switch">
                                        <input class="form-check-input" type="checkbox" id="re_script" name="re_script" <?php if($reData['script']=='1') echo 'checked';?>>
                                        <label class="form-check-label" for="re_script">Scripte</label>
                                    </div>                                
                                </div>
                                <div class="col-lg-4">
                                    <div class="form-check form-switch">
                                        <input class="form-check-input" type="checkbox" id="re_contact" name="re_contact" <?php if($reData['contact']=='1') echo 'checked';?>>
                                        <label class="form-check-label" for="re_contact">Kontaktanfragen</label>
                                    </div>                                
                                </div>
                                <div class="col-lg-4">
                                    <div class="form-check form-switch">
                                        <input class="form-check-input" type="checkbox" id="re_system" name="re_system" <?php if($reData['system']=='1') echo 'checked';?>>
                                        <label class="form-check-label" for="re_system">System-Einstellungen</label>
                                    </div>                                
                                </div>
                                <div class="col-lg-4">
                                    <div class="form-check form-switch">
                                        <input class="form-check-input" type="checkbox" id="re_other" name="re_other" <?php if($reData['other']=='1') echo 'checked';?>>
                                        <label class="form-check-label" for="re_other">Sonstiges</label>
                                    </div>                                
                                </div>
                                <div class="col-lg-4">
                                    <div class="form-check form-switch">
                                        <input class="form-check-input" type="checkbox" id="re_service" name="re_service" <?php if($reData['service']=='1') echo 'checked';?>>
                                        <label class="form-check-label" for="re_service">Service</label>
                                    </div>                                
                                </div>
                                <div class="col-lg-4">
                                    <div class="form-check form-switch">
                                        <input class="form-check-input" type="checkbox" id="re_cms" name="re_cms" <?php if($reData['cms']=='1') echo 'checked';?>>
                                        <label class="form-check-label" for="re_cms">Content-Editor</label>
                                    </div>                                
                                </div>
                                <div class="col-lg-4">
                                    <div class="form-check form-switch">
                                        <input class="form-check-input" type="checkbox" id="re_backup" name="re_backup" <?php if($reData['backup']=='1') echo 'checked';?>>
                                        <label class="form-check-label" for="re_backup">Backup</label>
                                    </div>                                
                                </div>
                                <div class="col-lg-4">
                                    <div class="form-check form-switch">
                                        <input class="form-check-input" type="checkbox" id="re_products" name="re_products" <?php if($reData['products']=='1') echo 'checked';?>>
                                        <label class="form-check-label" for="re_products">Products</label>
                                    </div>                                
                                </div>
                            </div>
                            <div class="text-center">
                                    <?php $rand=rand(); $_SESSION['rand']=$rand; ?>
                                    <input type="hidden" value="<?= $rand;?>" name="rand">
                                    <input type="submit" class="btn btn-primary" value="Rechte verwalten">
                            </div>
                        </form>

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

</main><!-- End #main -->

<?php
include_once './inc/footer.php';
?>
<script>
    $('.sub8 ul').addClass('show');
    $('.sub8 .nav-link').removeClass('collapsed');
</script>