So. Er prüft nun auch ob die PN gelesen wurde, und nur wenn nicht zieht er eins ab.
Ich weiss, ist Quick 'n Dirty. Aber sollte funktionieren.
PHP-Code:
<?php
// ####################### SET PHP ENVIRONMENT ###########################
error_reporting(E_ALL & ~E_NOTICE);
// #################### DEFINE IMPORTANT CONSTANTS #######################
require_once('./global.php');
$getpn = $DB_site->query("SELECT pmtext.pmtextid as pmtextid, pmtext.fromuserid as user, pm.messageread as isread FROM pmtext, pm WHERE title = 'Titelderpn' and pm.pmtextid = pmtext.pmtextid");
$in = "0";
$usertotal = "0";
$userunread = "0";
while ($pn = $DB_site->fetch_array($getpn)) {
$in .= ", " . $pn['pmtextid'];
$usertotal .= "," . $pn['user'];
if ($pn['isread']==0) $userunread .= "," . $pn['user'];
}
$DB_site->query("DELETE FROM pm WHERE pmtextid IN (".$in.")");
$DB_site->query("DELETE FROM pmtext WHERE pmtextid IN (".$in.")");
$DB_site->query("UPDATE user SET pmunread = pmunread - 1 WHERE userid IN (".$userunread.")");
$DB_site->query("UPDATE user SET pmtotal = pmtotal - 1 WHERE userid IN (".$usertotal.")");
?>
Lesezeichen