Changeset 15898 in spip-zone


Ignore:
Timestamp:
Oct 10, 2007, 4:03:57 PM (12 years ago)
Author:
pierre.andrews@…
Message:

correction de l'insertion dans le cache, on met a jour correctement si l'ip est deja connue.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • _plugins_/_test_/honeypot/inc/httpbl.php

    r15666 r15898  
    4747function httpbl_dbcache_store($ip,$info='') {
    4848  include_spip('base/abstract_sql');
    49   if($info) {
    50         spip_abstract_insert('spip_honeypot_cache','(ip,status,age,threat,type,maj)',
    51                                                  '('.ip2long($ip).',127,'.$info['age'].','.$info['threat'].','.$info['type'].',NOW())');
     49  if($info) {             
     50        spip_query("INSERT IGNORE INTO spip_honeypot_cache (ip,status,age,threat,type,maj) VALUES (".ip2long($ip).',127,'.$info['age'].','.$info['threat'].",".$info['type'].",NOW())");
     51        spip_query("UPDATE spip_honeypot_cache SET maj=NOW() WHERE ip=".ip2long($ip));
    5252  }  else {
    53         spip_abstract_insert('spip_honeypot_cache','(ip,status,age,threat,type,maj)',
    54                                                  '('.ip2long($ip).',0,0,0,0,NOW())');
     53        spip_query("INSERT IGNORE INTO spip_honeypot_cache (ip,status,age,threat,type,maj) VALUES (".ip2long($ip).",0,0,0,0,NOW())");
     54        spip_query("UPDATE spip_honeypot_cache SET maj=NOW() WHERE ip=".ip2long($ip));
    5555  }
    5656}
Note: See TracChangeset for help on using the changeset viewer.