|
@@ -253,11 +253,9 @@ if (count($_GET)) {
|
253
|
253
|
if (!empty($_GET['email'])) {
|
254
|
254
|
if (isset($_GET['email_history'])) {
|
255
|
255
|
$Distinct = 'DISTINCT ';
|
256
|
|
- $Join['he'] = ' JOIN users_history_emails AS he ON he.UserID = um1.ID ';
|
257
|
|
- $Where[] = ' he.Email '.$Match.wrap($_GET['email']);
|
258
|
|
- } else {
|
259
|
|
- $Where[] = 'um1.Email'.$Match.wrap($_GET['email']);
|
260
|
256
|
}
|
|
257
|
+ $Join['the'] = ' JOIN users_emails_decrypted AS he ON he.ID = um1.ID ';
|
|
258
|
+ $Where[] = ' he.Email '.$Match.wrap($_GET['email']);
|
261
|
259
|
}
|
262
|
260
|
|
263
|
261
|
if (!empty($_GET['email_cnt']) && is_number($_GET['email_cnt'])) {
|
|
@@ -287,11 +285,9 @@ if (count($_GET)) {
|
287
|
285
|
if (!empty($_GET['ip'])) {
|
288
|
286
|
if (isset($_GET['ip_history'])) {
|
289
|
287
|
$Distinct = 'DISTINCT ';
|
290
|
|
- $Join['hi'] = ' JOIN users_history_ips AS hi ON hi.UserID = um1.ID ';
|
291
|
|
- $Where[] = ' hi.IP '.$Match.wrap($_GET['ip'], '', true);
|
292
|
|
- } else {
|
293
|
|
- $Where[] = 'um1.IP'.$Match.wrap($_GET['ip'], '', true);
|
294
|
288
|
}
|
|
289
|
+ $Join['tip'] = ' JOIN users_ips_decrypted AS tip ON tip.ID = um1.ID ';
|
|
290
|
+ $Where[] = ' tip.IP '.$Match.wrap($_GET['ip'], '', true);
|
295
|
291
|
}
|
296
|
292
|
|
297
|
293
|
|
|
@@ -421,11 +417,11 @@ if (count($_GET)) {
|
421
|
417
|
if ($_GET['disabled_ip']) {
|
422
|
418
|
$Distinct = 'DISTINCT ';
|
423
|
419
|
if ($_GET['ip_history']) {
|
424
|
|
- if (!isset($Join['hi'])) {
|
425
|
|
- $Join['hi'] = ' JOIN users_history_ips AS hi ON hi.UserID = um1.ID ';
|
|
420
|
+ if (!isset($Join['tip'])) {
|
|
421
|
+ $Join['tip'] = ' JOIN users_ips_decrypted AS tip ON tip.ID = um1.ID ';
|
426
|
422
|
}
|
427
|
|
- $Join['hi2'] = ' JOIN users_history_ips AS hi2 ON hi2.IP = hi.IP ';
|
428
|
|
- $Join['um2'] = ' JOIN users_main AS um2 ON um2.ID = hi2.UserID AND um2.Enabled = \'2\' ';
|
|
423
|
+ $Join['tip2'] = ' JOIN users_ips_decrypted2 AS tip2 ON tip2.IP = tip.IP ';
|
|
424
|
+ $Join['um2'] = ' JOIN users_main AS um2 ON um2.ID = tip2.ID AND um2.Enabled = \'2\' ';
|
429
|
425
|
} else {
|
430
|
426
|
$Join['um2'] = ' JOIN users_main AS um2 ON um2.IP = um1.IP AND um2.Enabled = \'2\' ';
|
431
|
427
|
}
|
|
@@ -801,9 +797,42 @@ View::show_header('User search');
|
801
|
797
|
</div>
|
802
|
798
|
<?
|
803
|
799
|
if ($RunQuery) {
|
|
800
|
+ if (!empty($_GET['ip'])) {
|
|
801
|
+ if (isset($_GET['ip_history'])) {
|
|
802
|
+ $DB->query("SELECT UserID, IP FROM users_history_ips");
|
|
803
|
+ } else {
|
|
804
|
+ $DB->query("SELECT ID, IP FROM users_main");
|
|
805
|
+ }
|
|
806
|
+ while(list($ID, $EncIP) = $DB->next_record()) {
|
|
807
|
+ $IPs[] = $ID.", '".DBCrypt::decrypt($EncIP)."'";
|
|
808
|
+ }
|
|
809
|
+ $DB->query("CREATE TEMPORARY TABLE users_ips_decrypted (ID INT(10) UNSIGNED NOT NULL, IP VARCHAR(45) NOT NULL, PRIMARY KEY (ID,IP)) ENGINE=MEMORY");
|
|
810
|
+ $DB->query("INSERT IGNORE INTO users_ips_decrypted (ID, IP) VALUES(".implode("),(", $IPs).")");
|
|
811
|
+ if ($_GET['disabled_ip'] && $_GET['ip_history']) {
|
|
812
|
+ $DB->query("CREATE TEMPORARY TABLE users_ips_decrypted2 SELECT * FROM users_ips_decrypted");
|
|
813
|
+ }
|
|
814
|
+ }
|
|
815
|
+ if (!empty($_GET['email'])) {
|
|
816
|
+ if (isset($_GET['email_history'])) {
|
|
817
|
+ $DB->query("SELECT UserID, Email FROM users_history_emails");
|
|
818
|
+ } else {
|
|
819
|
+ $DB->query("SELECT ID, Email FROM users_main");
|
|
820
|
+ }
|
|
821
|
+ while(list($ID, $EncEmail) = $DB->next_record()) {
|
|
822
|
+ $Emails[] = $ID.", '".DBCrypt::decrypt($EncEmail)."'";
|
|
823
|
+ }
|
|
824
|
+ $DB->query("CREATE TEMPORARY TABLE users_emails_decrypted (ID INT(10) UNSIGNED NOT NULL, Email VARCHAR(255) NOT NULL, PRIMARY KEY (ID,Email)) ENGINE=MEMORY");
|
|
825
|
+ $DB->query("INSERT IGNORE INTO users_emails_decrypted (ID, Email) VALUES(".implode("),(", $Emails).")");
|
|
826
|
+ }
|
804
|
827
|
$Results = $DB->query($SQL);
|
805
|
828
|
$DB->query('SELECT FOUND_ROWS()');
|
806
|
829
|
list($NumResults) = $DB->next_record();
|
|
830
|
+ if (!empty($_GET['ip'])) {
|
|
831
|
+ $DB->query("DROP TABLE users_ips_decrypted");
|
|
832
|
+ }
|
|
833
|
+ if (!empty($_GET['email'])) {
|
|
834
|
+ $DB->query("DROP TABLE users_emails_decrypted");
|
|
835
|
+ }
|
807
|
836
|
$DB->set_query_id($Results);
|
808
|
837
|
} else {
|
809
|
838
|
$DB->query('SET @nothing = 0');
|