!C99Shell v. 2.5 [PHP 8 Update] [24.05.2025]!

Software: Apache/2.4.41 (Ubuntu). PHP/8.0.30 

uname -a: Linux apirnd 5.4.0-204-generic #224-Ubuntu SMP Thu Dec 5 13:38:28 UTC 2024 x86_64 

uid=33(www-data) gid=33(www-data) groups=33(www-data) 

Safe-mode: OFF (not secure)

/var/www/html/ipcam-cctv/admin/   drwxr-xr-x
Free 13.03 GB of 57.97 GB (22.48%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Self remove    Logout    


Viewing file:     configmgr.php (7.25 KB)      -rw-r--r--
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
    
require_once($_SERVER['DOCUMENT_ROOT'].'/ipcam-cctv/include/main.php');
    require_once(
$_SERVER['DOCUMENT_ROOT'].'/ipcam-cctv/include/camera.php');
    require_once(
$_SERVER['DOCUMENT_ROOT'].'/ipcam-cctv/control/config.php');

    
// Add
    
if (isset($_POST['add']) && isset($_POST['device']) && isset($_POST['key']) && isset($_POST['value']) && $_POST['key'] != '' && !preg_match('/^\s+$/'$_POST['key'])) {
        if (
preg_match('/^[0-9]+/'$_POST['device']) && $_POST['device'] != 0) {
            
$device $_POST['device'];
        } else {
            
$device false;
        }

        if (!
config::set($database$device$_POST['key'], $_POST['value'])) {
            echo 
'Error adding config!';
            exit();
        }
    }

    
// Delete
    
if (isset($_POST['delete']) && isset($_POST['device']) && isset($_POST['key'])) {
        if (
preg_match('/^[0-9]+/'$_POST['device']) && $_POST['device'] != 0) {
            
$device $_POST['device'];
        } else {
            
$device false;
        }

        if (!
config::del($database$device$_POST['key'])) {
            echo 
'Error deleting config!';
            exit();
        }
    }

    
// Update
    
if (isset($_POST['edit']) && isset($_POST['device']) && isset($_POST['key']) && isset($_POST['value']) && $_POST['key'] != '' && !preg_match('/^\s+$/'$_POST['key'])) {
        if (
preg_match('/^[0-9]+/'$_POST['device']) && $_POST['device'] != 0) {
            
$device $_POST['device'];
        } else {
            
$device false;
        }

        if (
config::set($database$device$_POST['key'], $_POST['value'])) {
            exit(
'0');
        } else {
            exit(
'1');
        }
    }

    
$pagepath = array(array('CCTV CONTROL''/ipcam-cctv/cctv.php'), array('ADMIN SETTINGS''/ipcam-cctv/admin/'), array('CONFIGURATION MANAGER'$_SERVER['REQUEST_URI']));
    
$topbar true;

    
// Get devices
    
$devices = array();
    
$database->query('SELECT DISTINCT `devices`.`id`, `devices`.`name`, `config`.`device` FROM `devices` LEFT JOIN `config` ON `config`.`device` = `devices`.`id`');
    if (isset(
$database->result[0])) {
        foreach (
$database->result as $r) {
            if (
$r['device'] != '') { $r['name'] .= '*'; }
            
$devices[] = $r;
        }
    }

    
// Get config
    
$running '';
    
$run_warn '';
    if (isset(
$_GET['config']) && preg_match('/^[0-9]+/'$_GET['config']) && $_GET['config'] != 0) {
        
$config = new config($database$_GET['config'], false);
        
$full_config = new config($database$_GET['config']);
        
$device = new camera($database$full_config->config_data$_GET['config']);
        if (
$device->is_active()) {
            
$running ' disabled';
            
$run_warn 'This device is currently active.';
        }
    } else {
        
$_GET['config'] = 0;
        
$config = new config($database);
        
// Are any cameras active?
        
$database->query('SELECT `id` FROM `devices`');
        if (isset(
$database->result[0])) {
            
$result $database->result;
            foreach (
$result as $row) {
                
$full_config = new config($database$row['id']);
                
$device = new camera($database$full_config->config_data$row['id']);
                if (
$device->is_active()) {
                    
$running ' disabled';
                    
$run_warn 'A device is currently active.';
                    break;
                }
            }
        }
    }

    include 
$_SERVER['DOCUMENT_ROOT'].'/ipcam-cctv/include/header.php';
?>

<script>
    function remove(device, key) {
        if (confirm('Delete key ['+key+']?')) {
            var form = document.createElement("form");
            var e1 = document.createElement("input");
            var e2 = document.createElement("input");
            var e3 = document.createElement("input");

            form.method = "POST";

            e1.name = "delete";
            e1.value = 1;
            e1.type = "hidden";
            e2.name = "device";
            e2.value = device;
            e2.type = "hidden";
            e3.name = "key";
            e3.value = key;
            e3.type = "hidden";

            form.appendChild(e1);
            form.appendChild(e2);
            form.appendChild(e3);
            document.body.appendChild(form);

            form.submit();
        }
    }

    function update(device, field) {
        field.style.backgroundColor = "#FFFF00";
        xhr = new XMLHttpRequest();
        xhr.open("POST", "");
        xhr.onreadystatechange = function() {
            if (xhr.readyState === XMLHttpRequest.DONE && xhr.status === 200) {
                if (xhr.responseText == 0) {
                    field.style.backgroundColor = "#FFFFFF";
                } else {
                    field.style.backgroundColor = "#FF0000";
                }
            }
        };
        formData = new FormData();
        formData.append('edit', 1);
        formData.append('device', device);
        formData.append('key', field.name);
        formData.append('value', field.value);
        xhr.send(formData);
    }
</script>

<p><a class="btn btn-default" href="/ipcam-cctv/admin/">&lt&ltBACK</a></p>

<div class="panel panel-default control-box">
    <div class="panel-body">
        <form action="" method="get">
            <p>CONFIGURATION: <select name="config" onchange="javascript:this.form.submit();">
            <option value="0"<?= (!isset($_GET['config'])) ? ' selected' '' ?>>[GLOBAL]</option>
            <?php
                
foreach ($devices as $d) {
                    echo 
'<option'.((isset($_GET['config']) && $_GET['config'] == $d['id']) ? ' selected' '').' value="'.$d['id'].'">'.$d['name'].'</option>';
                }
            
?>
            </select>
        </form>
    </div>
</div>

<?php
    
if ($run_warn != '') {
        echo 
'<br>';
        echo 
'<div class="panel panel-danger control-box">';
        echo 
'<div class="panel-body">';
        echo 
$run_warn;
        echo 
'</div>';
        echo 
'</div>';
    }
?>

<p>ADD CONFIGURATION:</p>

<form action="" method="POST">
    <input type="hidden" name="add" value="1">
    <input type="hidden" name="device" value="<?= $_GET['config'?>">
    <table border="1">
        <tr>
            <th>KEY</th>
            <th>VALUE</th>
        </tr>
        <tr>
            <td><input type="text" name="key"<?= $running ?>></td>
            <td><input type="text" name="value"<?= $running ?>></td>
            <?php if ($running == '') { ?><td><input class="btn btn-success" type="submit" value="ADD"></td><?php ?>
        </tr>
    </table>
</form>

<hr>

<p>CONFIGURATION DATA:</p>

<table border="1">
    <tr>
        <th>KEY</th>
        <th>VALUE</th>
    <tr>
    <?php
        $highlight 
0;
        foreach (
$config->config_data as $k => $v) {
            echo (
$highlight) ? '<tr bgcolor="#CCCCCC">' '<tr>';
            
$highlight = ($highlight) ? 1;
            echo 
'<td>'.$k.'</td>';
            echo 
'<td><input type="text" name="'.$k.'" value="'.$v.'" onchange="update('.$_GET['config'].', this);"'.$running.'></td>';
            if (
$running == '') { echo '<td><a class="btn btn-danger" href="#" onclick="remove('.$_GET['config'].', \''.$k.'\')">DELETE</a></td>'; }
            echo 
'</tr>';
        }
    
?>
</table>

<?php
    
include $_SERVER['DOCUMENT_ROOT'].'/ipcam-cctv/include/footer.php';
?>

:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ Read-Only ]

:: Make Dir ::
 
[ Read-Only ]
:: Make File ::
 
[ Read-Only ]

:: Go Dir ::
 
:: Go File ::
 

--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.0164 ]--