X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=inc%2Fhttp-functions.php;h=67a70435983f725096b859e352b7750c8fbbdb88;hb=a62d259127a8bf2ec3e0e5da7d4ef34134bcde68;hp=317ba55e83d1599c86c31cec6240d7e0496616d4;hpb=e4b7f0c779ffca9c9317a18b303a0f7714e96176;p=mailer.git diff --git a/inc/http-functions.php b/inc/http-functions.php index 317ba55e83..67a7043598 100644 --- a/inc/http-functions.php +++ b/inc/http-functions.php @@ -551,7 +551,7 @@ function unchunkHttpResponse ($response) { //* DEBUG: */ die('tempResponse['.strlen($tempResponse).']=
'.replaceReturnNewLine(htmlentities($tempResponse)).'
'); // Re-add the headers - $response = merge_array($GLOBALS['http_headers'], stringToArray(chr(10), $tempResponse)); + $response = merge_array($GLOBALS['http_headers'], stringToArray(PHP_EOL, $tempResponse)); } // END - if // Return the unchunked array @@ -859,11 +859,37 @@ function getContentType () { // Logs wrong SERVER_NAME attempts function logWrongServerNameRedirect () { - // Is ext-sql_patches at least version 0.9.1? - if (isExtensionInstalledAndNewer('sql_patches', '0.9.1')) { - // Then log it away - SQL_QUERY("INSERT INTO `{?_MYSQL_PREFIX?}_server_name_log` (`server_name`) VALUES('{%pipe,detectServerName%}')", - __FUNCTION__, __LINE__); + // Is ext-sql_patches at least version 0.9.2? + if (isExtensionInstalledAndNewer('sql_patches', '0.9.2')) { + // Is there an entry? + if (countSumTotalData(detectServerName(), 'server_name_log', 'server_name_id', 'server_name', TRUE, str_replace('%', '{PER}', sprintf(" AND `server_name_remote_addr`='%s' AND `server_name_ua`='%s' AND `server_name_referrer`='%s'", SQL_ESCAPE(detectRemoteAddr(TRUE)), SQL_ESCAPE(detectUserAgent(TRUE)), SQL_ESCAPE(detectReferer(TRUE))))) == 1) { + // Update counter, as all are the same + SQL_QUERY_ESC("UPDATE + `{?_MYSQL_PREFIX?}_server_name_log` +SET + `server_name_counter`=`server_name_counter`+1 +WHERE + `server_name`='%s' AND + `server_name_remote_addr`='%s' AND + `server_name_ua`='%s' AND + `server_name_referrer`='%s' +LIMIT 1", + array( + detectServerName(), + detectRemoteAddr(TRUE), + detectUserAgent(TRUE), + detectReferer(TRUE) + ), __FUNCTION__, __LINE__); + } else { + // Then log it away + SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_server_name_log` (`server_name`, `server_name_remote_addr`, `server_name_ua`, `server_name_referrer`) VALUES('%s','%s', '%s', '%s')", + array( + detectServerName(), + detectRemoteAddr(TRUE), + detectUserAgent(TRUE), + detectReferer(TRUE) + ), __FUNCTION__, __LINE__); + } } // END - if }