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
| 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/include/ |
Upload File : |
<?php
// https://go.patientapps.net/hrx
// http://go.patientapps.net/ma2-rcl
require_once __DIR__ . '/include.php';
require_once __DIR__ . '/productlist.php';
define('FILE_CRM', '/var/www/patientappsinc_www/core/framework.php');
/*
CREATE TABLE IF NOT EXISTS `shortlink_click` (
`starthour` int(11) NOT NULL,
`window` int(11) NOT NULL,
`ip_address` varchar(32) NOT NULL,
`count` int(11) NOT NULL,
`shortcode` varchar(10) NOT NULL,
PRIMARY KEY (`shortcode`,`starthour`,`ip_address`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='QRCode impressions';
Add to apache .conf file:
RewriteEngine On
RewriteRule \.git.* - [R=404,L]
# realtime landing-page preview
RewriteCond %{REQUEST_URI} ^/preview/(.*)$
RewriteRule ^(.*)$ /include/preview.php [L]
RewriteCond %{REQUEST_URI} ^/edit/(.*)$
RewriteRule /edit/(.*)$ https://pai.patientapps.net/account/procedurelist/$1?debug=1 [L,R=302]
RewriteCond %{REQUEST_URI} ^/~/html$
RewriteRule ^(.*)$ /include/html.php [L]
RewriteCond %{REQUEST_URI} ^/static/location\.js$
RewriteRule ^(.*)$ /static/location.php [L]
RewriteCond %{REQUEST_URI} ^/static/associate\.js$
RewriteRule ^(.*)$ /static/associate.php [L]
RewriteCond %{REQUEST_URI} !^/$
#RewriteCond %{REQUEST_URI} !^/index\.html$
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-f
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /include/redirect.php [L]
*/
#$fp = fopen('/tmp/redirect.log', 'a');
#fwrite($fp, var_export($_SERVER, 1) . "\n\n");
#fclose($fp);
$x = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : '/';
if (($p = strpos($x, '?')) !== FALSE) {
$x = substr($x, 0, $p);
}
$x = substr($x, 1);
#file_put_contents('/tmp/redirect', var_export($_SERVER, 1));
$data = getShortCode($db, $x);
if (!is_null($data)) { // found short code
// group hits by ipaddress/hour
$hour = intval(time() / 3600);
$starttime = $hour * 3600;
$ipaddress = getClientIP();
$click = $db->Lookup('select * from shortlink_click where shortcode=%s and starthour=%d and ip_address=%s', [$x, $hour, $ipaddress], 'shortlink_click');
if (!$click['__existing']) {
$click['shortcode'] = $x;
$click['starthour'] = $hour;
$click['window'] = $starttime;
$click['ip_address'] = $ipaddress;
$click['count'] = 0;
}
$click['count']++;
$db->SaveRecord($click);
// update counter
$db->Query('update shortlink set sl_count=sl_count + 1 where sl_short=%s', $x, '', NULL);
// show preview ??
$element = $data['__element'];
if ($element['scheme'] == 'group') {
displayProductList($db, $element['host'], substr($element['path'], 1));
exit;
} else {
$link = $data['sl_full'];
$host = explode('.', $element['host']);
if (isVersion2($host[0])) {
$host[0] = $x;
$element['host'] = join('.', $host);
if (!isset($element['path'])) $element['path'] = '';
$link = $element['scheme'] . '://' . $element['host'] . $element['path'];
}
// if target is a v2 app, then keep original shortcode as the subdomain name
header('Content-type: text/plain');
redirect($link);
}
}
$e = explode('/', trim($x, '/'));
if (count($e) > 1 && $e[0] == 'external') {
$controller = str_replace('..', '', $e[1]);
$filename = __DIR__ . '/api/.api/' . $controller . '.php';
if (file_exists($filename)) {
try {
require_once $filename;
} catch (Throwable $e) { // php 7
die('Error:' . $e->getMessage() . ' in ' . $e->getFile() . ' at line ' . $e->getLine() . ' [7]');
}
exit;
}
}
// Do we have a PAI CMD link?
$uri = '/myapp/' . strtolower($x);
if ($_SERVER['REMOTE_ADDR'] == '173.48.93.56') {
$data = $db->Lookup('select * from pages where pg_uri=%s', [$uri]);
if (!is_null($data) && $data['__existing']) {
displayCMSpage($data);
exit;
}
}
redirect(BOUNCE);
// use PATIENTAPPS.COM to display the webpage from the CMS
function displayCMSpage($data) {
session_start();
$sess_id = $_SESSION['patientapps'] ?? FALSE;
if ($sess_id) {
session_write_close();
session_id($sess_id);
}
$_SERVER['REQUEST_URI'] = $data['pg_uri'];
$_SERVER['HTTP_HOST'] = 'patientapps.com';
unset($_SERVER['DOCUMENT_ROOT']);
require_once FILE_CRM;
}
function redirect($url, $statusCode = 302) {
header('Location: ' . $url, TRUE, $statusCode);
die();
}