Files
votianng/html/sysadmin/app_downloader/web_download/ajaxDownloader.php
2026-03-29 10:34:57 +02:00

52 lines
1.7 KiB
PHP

<?php
include_once ("../include/mc_gen_include.inc.php");
require_once "DB.php";
// DB-Config
$dbhost = "172.16.0.111:3711"; // EXTERNAL_DB_METAOBJECT
$dblogin = "phoenix";
$dbpassword = "AdAdgkS13";
$dbname = "phoenix";
$dsn = "mysql://$dblogin:$dbpassword@$dbhost/$dbname";
$db = DB::connect($dsn, false);
if (DB::isError($db))
die ("$PHP_SELF: " . $db->getMessage());
$db->setFetchMode(DB_FETCHMODE_ASSOC);
$db->query('SET NAMES latin1');
getSecHttpVars("0", array("mode", "clientIP", "clientVersion"));
header("Content-Type: text/html; charset=ISO-8859-1\n");
$out = "cnt = '0';";
if ($mode == "0") :
// Check HTTP-Parameters
if ($clientIP != "" && $clientVersion != "") :
$cnt = getFieldValueFromClause("temp.app_download","appd_cnt","appd_ip = '" . $clientIP . "' AND appd_ver = '" . $clientVersion . "'");
if ($cnt == "") : $cnt = "0"; endif;
$out = "cnt = '" . $cnt . "';";
endif;
endif;
if ($mode == "1") :
// Check HTTP-Parameters
if ($clientIP != "" && $clientVersion != "") :
if (!existsEntry("temp.app_download",array("appd_ip",$clientIP,"appd_ver",$clientVersion))) :
insertStmt("temp.app_download", array("appd_ip", $clientIP, "appd_ver", $clientVersion, "appd_cnt", "1"));
$out = "cnt = '1';";
else :
$cnt = getFieldValueFromClause("temp.app_download","appd_cnt","appd_ip = '" . $clientIP . "' AND appd_ver = '" . $clientVersion . "'");
$cnt++;
updateStmt("temp.app_download","appd_ip",$clientIP,array("appd_cnt",$cnt),"appd_ver = '" . $clientVersion . "'");
$out = "cnt = '" . $cnt . "';";
endif;
endif;
endif;
echo $out;
?>