Browse Source

Use IS and IS NOT for newly added sql NULLs

spaghetti 8 years ago
parent
commit
beaf9b254b

+ 2
- 2
sections/login/index.php View File

68
               m.PassHash = '".db_string(Users::make_sec_hash($_REQUEST['password']))."',
68
               m.PassHash = '".db_string(Users::make_sec_hash($_REQUEST['password']))."',
69
               i.ResetKey = '',
69
               i.ResetKey = '',
70
               m.LastLogin = NOW(),
70
               m.LastLogin = NOW(),
71
-              i.ResetExpires = NULL
71
+              i.ResetExpires IS NULL
72
             WHERE m.ID = '$UserID'
72
             WHERE m.ID = '$UserID'
73
               AND i.UserID = m.ID");
73
               AND i.UserID = m.ID");
74
           $DB->query("
74
           $DB->query("
94
         $DB->query("
94
         $DB->query("
95
           UPDATE users_info
95
           UPDATE users_info
96
           SET ResetKey = '',
96
           SET ResetKey = '',
97
-            ResetExpires = NULL
97
+            ResetExpires IS NULL
98
           WHERE UserID = '$UserID'");
98
           WHERE UserID = '$UserID'");
99
         $_SESSION['reseterr'] = 'The link you were given has expired.'; // Error message to display on form
99
         $_SESSION['reseterr'] = 'The link you were given has expired.'; // Error message to display on form
100
       }
100
       }

+ 1
- 1
sections/requests/take_unfill.php View File

39
   UPDATE requests
39
   UPDATE requests
40
   SET TorrentID = 0,
40
   SET TorrentID = 0,
41
     FillerID = 0,
41
     FillerID = 0,
42
-    TimeFilled = NULL,
42
+    TimeFilled IS NULL,
43
     Visible = 1
43
     Visible = 1
44
   WHERE ID = $RequestID");
44
   WHERE ID = $RequestID");
45
 
45
 

+ 2
- 2
sections/schedule/daily/disable_inactive_users.php View File

11
     WHERE um.PermissionID IN ('".USER."', '".MEMBER  ."')
11
     WHERE um.PermissionID IN ('".USER."', '".MEMBER  ."')
12
       AND um.LastAccess < '".time_minus(3600 * 24 * 110, true)."'
12
       AND um.LastAccess < '".time_minus(3600 * 24 * 110, true)."'
13
       AND um.LastAccess > '".time_minus(3600 * 24 * 111, true)."'
13
       AND um.LastAccess > '".time_minus(3600 * 24 * 111, true)."'
14
-      AND um.LastAccess != NULL
14
+      AND um.LastAccess IS NOT NULL
15
       AND ui.Donor = '0'
15
       AND ui.Donor = '0'
16
       AND um.Enabled != '2'
16
       AND um.Enabled != '2'
17
       AND ul.UserID IS NULL
17
       AND ul.UserID IS NULL
29
       LEFT JOIN users_levels AS ul ON ul.UserID = um.ID AND ul.PermissionID = '".CELEB."'
29
       LEFT JOIN users_levels AS ul ON ul.UserID = um.ID AND ul.PermissionID = '".CELEB."'
30
     WHERE um.PermissionID IN ('".USER."', '".MEMBER  ."')
30
     WHERE um.PermissionID IN ('".USER."', '".MEMBER  ."')
31
       AND um.LastAccess < '".time_minus(3600 * 24 * 30 * 4)."'
31
       AND um.LastAccess < '".time_minus(3600 * 24 * 30 * 4)."'
32
-      AND um.LastAccess != NULL
32
+      AND um.LastAccess IS NOT NULL
33
       AND ui.Donor = '0'
33
       AND ui.Donor = '0'
34
       AND um.Enabled != '2'
34
       AND um.Enabled != '2'
35
       AND ul.UserID IS NULL
35
       AND ul.UserID IS NULL

+ 2
- 2
sections/schedule/daily/disable_unconfirmed_users.php View File

6
   SELECT UserID
6
   SELECT UserID
7
   FROM users_info AS ui
7
   FROM users_info AS ui
8
     JOIN users_main AS um ON um.ID = ui.UserID
8
     JOIN users_main AS um ON um.ID = ui.UserID
9
-  WHERE um.LastAccess = NULL
9
+  WHERE um.LastAccess IS NULL
10
     AND ui.JoinDate < '".time_minus(60 * 60 * 24 * 7)."'
10
     AND ui.JoinDate < '".time_minus(60 * 60 * 24 * 7)."'
11
     AND um.Enabled != '2'");
11
     AND um.Enabled != '2'");
12
 $UserIDs = $DB->collect('UserID');
12
 $UserIDs = $DB->collect('UserID');
19
     ui.BanDate = '$sqltime',
19
     ui.BanDate = '$sqltime',
20
     ui.BanReason = '3',
20
     ui.BanReason = '3',
21
     ui.AdminComment = CONCAT('$sqltime - Disabled for inactivity (never logged in)\n\n', ui.AdminComment)
21
     ui.AdminComment = CONCAT('$sqltime - Disabled for inactivity (never logged in)\n\n', ui.AdminComment)
22
-  WHERE um.LastAccess = NULL
22
+  WHERE um.LastAccess IS NULL
23
     AND ui.JoinDate < '".time_minus(60 * 60 * 24 * 7)."'
23
     AND ui.JoinDate < '".time_minus(60 * 60 * 24 * 7)."'
24
     AND um.Enabled != '2'");
24
     AND um.Enabled != '2'");
25
 $Cache->decrement('stats_user_count', $DB->affected_rows());
25
 $Cache->decrement('stats_user_count', $DB->affected_rows());

+ 6
- 6
sections/schedule/daily/ratio_watch.php View File

12
     FROM users_info AS i
12
     FROM users_info AS i
13
       JOIN users_main AS m ON m.ID = i.UserID
13
       JOIN users_main AS m ON m.ID = i.UserID
14
     WHERE m.Uploaded/m.Downloaded >= m.RequiredRatio
14
     WHERE m.Uploaded/m.Downloaded >= m.RequiredRatio
15
-      AND i.RatioWatchEnds != NULL
15
+      AND i.RatioWatchEnds IS NOT NULL
16
       AND m.can_leech = '0'
16
       AND m.can_leech = '0'
17
       AND m.Enabled = '1'");
17
       AND m.Enabled = '1'");
18
 $OffRatioWatch = $DB->collect('ID');
18
 $OffRatioWatch = $DB->collect('ID');
20
   $DB->query("
20
   $DB->query("
21
     UPDATE users_info AS ui
21
     UPDATE users_info AS ui
22
       JOIN users_main AS um ON um.ID = ui.UserID
22
       JOIN users_main AS um ON um.ID = ui.UserID
23
-    SET ui.RatioWatchEnds = NULL,
23
+    SET ui.RatioWatchEnds IS NULL,
24
       ui.RatioWatchDownload = '0',
24
       ui.RatioWatchDownload = '0',
25
       um.can_leech = '1',
25
       um.can_leech = '1',
26
       ui.AdminComment = CONCAT('$sqltime - Leeching re-enabled by adequate ratio.\n\n', ui.AdminComment)
26
       ui.AdminComment = CONCAT('$sqltime - Leeching re-enabled by adequate ratio.\n\n', ui.AdminComment)
46
       FROM users_info AS i
46
       FROM users_info AS i
47
         JOIN users_main AS m ON m.ID = i.UserID
47
         JOIN users_main AS m ON m.ID = i.UserID
48
       WHERE m.Uploaded / m.Downloaded >= m.RequiredRatio
48
       WHERE m.Uploaded / m.Downloaded >= m.RequiredRatio
49
-        AND i.RatioWatchEnds != NULL
49
+        AND i.RatioWatchEnds IS NOT NULL
50
         AND m.Enabled = '1'");
50
         AND m.Enabled = '1'");
51
 $OffRatioWatch = $DB->collect('ID');
51
 $OffRatioWatch = $DB->collect('ID');
52
 if (count($OffRatioWatch) > 0) {
52
 if (count($OffRatioWatch) > 0) {
53
   $DB->query("
53
   $DB->query("
54
     UPDATE users_info AS ui
54
     UPDATE users_info AS ui
55
       JOIN users_main AS um ON um.ID = ui.UserID
55
       JOIN users_main AS um ON um.ID = ui.UserID
56
-    SET ui.RatioWatchEnds = NULL,
56
+    SET ui.RatioWatchEnds IS NULL,
57
       ui.RatioWatchDownload = '0',
57
       ui.RatioWatchDownload = '0',
58
       um.can_leech = '1'
58
       um.can_leech = '1'
59
     WHERE ui.UserID IN(".implode(',', $OffRatioWatch).')');
59
     WHERE ui.UserID IN(".implode(',', $OffRatioWatch).')');
79
   FROM users_info AS i
79
   FROM users_info AS i
80
     JOIN users_main AS m ON m.ID = i.UserID
80
     JOIN users_main AS m ON m.ID = i.UserID
81
   WHERE m.Uploaded / m.Downloaded < m.RequiredRatio
81
   WHERE m.Uploaded / m.Downloaded < m.RequiredRatio
82
-    AND i.RatioWatchEnds = NULL
82
+    AND i.RatioWatchEnds IS NULL
83
     AND m.Enabled = '1'
83
     AND m.Enabled = '1'
84
     AND m.can_leech = '1'");
84
     AND m.can_leech = '1'");
85
 $OnRatioWatch = $DB->collect('ID');
85
 $OnRatioWatch = $DB->collect('ID');
114
     SELECT ID, torrent_pass
114
     SELECT ID, torrent_pass
115
     FROM users_info AS i
115
     FROM users_info AS i
116
       JOIN users_main AS m ON m.ID = i.UserID
116
       JOIN users_main AS m ON m.ID = i.UserID
117
-    WHERE i.RatioWatchEnds != NULL
117
+    WHERE i.RatioWatchEnds IS NOT NULL
118
       AND i.RatioWatchEnds < '$sqltime'
118
       AND i.RatioWatchEnds < '$sqltime'
119
       AND m.Enabled = '1'
119
       AND m.Enabled = '1'
120
       AND m.can_leech != '0'");
120
       AND m.can_leech != '0'");

+ 1
- 1
sections/schedule/hourly/class_promotion.php View File

87
       FROM users_main
87
       FROM users_main
88
         JOIN users_info ON users_main.ID = users_info.UserID
88
         JOIN users_info ON users_main.ID = users_info.UserID
89
       WHERE PermissionID = ".$L['From']."
89
       WHERE PermissionID = ".$L['From']."
90
-        AND Warned = NULL
90
+        AND Warned IS NULL
91
         AND Uploaded >= '$L[MinUpload]'
91
         AND Uploaded >= '$L[MinUpload]'
92
         AND (Uploaded / Downloaded >= '$L[MinRatio]' OR (Uploaded / Downloaded IS NULL))
92
         AND (Uploaded / Downloaded >= '$L[MinRatio]' OR (Uploaded / Downloaded IS NULL))
93
         AND JoinDate < '$L[MaxTime]'
93
         AND JoinDate < '$L[MaxTime]'

+ 1
- 1
sections/schedule/hourly/disable_leech.php View File

5
   SELECT ID, torrent_pass
5
   SELECT ID, torrent_pass
6
   FROM users_info AS i
6
   FROM users_info AS i
7
     JOIN users_main AS m ON m.ID = i.UserID
7
     JOIN users_main AS m ON m.ID = i.UserID
8
-  WHERE i.RatioWatchEnds != NULL
8
+  WHERE i.RatioWatchEnds IS NOT NULL
9
     AND i.RatioWatchDownload + 10 * 1024 * 1024 * 1024 < m.Downloaded
9
     AND i.RatioWatchDownload + 10 * 1024 * 1024 * 1024 < m.Downloaded
10
     AND m.Enabled = '1'
10
     AND m.Enabled = '1'
11
     AND m.can_leech = '1'");
11
     AND m.can_leech = '1'");

+ 1
- 1
sections/schedule/hourly/expire_warnings.php View File

13
 
13
 
14
 $DB->query("
14
 $DB->query("
15
   UPDATE users_info
15
   UPDATE users_info
16
-  SET Warned = NULL
16
+  SET Warned IS NULL
17
   WHERE Warned < '$sqltime'");
17
   WHERE Warned < '$sqltime'");
18
 ?>
18
 ?>

+ 1
- 1
sections/schedule/hourly/hide_old_requests.php View File

5
   UPDATE requests
5
   UPDATE requests
6
   SET Visible = 0
6
   SET Visible = 0
7
   WHERE TimeFilled < (NOW() - INTERVAL 7 DAY)
7
   WHERE TimeFilled < (NOW() - INTERVAL 7 DAY)
8
-    AND TimeFilled != NULL");
8
+    AND TimeFilled IS NOT NULL");
9
 ?>
9
 ?>

+ 2
- 2
sections/tools/data/upscale_pool.php View File

23
     m.RequiredRatio
23
     m.RequiredRatio
24
   FROM users_main AS m
24
   FROM users_main AS m
25
     LEFT JOIN users_info AS i ON i.UserID = m.ID
25
     LEFT JOIN users_info AS i ON i.UserID = m.ID
26
-  WHERE i.RatioWatchEnds != NULL
26
+  WHERE i.RatioWatchEnds IS NOT NULL
27
     AND m.Enabled = '1'
27
     AND m.Enabled = '1'
28
   ORDER BY i.RatioWatchEnds ASC
28
   ORDER BY i.RatioWatchEnds ASC
29
   LIMIT $Limit");
29
   LIMIT $Limit");
32
 $DB->query("
32
 $DB->query("
33
   SELECT COUNT(UserID)
33
   SELECT COUNT(UserID)
34
   FROM users_info
34
   FROM users_info
35
-  WHERE BanDate != NULL
35
+  WHERE BanDate IS NOT NULL
36
     AND BanReason = '2'");
36
     AND BanReason = '2'");
37
 list($TotalDisabled) = $DB->next_record();
37
 list($TotalDisabled) = $DB->next_record();
38
 $DB->set_query_id($RS);
38
 $DB->set_query_id($RS);

+ 4
- 4
sections/tools/data/user_flow.php View File

77
           DATE_FORMAT(JoinDate, '%Y-%m-%d') AS Date,
77
           DATE_FORMAT(JoinDate, '%Y-%m-%d') AS Date,
78
           COUNT(UserID) AS Flow
78
           COUNT(UserID) AS Flow
79
         FROM users_info
79
         FROM users_info
80
-        WHERE JoinDate != NULL
80
+        WHERE JoinDate IS NOT NULL
81
         GROUP BY Date
81
         GROUP BY Date
82
       ) AS j
82
       ) AS j
83
       LEFT JOIN (
83
       LEFT JOIN (
85
           DATE_FORMAT(BanDate, '%Y-%m-%d') AS Date,
85
           DATE_FORMAT(BanDate, '%Y-%m-%d') AS Date,
86
           COUNT(UserID) AS Flow
86
           COUNT(UserID) AS Flow
87
         FROM users_info
87
         FROM users_info
88
-        WHERE BanDate != NULL
88
+        WHERE BanDate IS NOT NULL
89
           AND BanReason = '1'
89
           AND BanReason = '1'
90
         GROUP BY Date
90
         GROUP BY Date
91
       ) AS m ON j.Date = m.Date
91
       ) AS m ON j.Date = m.Date
94
           DATE_FORMAT(BanDate, '%Y-%m-%d') AS Date,
94
           DATE_FORMAT(BanDate, '%Y-%m-%d') AS Date,
95
           COUNT(UserID) AS Flow
95
           COUNT(UserID) AS Flow
96
         FROM users_info
96
         FROM users_info
97
-        WHERE BanDate != NULL
97
+        WHERE BanDate IS NOT NULL
98
           AND BanReason = '2'
98
           AND BanReason = '2'
99
         GROUP BY Date
99
         GROUP BY Date
100
       ) AS r ON j.Date = r.Date
100
       ) AS r ON j.Date = r.Date
103
           DATE_FORMAT(BanDate, '%Y-%m-%d') AS Date,
103
           DATE_FORMAT(BanDate, '%Y-%m-%d') AS Date,
104
           COUNT(UserID) AS Flow
104
           COUNT(UserID) AS Flow
105
         FROM users_info
105
         FROM users_info
106
-        WHERE BanDate != NULL
106
+        WHERE BanDate IS NOT NULL
107
           AND BanReason = '3'
107
           AND BanReason = '3'
108
         GROUP BY Date
108
         GROUP BY Date
109
       ) AS i ON j.Date = i.Date
109
       ) AS i ON j.Date = i.Date

+ 1
- 1
sections/torrents/functions.php View File

244
       SELECT ID
244
       SELECT ID
245
       FROM requests
245
       FROM requests
246
       WHERE GroupID = $GroupID
246
       WHERE GroupID = $GroupID
247
-        AND TimeFilled = NULL");
247
+        AND TimeFilled IS NULL");
248
     $Requests = $DB->collect('ID');
248
     $Requests = $DB->collect('ID');
249
     $Cache->cache_value("requests_group_$GroupID", $Requests, 0);
249
     $Cache->cache_value("requests_group_$GroupID", $Requests, 0);
250
   }
250
   }

+ 2
- 2
sections/user/advancedsearch.php View File

413
     }
413
     }
414
 
414
 
415
     if ($_GET['warned'] == 'yes') {
415
     if ($_GET['warned'] == 'yes') {
416
-      $Where[] = 'ui1.Warned != NULL';
416
+      $Where[] = 'ui1.Warned IS NOT NULL';
417
     } elseif ($_GET['warned'] == 'no') {
417
     } elseif ($_GET['warned'] == 'no') {
418
-      $Where[] = 'ui1.Warned = NULL';
418
+      $Where[] = 'ui1.Warned IS NULL';
419
     }
419
     }
420
 
420
 
421
     if ($_GET['disabled_ip']) {
421
     if ($_GET['disabled_ip']) {

+ 1
- 1
sections/user/take_edit.php View File

164
       UPDATE users_history_emails
164
       UPDATE users_history_emails
165
       SET Time = '".sqltime()."'
165
       SET Time = '".sqltime()."'
166
       WHERE UserID = '$UserID'
166
       WHERE UserID = '$UserID'
167
-        AND Time = NULL");
167
+        AND Time IS NULL");
168
     $DB->query("
168
     $DB->query("
169
       INSERT INTO users_history_emails
169
       INSERT INTO users_history_emails
170
         (UserID, Email, Time, IP)
170
         (UserID, Email, Time, IP)

+ 3
- 3
sections/user/takemoderate.php View File

226
 if ($_POST['ResetRatioWatch'] && check_perms('users_edit_reset_keys')) {
226
 if ($_POST['ResetRatioWatch'] && check_perms('users_edit_reset_keys')) {
227
   $DB->query("
227
   $DB->query("
228
     UPDATE users_info
228
     UPDATE users_info
229
-    SET RatioWatchEnds = NULL, RatioWatchDownload = '0', RatioWatchTimes = '0'
229
+    SET RatioWatchEnds IS NULL, RatioWatchDownload = '0', RatioWatchTimes = '0'
230
     WHERE UserID = '$UserID'");
230
     WHERE UserID = '$UserID'");
231
   $EditSummary[] = 'RatioWatch history reset';
231
   $EditSummary[] = 'RatioWatch history reset';
232
 }
232
 }
499
   $LightUpdates['Warned'] = time_plus(3600 * 24 * 7 * $WarnLength);
499
   $LightUpdates['Warned'] = time_plus(3600 * 24 * 7 * $WarnLength);
500
 
500
 
501
 } elseif ($Warned == 0 && $Cur['Warned'] != NULL && check_perms('users_warn')) {
501
 } elseif ($Warned == 0 && $Cur['Warned'] != NULL && check_perms('users_warn')) {
502
-  $UpdateSet[] = "Warned = NULL";
502
+  $UpdateSet[] = "Warned IS NULL";
503
   $EditSummary[] = 'warning removed';
503
   $EditSummary[] = 'warning removed';
504
   $LightUpdates['Warned'] = NULL;
504
   $LightUpdates['Warned'] = NULL;
505
 
505
 
700
     Tracker::update_tracker('add_user', array('id' => $UserID, 'passkey' => $Cur['torrent_pass'], 'visible' => $VisibleTrIP));
700
     Tracker::update_tracker('add_user', array('id' => $UserID, 'passkey' => $Cur['torrent_pass'], 'visible' => $VisibleTrIP));
701
 
701
 
702
     if (($Cur['Downloaded'] == 0) || ($Cur['Uploaded'] / $Cur['Downloaded'] >= $Cur['RequiredRatio'])) {
702
     if (($Cur['Downloaded'] == 0) || ($Cur['Uploaded'] / $Cur['Downloaded'] >= $Cur['RequiredRatio'])) {
703
-      $UpdateSet[] = "i.RatioWatchEnds = NULL";
703
+      $UpdateSet[] = "i.RatioWatchEnds IS NULL";
704
       $CanLeech = 1;
704
       $CanLeech = 1;
705
       $UpdateSet[] = "m.can_leech = '1'";
705
       $UpdateSet[] = "m.can_leech = '1'";
706
       $UpdateSet[] = "i.RatioWatchDownload = '0'";
706
       $UpdateSet[] = "i.RatioWatchDownload = '0'";

+ 2
- 2
sections/userhistory/email_history.php View File

60
       LEFT JOIN geoip_country AS c ON INET_ATON(h.IP) BETWEEN c.StartIP AND c.EndIP
60
       LEFT JOIN geoip_country AS c ON INET_ATON(h.IP) BETWEEN c.StartIP AND c.EndIP
61
     WHERE h.UserID = '$UserID'
61
     WHERE h.UserID = '$UserID'
62
       AND h2.UserID > 0"
62
       AND h2.UserID > 0"
63
-      /*AND Time != NULL*/."
63
+      /*AND Time IS NOT NULL*/."
64
     ORDER BY Time DESC");
64
     ORDER BY Time DESC");
65
 } else {
65
 } else {
66
   $DB->query("
66
   $DB->query("
81
     FROM users_history_emails AS h
81
     FROM users_history_emails AS h
82
       LEFT JOIN geoip_country AS c ON INET_ATON(h.IP) BETWEEN c.StartIP AND c.EndIP
82
       LEFT JOIN geoip_country AS c ON INET_ATON(h.IP) BETWEEN c.StartIP AND c.EndIP
83
     WHERE UserID = '$UserID' "
83
     WHERE UserID = '$UserID' "
84
-      /*AND Time != NULL*/."
84
+      /*AND Time IS NOT NULL*/."
85
     ORDER BY Time DESC");
85
     ORDER BY Time DESC");
86
 }
86
 }
87
 $History = $DB->to_array();
87
 $History = $DB->to_array();

Loading…
Cancel
Save