]> git.mxchange.org Git - mailer.git/blobdiff - inc/classes/resolver.class.php
Referal system refactured (and some parts fixed), wrapper function introduced:
[mailer.git] / inc / classes / resolver.class.php
index 2677ca6f86cb5b9793d4da3690f8378ec65584d2..57afe95342d8d9be749d9a8c65d5847161205bc2 100644 (file)
  * $Date::                                                            $ *
  * $Tag:: 0.2.1-FINAL                                                 $ *
  * $Author::                                                          $ *
- * Needs to be in all Files and every File needs "svn propset           *
- * svn:keywords Date Revision" (autoprobset!) at least!!!!!!            *
  * -------------------------------------------------------------------- *
  * Copyright (c) 2003 - 2009 by Roland Haeder                           *
- * Copyright (c) 2009, 2010 by Mailer Developer Team                    *
+ * Copyright (c) 2009 - 2011 by Mailer Developer Team                   *
  * For more information visit: http://www.mxchange.org                  *
  *                                                                      *
  * This program is free software; you can redistribute it and/or modify *
@@ -94,7 +92,7 @@ class HostnameResolver {
                                // Seems to be an IP! Now check deeper...
                                if (($matches[0] == $ip) && ($matches[1] >= 0) && ($matches[1] <= 255) && ($matches[2] >= 0) && ($matches[2] <= 255) && ($matches[3] >= 0) && ($matches[3] <= 255) && ($matches[4] > 0) && ($matches[4] < 255)) {
                                        // We also cache IP addresses
-                                       SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_dns_cache` (`ip`, `hostname`, `added`) VALUES('%s', '%s', NOW())",
+                                       SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_dns_cache` (`ip`, `hostname`, `added`) VALUES ('%s', '%s', NOW())",
                                                array($ip, $hostname), __METHOD__, __LINE__);
 
                                        // Set return value to $ip
@@ -108,7 +106,7 @@ class HostnameResolver {
                                //* DEBUG: */ logDebugMessage(__METHOD__, __LINE__, sprintf("Cannot lookup: %s", $hostname));
                        } else {
                                // Put entry in DB
-                               SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_dns_cache` (`ip`, `hostname`, `added`) VALUES('%s', '%s', NOW())",
+                               SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_dns_cache` (`ip`, `hostname`, `added`) VALUES ('%s', '%s', NOW())",
                                        array($ip, $hostname), __METHOD__, __LINE__);
 
                                // Set return value to $ip
@@ -127,7 +125,7 @@ class HostnameResolver {
        // Purge old entries
        function purgeEntries() {
                // SQL for cleaning up
-               SQL_QUERY('DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_dns_cache` WHERE UNIX_TIMESTAMP(`added`) < (UNIX_TIMESTAMP() - {?dns_cache_timeout?})',
+               SQL_QUERY('DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_dns_cache` WHERE (UNIX_TIMESTAMP() - UNIX_TIMESTAMP(`added`) >= {?dns_cache_timeout?})',
                        __METHOD__, __LINE__);
        }
 }