Browse Source

Delete table users_history_emails and related features

biotorrents 4 years ago
parent
commit
d1effc3d2c

+ 0
- 4
delete.php View File

@@ -1,4 +0,0 @@
1
-<?php
2
-declare(strict_types=1);
3
-
4
-require_once 'classes/script_start.php';

+ 0
- 9
gazelle.sql View File

@@ -1409,15 +1409,6 @@ CREATE TABLE `users_freeleeches` (
1409 1409
 ) ENGINE=InnoDB CHARSET=utf8mb4;
1410 1410
 
1411 1411
 
1412
-CREATE TABLE `users_history_emails` (
1413
-  `UserID` int NOT NULL,
1414
-  `Email` varchar(255) DEFAULT NULL,
1415
-  `Time` datetime DEFAULT NULL,
1416
-  `IP` varchar(90) DEFAULT NULL,
1417
-  KEY `UserID` (`UserID`)
1418
-) ENGINE=InnoDB CHARSET=utf8mb4;
1419
-
1420
-
1421 1412
 CREATE TABLE `users_history_ips` (
1422 1413
   `UserID` int NOT NULL,
1423 1414
   `IP` varchar(90) NOT NULL DEFAULT '0.0.0.0',

+ 0
- 55
sections/delete/delete_email.php View File

@@ -1,55 +0,0 @@
1
-<?php
2
-#declare(strict_types=1);
3
-
4
-if (!isset($_POST['emails']) || !is_array($_POST['emails'])) {
5
-    error('No email requested');
6
-}
7
-
8
-if (!apcu_exists('DBKEY')) {
9
-    error(403);
10
-}
11
-
12
-View::show_header('Email Expunge Request');
13
-?>
14
-
15
-<div class="header">
16
-  <h2>Email Expunge Request</h2>
17
-</div>
18
-
19
-<form class="create_form box pad" name="emaildelete" action="delete.php" method="post">
20
-  <input type="hidden" name="auth"
21
-    value="<?=$LoggedUser['AuthKey']?>" />
22
-
23
-  <?php foreach ($_POST['emails'] as $email) { ?>
24
-  <input type="hidden" name="emails[]" value="<?=$email?>" />
25
-  <?php } ?>
26
-
27
-  <input type="hidden" name="action" value="takeemail" />
28
-
29
-  <table cellspacing="1" cellpadding="3" border="0" class="layout" width="100%">
30
-    <tr>
31
-      <td class="label">Email:</td>
32
-      <td>
33
-        <input type="text" size="30"
34
-          value="<?=Crypto::decrypt($_POST['emails'][0])?>"
35
-          disabled />
36
-      </td>
37
-    </tr>
38
-
39
-    <tr>
40
-      <td class="label">Reason (Optional):</td>
41
-      <td>
42
-        <textarea name="reason" rows="10"></textarea>
43
-      </td>
44
-    </tr>
45
-
46
-    <tr>
47
-      <td></td>
48
-      <td>
49
-        <input type="submit" value="Submit" />
50
-      </td>
51
-    </tr>
52
-  </table>
53
-</form>
54
-<?php
55
-View::show_footer();

+ 0
- 54
sections/delete/delete_ip.php View File

@@ -1,54 +0,0 @@
1
-<?php
2
-#declare(strict_types=1);
3
-
4
-if (!isset($_POST['ips']) || !is_array($_POST['ips'])) {
5
-    error('No IP requested');
6
-}
7
-
8
-if (!apcu_exists('DBKEY')) {
9
-    error(403);
10
-}
11
-
12
-View::show_header('IP Address Expunge Request');
13
-?>
14
-
15
-<div class="header">
16
-  <h2>IP Address Expunge Request</h2>
17
-</div>
18
-
19
-<form class="create_form box pad" name="ipdelete" action="delete.php" method="post">
20
-  <input type="hidden" name="auth"
21
-    value="<?=$LoggedUser['AuthKey']?>" />
22
-
23
-  <?php foreach ($_POST['ips'] as $ip) { ?>
24
-  <input type="hidden" name="ips[]" value="<?=$ip?>" />
25
-  <?php } ?>
26
-
27
-  <input type="hidden" name="action" value="takeip" />
28
-  <table cellspacing="1" cellpadding="3" border="0" class="layout" width="100%">
29
-    <tr>
30
-      <td class="label">IP:</td>
31
-      <td>
32
-        <input type="text" size="30"
33
-          value="<?=Crypto::decrypt($_POST['ips'][0])?>"
34
-          disabled />
35
-      </td>
36
-    </tr>
37
-
38
-    <tr>
39
-      <td class="label">Reason (Optional):</td>
40
-      <td>
41
-        <textarea name="reason" rows="10"></textarea>
42
-      </td>
43
-    </tr>
44
-
45
-    <tr>
46
-      <td></td>
47
-      <td>
48
-        <input type="submit" value="Submit" />
49
-      </td>
50
-    </tr>
51
-  </table>
52
-</form>
53
-<?php
54
-View::show_footer();

+ 0
- 29
sections/delete/index.php View File

@@ -1,29 +0,0 @@
1
-<?php
2
-#declare(strict_types=1);
3
-
4
-enforce_login();
5
-
6
-if ($_REQUEST['action']) {
7
-    switch ($_REQUEST['action']) {
8
-    case 'email':
9
-        include 'delete_email.php';
10
-        break;
11
-        
12
-    case 'takeemail':
13
-        include 'take_delete_email.php';
14
-        break;
15
-
16
-    case 'ip':
17
-        include 'delete_ip.php';
18
-        break;
19
-
20
-    case 'takeip':
21
-        include 'take_delete_ip.php';
22
-        break;
23
-
24
-    default:
25
-        header('Location: index.php');
26
-  }
27
-} else {
28
-    header('Location: index.php');
29
-}

+ 0
- 97
sections/delete/take_delete_email.php View File

@@ -1,97 +0,0 @@
1
-<?php
2
-#declare(strict_types=1);
3
-
4
-enforce_login();
5
-authorize();
6
-
7
-if (!isset($_POST['emails']) || !is_array($_POST['emails'])) {
8
-    error('Stop that.');
9
-}
10
-
11
-if (!apcu_exists('DBKEY')) {
12
-    error(403);
13
-}
14
-
15
-$EncEmails = $_POST['emails'];
16
-$Reason = $_POST['reason'] ?? '';
17
-
18
-foreach ($EncEmails as $EncEmail) {
19
-    $DB->query("
20
-    SELECT
21
-      `UserID`
22
-    FROM
23
-      `users_history_emails`
24
-    WHERE
25
-      `Email` = '".db_string($EncEmail)."'
26
-    ");
27
-
28
-    if (!$DB->has_results()) {
29
-        error('Email not found');
30
-    }
31
-    list($UserID) = $DB->next_record();
32
-
33
-    if (!check_perms('users_mod') && ($UserID !== $LoggedUser['ID'])) {
34
-        error(403);
35
-    }
36
-
37
-    $DB->query("
38
-    SELECT
39
-      `Email`
40
-    FROM
41
-      `users_main`
42
-    WHERE
43
-      `ID` = '$UserID'
44
-    ");
45
-
46
-    if (!$DB->has_results()) {
47
-        error(404);
48
-    }
49
-
50
-    list($Curr) = $DB->next_record();
51
-    $Curr = Crypto::decrypt($Curr);
52
-
53
-    if ($Curr === Crypto::decrypt($EncEmail)) {
54
-        error("You can't delete your current email.");
55
-    }
56
-}
57
-
58
-// Okay I think everything checks out.
59
-$DB->query("
60
-INSERT INTO `deletion_requests`(
61
-  `UserID`,
62
-  `Type`,
63
-  `Value`,
64
-  `Reason`,
65
-  `Time`
66
-)
67
-VALUES(
68
-  '$UserID',
69
-  'Email',
70
-  '".db_string($EncEmails[0])."',
71
-  '".db_string($Reason)."',
72
-  NOW())
73
-");
74
-
75
-$Cache->delete_value('num_deletion_requests');
76
-View::show_header('Email Deletion Request');
77
-?>
78
-
79
-<div>
80
-  <h2>Email Deletion Request</h2>
81
-  <div class="box">
82
-    <p>
83
-      Your request has been sent.
84
-      Please wait for it to be acknowledged.
85
-    </p>
86
-
87
-    <p>
88
-      After it's accepted or denied by staff, you will receive a PM response.
89
-    </p>
90
-
91
-    <p>
92
-      <a href="/index.php">Return</a>
93
-    </p>
94
-  </div>
95
-</div>
96
-<?php
97
-View::show_footer();

+ 0
- 98
sections/delete/take_delete_ip.php View File

@@ -1,98 +0,0 @@
1
-<?php
2
-#declare(strict_types=1);
3
-
4
-enforce_login();
5
-authorize();
6
-
7
-if (!isset($_POST['ips']) || !is_array($_POST['ips'])) {
8
-    error('Stop that.');
9
-}
10
-
11
-if (!apcu_exists('DBKEY')) {
12
-    error(403);
13
-}
14
-
15
-$EncIPs = $_POST['ips'];
16
-$Reason = $_POST['reason'] ?? '';
17
-
18
-foreach ($EncIPs as $EncIP) {
19
-    $DB->query("
20
-    SELECT
21
-      `UserID`
22
-    FROM
23
-      `users_history_ips`
24
-    WHERE
25
-      `IP` = '".db_string($EncIP)."'
26
-    ");
27
-
28
-    if (!$DB->has_results()) {
29
-        error('IP not found');
30
-    }
31
-    list($UserID) = $DB->next_record();
32
-
33
-    if (!check_perms('users_mod') && ($UserID !== $LoggedUser['ID'])) {
34
-        error(403);
35
-    }
36
-
37
-    $DB->query("
38
-    SELECT
39
-      `IP`
40
-    FROM
41
-      `users_main`
42
-    WHERE
43
-      `ID` = '$UserID'
44
-    ");
45
-
46
-    if (!$DB->has_results()) {
47
-        error(404);
48
-    }
49
-
50
-    list($Curr) = $DB->next_record();
51
-    $Curr = Crypto::decrypt($Curr);
52
-
53
-    if ($Curr === Crypto::decrypt($EncIP)) {
54
-        error("You can't delete your current IP.");
55
-    }
56
-}
57
-
58
-// Okay I think everything checks out.
59
-
60
-$DB->query("
61
-INSERT INTO `deletion_requests`(
62
-  `UserID`,
63
-  `Type`,
64
-  `Value`,
65
-  `Reason`,
66
-  `Time`
67
-)
68
-VALUES(
69
-  '$UserID',
70
-  'IP',
71
-  '".db_string($EncIPs[0])."',
72
-  '".db_string($Reason)."',
73
-  NOW())
74
-");
75
-
76
-$Cache->delete_value('num_deletion_requests');
77
-View::show_header('IP Address Deletion Request');
78
-?>
79
-
80
-<div>
81
-  <h2>IP Address Deletion Request</h2>
82
-  <div class="box">
83
-    <p>
84
-      Your request has been sent.
85
-      Please wait for it to be acknowledged.
86
-    </p>
87
-
88
-    <p>
89
-      After it's accepted or denied by staff, you will receive a PM response.
90
-    </p>
91
-
92
-    <p>
93
-      <a href="/index.php">Return</a>
94
-    </p>
95
-  </div>
96
-</div>
97
-<?php
98
-View::show_footer();

+ 0
- 14
sections/register/index.php View File

@@ -164,20 +164,6 @@ if (!empty($_REQUEST['confirm'])) {
164 164
         VALUES
165 165
           ('$UserID')");
166 166
 
167
-            $DB->query("
168
-        INSERT INTO users_history_emails
169
-          (UserID, Email, Time, IP)
170
-        VALUES
171
-          ('$UserID', '".Crypto::encrypt($_REQUEST['email'])."', NULL, '".Crypto::encrypt($_SERVER['REMOTE_ADDR'])."')");
172
-
173
-            if ($_REQUEST['email'] != $InviteEmail) {
174
-                $DB->query("
175
-          INSERT INTO users_history_emails
176
-            (UserID, Email, Time, IP)
177
-          VALUES
178
-            ('$UserID', '".Crypto::encrypt($InviteEmail)."', NOW(), '".Crypto::encrypt($_SERVER['REMOTE_ADDR'])."')");
179
-            }
180
-
181 167
             // Manage invite trees, delete invite
182 168
             if ($InviterID !== null && $InviterID !== 0) {
183 169
                 $DB->query("

+ 0
- 12
sections/tools/data/registration_log.php View File

@@ -136,23 +136,11 @@ if ($DB->has_results()) {
136 136
       <span class="float_left">
137 137
         <?=display_str($Email)?>
138 138
       </span>
139
-      <span class="float_right">
140
-        <a href="userhistory.php?action=email&amp;userid=<?=$UserID?>"
141
-          title="History" class="brackets tooltip">H</a>
142
-        <a href="/user.php?action=search&amp;email_history=on&amp;email=<?=display_str($Email)?>"
143
-          title="Search" class="brackets tooltip">S</a>
144
-      </span><br />
145 139
 
146 140
       <span class="float_left">
147 141
         <?=display_str($InviterEmail)?>
148 142
       </span>
149 143
 
150
-      <span class="float_right">
151
-        <a href="userhistory.php?action=email&amp;userid=<?=$InviterID?>"
152
-          title="History" class="brackets tooltip">H</a>
153
-        <a href="/user.php?action=search&amp;email_history=on&amp;email=<?=display_str($InviterEmail)?>"
154
-          title="Search" class="brackets tooltip">S</a>
155
-      </span><br />
156 144
     </td>
157 145
 
158 146
     <td>

+ 0
- 37
sections/user/advancedsearch.php View File

@@ -257,37 +257,10 @@ if (count($_GET)) {
257 257
         }
258 258
 
259 259
         if (!empty($_GET['email'])) {
260
-            if (isset($_GET['email_history'])) {
261
-                $Distinct = 'DISTINCT ';
262
-            }
263 260
             $Join['the'] = ' JOIN users_emails_decrypted AS he ON he.ID = um1.ID ';
264 261
             $Where[] = ' he.Email '.$Match.wrap($_GET['email']);
265 262
         }
266 263
 
267
-        if (!empty($_GET['email_cnt']) && is_number($_GET['email_cnt'])) {
268
-            $Query = "
269
-        SELECT UserID
270
-        FROM users_history_emails
271
-        GROUP BY UserID
272
-        HAVING COUNT(DISTINCT Email) ";
273
-            if ($_GET['emails_opt'] === 'equal') {
274
-                $operator = '=';
275
-            }
276
-            if ($_GET['emails_opt'] === 'above') {
277
-                $operator = '>';
278
-            }
279
-            if ($_GET['emails_opt'] === 'below') {
280
-                $operator = '<';
281
-            }
282
-            $Query .= $operator.' '.$_GET['email_cnt'];
283
-            $DB->query($Query);
284
-            $Users = implode(',', $DB->collect('UserID'));
285
-            if (!empty($Users)) {
286
-                $Where[] = "um1.ID IN ($Users)";
287
-            }
288
-        }
289
-
290
-
291 264
         if (!empty($_GET['ip'])) {
292 265
             if (isset($_GET['ip_history'])) {
293 266
                 $Distinct = 'DISTINCT ';
@@ -655,12 +628,6 @@ View::show_header('User search');
655 628
   } ?> />
656 629
               <label for="ip_history">IP history</label>
657 630
             </li>
658
-            <li>
659
-              <input type="checkbox" name="email_history" id="email_history" <?php if ($_GET['email_history']) {
660
-      echo ' checked="checked"' ;
661
-  } ?> />
662
-              <label for="email_history">Email history</label>
663
-            </li>
664 631
           </ul>
665 632
         </td>
666 633
         <td class="label nobr">Ratio:</td>
@@ -1061,11 +1028,7 @@ if ($RunQuery) {
1061 1028
                     }
1062 1029
                 }
1063 1030
                 if (!empty($_GET['email'])) {
1064
-                    if (isset($_GET['email_history'])) {
1065
-                        $DB->query("SELECT UserID, Email FROM users_history_emails");
1066
-                    } else {
1067 1031
                         $DB->query("SELECT ID, Email FROM users_main");
1068
-                    }
1069 1032
                     while (list($ID, $EncEmail) = $DB->next_record()) {
1070 1033
                         $Emails[] = $ID.", '".Crypto::decrypt($EncEmail)."'";
1071 1034
                     }

+ 0
- 13
sections/user/take_edit.php View File

@@ -172,19 +172,6 @@ if ($CurEmail !== $_POST['email']) {
172 172
     if (!check_perms('users_edit_profiles')) {
173 173
         require_password("Change Email");
174 174
     }
175
-
176
-    // Update the time of their last email change to the current time *not* the current change.
177
-    $DB->query("
178
-      UPDATE users_history_emails
179
-      SET Time = NOW()
180
-      WHERE UserID = ?
181
-        AND Time IS NULL", $UserID);
182
-
183
-    $DB->query("
184
-      INSERT INTO users_history_emails
185
-        (UserID, Email, Time, IP)
186
-      VALUES
187
-        (?, ?, NULL, ?)", $UserID, Crypto::encrypt($_POST['email']), Crypto::encrypt($_SERVER['REMOTE_ADDR']));
188 175
 }
189 176
 
190 177
 if (!empty($_POST['new_pass_1']) && !empty($_POST['new_pass_2'])) {

+ 0
- 26
sections/user/takemoderate.php View File

@@ -269,32 +269,6 @@ if ($_POST['ResetIPHistory'] && check_perms('users_edit_reset_keys')) {
269 269
       WHERE UserID = $UserID");
270 270
 }
271 271
 
272
-if ($_POST['ResetEmailHistory'] && check_perms('users_edit_reset_keys')) {
273
-    $DB->query("
274
-      DELETE FROM users_history_emails
275
-      WHERE UserID = '$UserID'");
276
-
277
-    if ($_POST['ResetIPHistory']) {
278
-        $DB->query("
279
-          INSERT INTO users_history_emails
280
-            (UserID, Email, Time, IP)
281
-          VALUES
282
-        ('$UserID', '".Crypto::encrypt($Username.'@'.SITE_DOMAIN)."', NULL, '".Crypto::encrypt('127.0.0.1')."')");
283
-    } else {
284
-        $DB->query("
285
-          INSERT INTO users_history_emails
286
-            (UserID, Email, Time, IP)
287
-          VALUES
288
-            ('$UserID', '".Crypto::encrypt($Username.'@'.SITE_DOMAIN)."', NULL, '".$Cur['IP']."')");
289
-    }
290
-
291
-    $DB->query("
292
-      UPDATE users_main
293
-      SET Email = '".Crypto::encrypt($Username.'@'.SITE_DOMAIN)."'
294
-      WHERE ID = '$UserID'");
295
-    $EditSummary[] = 'Email history cleared';
296
-}
297
-
298 272
 if ($_POST['ResetSnatchList'] && check_perms('users_edit_reset_keys')) {
299 273
     $DB->query("
300 274
       DELETE FROM xbt_snatched

+ 4
- 41
sections/user/user.php View File

@@ -275,8 +275,6 @@ if (check_perms('users_edit_profiles', $Class) || $LoggedUser['ID'] == $UserID)
275 275
 }
276 276
 if ($LoggedUser['ID'] == $UserID) {
277 277
     ?>
278
-    <a href="userhistory.php?action=useremail&userid=<?=$UserID?>"
279
-      class="brackets">Email History</a>
280 278
     <a href="userhistory.php?action=userip&userid=<?=$UserID?>"
281 279
       class="brackets">IP History</a>
282 280
     <?php
@@ -591,24 +589,11 @@ $OverallRank = UserRank::overall_score($UploadedRank, $DownloadedRank, $UploadsR
591 589
           AND IP != ''");
592 590
           list($TrackerIPs) = $DB->next_record();
593 591
       }
594
-      if (check_perms('users_view_email', $Class)) {
595
-          $DB->query("
596
-        SELECT COUNT(*)
597
-        FROM users_history_emails
598
-        WHERE UserID = '$UserID'");
599
-          list($EmailChanges) = $DB->next_record();
600
-      } ?>
592
+      ?>
601 593
     <div class="box box_info box_userinfo_history">
602 594
       <div class="head colhead_dark">History</div>
603 595
       <ul class="stats nobullet">
604
-        <?php if (check_perms('users_view_email', $Class)) { ?>
605
-        <li>Emails: <?=number_format($EmailChanges)?> <a
606
-            href="userhistory.php?action=email2&amp;userid=<?=$UserID?>"
607
-            class="brackets">View</a>&nbsp;<a
608
-            href="userhistory.php?action=email&amp;userid=<?=$UserID?>"
609
-            class="brackets">Legacy view</a></li>
610 596
         <?php
611
-    }
612 597
       if (check_perms('users_view_ips', $Class)) {
613 598
           ?>
614 599
         <li>IPs: <?=number_format($IPChanges)?> <a
@@ -683,10 +668,6 @@ if ($ParanoiaLevel == 0) {
683 668
             title="<?=$ParanoiaLevel?>"><?=$ParanoiaLevelText?></span></li>
684 669
         <?php if (check_perms('users_view_email', $Class) || $OwnProfile) { ?>
685 670
         <li>Email: <a href="mailto:<?=display_str($Email)?>"><?=display_str($Email)?></a>
686
-          <?php if (check_perms('users_view_email', $Class)) { ?>
687
-          <a href="user.php?action=search&amp;email_history=on&amp;email=<?=display_str($Email)?>"
688
-            title="Search" class="brackets tooltip">S</a>
689
-          <?php } ?>
690 671
         </li>
691 672
         <?php }
692 673
 
@@ -1463,8 +1444,6 @@ if (!$DisablePoints) {
1463 1444
           <input type="checkbox" name="ResetAuthkey" id="ResetAuthkey" /> <label for="ResetAuthkey">Authkey</label> |
1464 1445
           <input type="checkbox" name="ResetIPHistory" id="ResetIPHistory" /> <label for="ResetIPHistory">IP
1465 1446
             history</label> |
1466
-          <input type="checkbox" name="ResetEmailHistory" id="ResetEmailHistory" /> <label for="ResetEmailHistory">Email
1467
-            history</label>
1468 1447
           <br />
1469 1448
           <input type="checkbox" name="ResetSnatchList" id="ResetSnatchList" /> <label for="ResetSnatchList">Snatch
1470 1449
             list</label> |
@@ -1610,12 +1589,7 @@ if (!$DisablePoints) {
1610 1589
         </td>
1611 1590
       </tr>
1612 1591
       <?php if (check_perms('users_disable_posts') || check_perms('users_disable_any')) {
1613
-        $DB->query("
1614
-      SELECT DISTINCT Email, IP, Time
1615
-      FROM users_history_emails
1616
-      WHERE UserID = $UserID
1617
-      ORDER BY Time ASC");
1618
-        $Emails = $DB->to_array(); ?>
1592
+       ?>
1619 1593
       <tr>
1620 1594
         <td class="label">Disable:</td>
1621 1595
         <td>
@@ -1669,19 +1643,8 @@ if (!$DisablePoints) {
1669 1643
       <tr>
1670 1644
         <td class="label">Hacked:</td>
1671 1645
         <td>
1672
-          <input type="checkbox" name="SendHackedMail" id="SendHackedMail" /> <label for="SendHackedMail">Send hacked
1673
-            account email</label> to
1674
-          <select name="HackedEmail">
1675
-            <?php
1676
-      foreach ($Emails as $Email) {
1677
-          list($Address, $IP) = $Email;
1678
-          $IP = apcu_exists('DBKEY') ? Crypto::decrypt($IP) : '[Encrypted]';
1679
-          $Address = apcu_exists('DBKEY') ? Crypto::decrypt($Address) : '[Encrypted]'; ?>
1680
-            <option value="<?=display_str($Address)?>"><?=display_str($Address)?> - <?=display_str($IP)?>
1681
-            </option>
1682
-            <?php
1683
-      } ?>
1684
-          </select>
1646
+          <input type="checkbox" name="SendHackedMail" id="SendHackedMail" />
1647
+          <label for="SendHackedMail">Send hacked account email</label>
1685 1648
         </td>
1686 1649
       </tr>
1687 1650
 

+ 0
- 154
sections/userhistory/email_history.php View File

@@ -1,154 +0,0 @@
1
-<?php
2
-#declare(strict_types=1);
3
-
4
-/************************************************************************
5
-||------------|| User email history page ||---------------------------||
6
-
7
-This page lists previous email addresses a user has used on the site. It
8
-gets called if $_GET['action'] == 'email'.
9
-
10
-It also requires $_GET['userid'] in order to get the data for the correct
11
-user.
12
-
13
-************************************************************************/
14
-
15
-$UserID = $_GET['userid'];
16
-if (!is_number($UserID)) {
17
-    error(404);
18
-}
19
-
20
-$DB->query("
21
-  SELECT ui.JoinDate, p.Level AS Class
22
-  FROM users_main AS um
23
-    JOIN users_info AS ui ON um.ID = ui.UserID
24
-    JOIN permissions AS p ON p.ID = um.PermissionID
25
-  WHERE um.ID = $UserID");
26
-list($Joined, $Class) = $DB->next_record();
27
-
28
-if (!check_perms('users_view_email', $Class)) {
29
-    error(403);
30
-}
31
-
32
-$UsersOnly = $_GET['usersonly'];
33
-
34
-$DB->query("
35
-  SELECT Username
36
-  FROM users_main
37
-  WHERE ID = $UserID");
38
-list($Username)= $DB->next_record();
39
-View::show_header("Email history for $Username");
40
-
41
-if ($UsersOnly == 1) {
42
-    $DB->query("
43
-    SELECT
44
-      u.Email,
45
-      NOW() AS Time,
46
-      u.IP,
47
-      c.Code
48
-    FROM users_main AS u
49
-      LEFT JOIN users_main AS u2 ON u2.Email = u.Email AND u2.ID != '$UserID'
50
-    WHERE u.ID = '$UserID'
51
-      AND u2.ID > 0
52
-    UNION
53
-    SELECT
54
-      h.Email,
55
-      h.Time,
56
-      h.IP,
57
-      c.Code
58
-    FROM users_history_emails AS h
59
-      LEFT JOIN users_history_emails AS h2 ON h2.email = h.email and h2.UserID != '$UserID'
60
-    WHERE h.UserID = '$UserID'
61
-      AND h2.UserID > 0
62
-    ORDER BY Time DESC");
63
-} else {
64
-    $DB->query("
65
-    SELECT
66
-      u.Email,
67
-      NOW() AS Time,
68
-      u.IP,
69
-      c.Code
70
-    FROM users_main AS u
71
-    WHERE u.ID = '$UserID'
72
-    UNION
73
-    SELECT
74
-      h.Email,
75
-      h.Time,
76
-      h.IP,
77
-      c.Code
78
-    FROM users_history_emails AS h
79
-    WHERE UserID = '$UserID'
80
-    ORDER BY Time DESC");
81
-}
82
-$History = $DB->to_array();
83
-?>
84
-<div class="header">
85
-  <h2>Email history for <a href="user.php?id=<?=$UserID ?>"><?=$Username ?></a></h2>
86
-</div>
87
-<table width="100%">
88
-  <tr class="colhead">
89
-    <td>Email</td>
90
-    <td>Set</td>
91
-    <td>IP <a
92
-        href="userhistory.php?action=ips&amp;userid=<?=$UserID ?>"
93
-        class="brackets">H</a></td>
94
-    <?php if ($UsersOnly == 1) {
95
-    ?>
96
-    <td>User</td>
97
-    <?php
98
-}
99
-?>
100
-  </tr>
101
-  <?php
102
-foreach ($History as $Key => $Values) {
103
-    if (isset($History[$Key + 1])) {
104
-        $Values['Time'] = $History[$Key + 1]['Time'];
105
-    } else {
106
-        $Values['Time'] = $Joined;
107
-    }
108
-
109
-    $ValuesIP = apcu_exists('DBKEY') ? Crypto::decrypt($Values['IP']) : '[Encrypted]'; ?>
110
-  <tr class="row">
111
-    <td><?=display_str($Values['Email'])?>
112
-    </td>
113
-    <td><?=time_diff($Values['Time'])?>
114
-    </td>
115
-    <td><?=display_str($ValuesIP)?> (<?=display_str($Values['Code'])?>) <a
116
-        href="user.php?action=search&amp;ip_history=on&amp;ip=<?=display_str($ValuesIP)?>"
117
-        class="brackets tooltip" title="Search">S</a></td>
118
-    <?php
119
-  if ($UsersOnly == 1) {
120
-      $ueQuery = $DB->query("
121
-          SELECT
122
-            ue.UserID,
123
-            um.Username,
124
-            ue.Time,
125
-            ue.IP
126
-          FROM users_history_emails AS ue, users_main AS um
127
-          WHERE ue.Email = '".db_string($Values['Email'])."'
128
-            AND ue.UserID != $UserID
129
-            AND um.ID = ue.UserID");
130
-      while (list($UserID2, $Time, $IP) = $DB->next_record()) {
131
-          $IP = apcu_exists('DBKEY') ? Crypto::decrypt($IP) : '[Encrypted]'; ?>
132
-  </tr>
133
-  <tr>
134
-    <td></td>
135
-    <td><?=time_diff($Time)?>
136
-    </td>
137
-    <td><?=display_str($IP)?>
138
-    </td>
139
-    <?php
140
-      $UserURL = site_url()."user.php?id=$UserID2";
141
-          $DB->query("
142
-        SELECT Enabled
143
-        FROM users_main
144
-        WHERE ID = $UserID2");
145
-          list($Enabled) = $DB->next_record();
146
-          $DB->set_query_id($ueQuery); ?>
147
-    <td><a href="<?=display_str($UserURL)?>"><?=Users::format_username($UserID2, false, false, true)?></a></td>
148
-  </tr>
149
-  <?php
150
-      }
151
-  }
152
-} ?>
153
-</table>
154
-<?php View::show_footer();

+ 0
- 403
sections/userhistory/email_history2.php View File

@@ -1,403 +0,0 @@
1
-<?php
2
-#declare(strict_types=1);
3
-
4
-/************************************************************************
5
-||------------|| User email history page ||---------------------------||
6
-
7
-This page lists previous email addresses a user has used on the site. It
8
-gets called if $_GET['action'] == 'email'.
9
-
10
-It also requires $_GET['userid'] in order to get the data for the correct
11
-user.
12
-
13
-************************************************************************/
14
-
15
-$UserID = $_GET['userid'];
16
-if (!is_number($UserID)) {
17
-    error(404);
18
-}
19
-
20
-$DB->query("
21
-  SELECT
22
-    ui.JoinDate,
23
-    p.Level AS Class
24
-  FROM users_main AS um
25
-    JOIN users_info AS ui ON um.ID = ui.UserID
26
-    JOIN permissions AS p ON p.ID = um.PermissionID
27
-  WHERE um.ID = $UserID");
28
-list($Joined, $Class) = $DB->next_record();
29
-
30
-if (!check_perms('users_view_email', $Class)) {
31
-    error(403);
32
-}
33
-
34
-// todo: Is this even used?
35
-$UsersOnly = $_GET['usersonly'] ?? false;
36
-
37
-$DB->query("
38
-  SELECT Username
39
-  FROM users_main
40
-  WHERE ID = $UserID");
41
-list($Username) = $DB->next_record();
42
-View::show_header("Email history for $Username");
43
-
44
-// Get current email (and matches)
45
-$DB->query(
46
-    "
47
-  SELECT
48
-    m.Email,
49
-    NOW() AS Time,
50
-    m.IP,
51
-    GROUP_CONCAT(h.UserID SEPARATOR '|') AS UserIDs,
52
-    GROUP_CONCAT(h.Time SEPARATOR '|') AS UserSetTimes,
53
-    GROUP_CONCAT(h.IP SEPARATOR '|') AS UserIPs,
54
-    GROUP_CONCAT(m2.Username SEPARATOR '|') AS Usernames,
55
-    GROUP_CONCAT(m2.Enabled SEPARATOR '|') AS UsersEnabled,
56
-    GROUP_CONCAT(i.Donor SEPARATOR '|') AS UsersDonor,
57
-    GROUP_CONCAT(i.Warned SEPARATOR '|') AS UsersWarned
58
-  FROM users_main AS m
59
-    LEFT JOIN users_history_emails AS h ON h.Email = m.Email
60
-        AND h.UserID != m.ID
61
-    LEFT JOIN users_main AS m2 ON m2.ID = h.UserID
62
-    LEFT JOIN users_info AS i ON i.UserID = h.UserID
63
-  WHERE m.ID = '$UserID'"
64
-);
65
-//$CurrentEmail = array_shift($DB->to_array());
66
-$CurrentEmail = ($DB->to_array())[0]; // Only variables should be passed by reference
67
-
68
-// Get historic emails (and matches)
69
-$DB->query(
70
-    "
71
-  SELECT
72
-    h2.Email,
73
-    h2.Time,
74
-    h2.IP,
75
-    h3.UserID AS UserIDs,
76
-    h3.Time AS UserSetTimes,
77
-    h3.IP AS UserIPs,
78
-    m3.Username AS Usernames,
79
-    m3.Enabled AS UsersEnabled,
80
-    i2.Donor AS UsersDonor,
81
-    i2.Warned AS UsersWarned
82
-  FROM users_history_emails AS h2
83
-    LEFT JOIN users_history_emails AS h3 ON h3.Email = h2.Email
84
-        AND h3.UserID != h2.UserID
85
-    LEFT JOIN users_main AS m3 ON m3.ID = h3.UserID
86
-    LEFT JOIN users_info AS i2 ON i2.UserID = h3.UserID
87
-  WHERE h2.UserID = '$UserID'
88
-  ORDER BY Time DESC"
89
-);
90
-$History = $DB->to_array();
91
-
92
-// Current email
93
-$Current['Email'] = $CurrentEmail['Email'];
94
-$Current['StartTime'] = $History[0]['Time'];
95
-$Current['CurrentIP'] = $CurrentEmail['IP'];
96
-$Current['IP'] = $History[(count($History) - 1)]['IP'];
97
-
98
-// Matches for current email
99
-if ($CurrentEmail['Usernames'] != '') {
100
-    $UserIDs = explode('|', $CurrentEmail['UserIDs']);
101
-    $Usernames = explode('|', $CurrentEmail['Usernames']);
102
-    $UsersEnabled = explode('|', $CurrentEmail['UsersEnabled']);
103
-    $UsersDonor = explode('|', $CurrentEmail['UsersDonor']);
104
-    $UsersWarned = explode('|', $CurrentEmail['UsersWarned']);
105
-    $UserSetTimes = explode('|', $CurrentEmail['UserSetTimes']);
106
-    $UserIPs = explode('|', $CurrentEmail['UserIPs']);
107
-
108
-    foreach ($UserIDs as $Key => $Val) {
109
-        $CurrentMatches[$Key]['Username'] = '&nbsp;&nbsp;&#187;&nbsp;'.Users::format_username($Val, true, true, true);
110
-        $CurrentMatches[$Key]['IP'] = $UserIPs[$Key];
111
-        $CurrentMatches[$Key]['EndTime'] = $UserSetTimes[$Key];
112
-    }
113
-}
114
-
115
-// Email history records
116
-if (count($History) === 1) {
117
-    $Invite['Email'] = $History[0]['Email'];
118
-    $Invite['EndTime'] = $Joined;
119
-    $Invite['AccountAge'] = date(time() + time() - strtotime($Joined)); // Same as EndTime but without ' ago'
120
-    $Invite['IP'] = $History[0]['IP'];
121
-    if (!$Current['StartTime']) {
122
-        $Current['StartTime'] = $Joined;
123
-    }
124
-} else {
125
-    foreach ($History as $Key => $Val) {
126
-        if (isset($History[$Key + 1]) && !$History[$Key + 1]['Time'] && !$Val['Time']) {
127
-            // Invited email
128
-            $Invite['Email'] = $Val['Email'];
129
-            $Invite['EndTime'] = $Joined;
130
-            $Invite['AccountAge'] = date(time() + time() - strtotime($Joined)); // Same as EndTime but without ' ago'
131
-            $Invite['IP'] = $Val['IP'];
132
-        } elseif (isset($History[$Key - 1]) && $History[$Key - 1]['Email'] != $Val['Email'] && $Val['Time']) {
133
-            // Old email
134
-            $i = 1;
135
-            while ($Val['Email'] == $History[$Key + $i]['Email']) {
136
-                $i++;
137
-            }
138
-            $Old[$Key]['StartTime'] = (isset($History[$Key + $i]) && $History[$Key + $i]['Time']) ? $History[$Key + $i]['Time'] : $Joined;
139
-            $Old[$Key]['EndTime'] = $Val['Time'];
140
-            $Old[$Key]['IP'] = $Val['IP'];
141
-            $Old[$Key]['ElapsedTime'] = date(time() + strtotime($Old[$Key]['EndTime']) - strtotime($Old[$Key]['StartTime']));
142
-            $Old[$Key]['Email'] = $Val['Email'];
143
-        }
144
-
145
-        if ($Val['Usernames'] != '') {
146
-            // Match with old email
147
-            $OldMatches[$Key]['Email'] = $Val['Email'];
148
-            $OldMatches[$Key]['Username'] = '&nbsp;&nbsp;&#187;&nbsp;'.Users::format_username($Val['UserIDs'], true, true, true);
149
-            $OldMatches[$Key]['EndTime'] = $Val['UserSetTimes'];
150
-            $OldMatches[$Key]['IP'] = $Val['UserIPs'];
151
-        }
152
-    }
153
-}
154
-
155
-// Clean up arrays
156
-if ($Old ?? false) {
157
-    $Old = array_reverse(array_reverse($Old));
158
-    $LastOld = count($Old) - 1;
159
-    if ($Old[$LastOld]['StartTime'] != $Invite['EndTime']) {
160
-        // Make sure the timeline is intact (invite email was used as email for the account in the beginning)
161
-        $Old[$LastOld + 1]['Email'] = $Invite['Email'];
162
-        $Old[$LastOld + 1]['StartTime'] = $Invite['EndTime'];
163
-        $Old[$LastOld + 1]['EndTime'] = $Old[$LastOld]['StartTime'];
164
-        $Old[$LastOld + 1]['ElapsedTime'] = date(time() + strtotime($Old[$LastOld + 1]['EndTime']) - strtotime($Old[$LastOld + 1]['StartTime']));
165
-        $Old[$LastOld + 1]['IP'] = $Invite['IP'];
166
-    }
167
-}
168
-
169
-// Start page with current email
170
-?>
171
-<div>
172
-  <div class="header">
173
-    <h2>Email history for <a href="user.php?id=<?=$UserID ?>"><?=$Username ?></a></h2>
174
-    <div class="linkbox center">
175
-      <a href="userhistory.php?action=email&amp;userid=<?=$UserID?>"
176
-        class="brackets">Old email history</a>
177
-    </div>
178
-  </div>
179
-  <br />
180
-  <table width="100%">
181
-    <tr class="colhead">
182
-      <td>Current email</td>
183
-      <td>Start</td>
184
-      <td>End</td>
185
-      <td>Current IP <a
186
-          href="userhistory.php?action=ips&amp;userid=<?=$UserID ?>"
187
-          class="brackets">H</a></td>
188
-      <td>Set from IP</td>
189
-    </tr>
190
-    <?php
191
-$Current['Email'] = apcu_exists('DBKEY') ? Crypto::decrypt($Current['Email']) : '[Encrypted]';
192
-$Current['CurrentIP'] = apcu_exists('DBKEY') ? Crypto::decrypt($Current['CurrentIP']) : '[Encrypted]';
193
-$Current['IP'] = apcu_exists('DBKEY') ? Crypto::decrypt($Current['IP']) : '[Encrypted]';
194
-?>
195
-    <tr class="row">
196
-      <td><?=display_str($Current['Email'])?>
197
-      </td>
198
-      <td><?=time_diff($Current['StartTime'])?>
199
-      </td>
200
-      <td></td>
201
-      <td>
202
-        <?=display_str($Current['CurrentIP'])?>
203
-        <a href="user.php?action=search&amp;ip_history=on&amp;ip=<?=display_str($Current['CurrentIP'])?>"
204
-          class="brackets tooltip" title="Search">S</a>
205
-        <a href="http://whatismyipaddress.com/ip/<?=display_str($Current['CurrentIP'])?>"
206
-          class="brackets tooltip" title="Search WIMIA.com">WI</a>
207
-        <br />
208
-        <?=Tools::get_host_by_ajax($Current['CurrentIP'])?>
209
-      </td>
210
-      <td>
211
-        <?=display_str($Current['IP'])?>
212
-        <a href="user.php?action=search&amp;ip_history=on&amp;ip=<?=display_str($Current['IP'])?>"
213
-          class="brackets tooltip" title="Search">S</a>
214
-        <a href="http://whatismyipaddress.com/ip/<?=display_str($Current['IP'])?>"
215
-          class="brackets tooltip" title="Search WIMIA.com">WI</a>
216
-        <br />
217
-        <?=Tools::get_host_by_ajax($Current['IP'])?>
218
-      </td>
219
-    </tr>
220
-    <?php
221
-if ($CurrentMatches ?? false) {
222
-    // Match on the current email
223
-    foreach ($CurrentMatches as $Match) {
224
-        $Match['IP'] = apcu_exists('DBKEY') ? Crypto::decrypt($Match['IP']) : '[Encrypted]'; ?>
225
-    <tr class="row">
226
-      <td><?=$Match['Username']?>
227
-      </td>
228
-      <td></td>
229
-      <td><?=time_diff($Match['EndTime'])?>
230
-      </td>
231
-      <td></td>
232
-      <td>
233
-        <?=display_str($Match['IP'])?>
234
-        <a href="user.php?action=search&amp;ip_history=on&amp;ip=<?=display_str($Match['IP'])?>"
235
-          class="brackets tooltip" title="Search">S</a>
236
-        <a href="http://whatismyipaddress.com/ip/<?=display_str($Match['IP'])?>"
237
-          class="brackets tooltip" title="Search WIMIA.com">WI</a>
238
-        <br />
239
-        <?=Tools::get_host_by_ajax($Match['IP'])?>
240
-      </td>
241
-    </tr>
242
-    <?php
243
-    }
244
-}
245
-// Old emails
246
-if ($Old ?? false) {
247
-    ?>
248
-    <tr class="colhead">
249
-      <td>Old emails</td>
250
-      <td>Start</td>
251
-      <td>End</td>
252
-      <td>Elapsed</td>
253
-      <td>Set from IP</td>
254
-    </tr>
255
-    <?php
256
-  $j = 0;
257
-    // Old email
258
-    foreach ($Old as $Record) {
259
-        ++$j;
260
-
261
-        // Matches on old email
262
-        ob_start();
263
-        $i = 0;
264
-        if ($OldMatches ?? false) {
265
-            foreach ($OldMatches as $Match) {
266
-                if ($Match['Email'] == $Record['Email']) {
267
-                    ++$i;
268
-                    // Email matches
269
-  ?>
270
-    <tr class="row hidden" id="matches_<?=$j?>">
271
-      <td><?=$Match['Username']?>
272
-      </td>
273
-      <td></td>
274
-      <td><?=time_diff($Match['EndTime'])?>
275
-      </td>
276
-      <td></td>
277
-      <td>
278
-        <?=display_str($Match['IP'])?>
279
-        <a href="user.php?action=search&amp;ip_history=on&amp;ip=<?=display_str($Match['IP'])?>"
280
-          class="brackets tooltip" title="Search">S</a>
281
-        <a href="http://whatismyipaddress.com/ip/<?=display_str($Match['IP'])?>"
282
-          class="brackets tooltip" title="Search WIMIA.com">WI</a>
283
-        <br />
284
-        <?=Tools::get_host_by_ajax($Match['IP'])?>
285
-      </td>
286
-    </tr>
287
-    <?php
288
-                }
289
-            }
290
-        }
291
-
292
-        // Save matches to variable
293
-        $MatchCount = $i;
294
-        $Matches = ob_get_contents();
295
-        ob_end_clean();
296
-
297
-        $Record['Email'] = apcu_exists('DBKEY') ? Crypto::decrypt($Record['Email']) : '[Encrypted]';
298
-        $Record['IP'] = apcu_exists('DBKEY') ? Crypto::decrypt($Record['IP']) : '[Encrypted]'; ?>
299
-    <tr class="row">
300
-      <td><?=display_str($Record['Email'])?><?=(($MatchCount > 0) ? ' <a data-toggle-target="#matches_'.$j.'">('.$MatchCount.')</a>' : '')?>
301
-      </td>
302
-      <td><?=time_diff($Record['StartTime'])?>
303
-      </td>
304
-      <td><?=time_diff($Record['EndTime'])?>
305
-      </td>
306
-      <td><?=time_diff($Record['ElapsedTime'])?>
307
-      </td>
308
-      <td>
309
-        <?=display_str($Record['IP'])?>
310
-        <a href="user.php?action=search&amp;ip_history=on&amp;ip=<?=display_str($Record['IP'])?>"
311
-          class="brackets tooltip" title="Search">S</a>
312
-        <a href="http://whatismyipaddress.com/ip/<?=display_str($Record['IP'])?>"
313
-          class="brackets tooltip" title="Search WIMIA.com">WI</a>
314
-        <br />
315
-        <?=Tools::get_host_by_ajax($Record['IP'])?>
316
-      </td>
317
-    </tr>
318
-    <?php
319
-    if ($MatchCount > 0) {
320
-        if (isset($Matches)) {
321
-            echo $Matches;
322
-            unset($Matches);
323
-            unset($MatchCount);
324
-        }
325
-    }
326
-    }
327
-}
328
-// Invite email (always there)
329
-?>
330
-    <tr class="colhead">
331
-      <td>Invite email</td>
332
-      <td>Start</td>
333
-      <td>End</td>
334
-      <td>Age of account</td>
335
-      <td>Registration IP address</td>
336
-    </tr>
337
-    <?php
338
-// Matches on invite email
339
-$i = 0;
340
-ob_start();
341
-if ($OldMatches ?? false) {
342
-    foreach ($OldMatches as $Match) {
343
-        if ($Match['Email'] == $Invite['Email']) {
344
-            ++$i;
345
-            // Match email is the same as the invite email
346
-
347
-            $Match['IP'] = apcu_exists('DBKEY') ? Crypto::decrypt($Match['IP']) : '[Encrypted]'; ?>
348
-    <tr class="row hidden" id="matches_invite">
349
-      <td><?=$Match['Username']?>
350
-      </td>
351
-      <td></td>
352
-      <td><?=time_diff($Match['EndTime'])?>
353
-      </td>
354
-      <td></td>
355
-      <td>
356
-        <?=display_str($Match['IP'])?>
357
-        <a href="user.php?action=search&amp;ip_history=on&amp;ip=<?=display_str($Match['IP'])?>"
358
-          class="brackets tooltip" title="Search">S</a>
359
-        <a href="http://whatismyipaddress.com/ip/<?=display_str($Match['IP'])?>"
360
-          class="brackets tooltip" title="Search WIMIA.com">WI</a>
361
-        <br />
362
-        <?=Tools::get_host_by_ajax($Match['IP'])?>
363
-      </td>
364
-    </tr>
365
-    <?php
366
-        }
367
-    }
368
-}
369
-$MatchCount = $i;
370
-$Matches = ob_get_contents();
371
-ob_end_clean();
372
-
373
-$Invite['Email'] = apcu_exists('DBKEY') ? Crypto::decrypt($Invite['Email']) : '[Encrypted]';
374
-$Invite['IP'] = apcu_exists('DBKEY') ? Crypto::decrypt($Invite['IP']) : '[Encrypted]';
375
-?>
376
-    <tr class="row">
377
-      <td><?=display_str($Invite['Email'])?><?=(($MatchCount > 0) ? ' <a data-toggle-target="#matches_invite">('.$MatchCount.')</a>' : '')?>
378
-      </td>
379
-      <td>Never</td>
380
-      <td><?=time_diff($Invite['EndTime'])?>
381
-      </td>
382
-      <td><?=time_diff($Invite['AccountAge'])?>
383
-      </td>
384
-      <td>
385
-        <?=display_str($Invite['IP'])?>
386
-        <a href="user.php?action=search&amp;ip_history=on&amp;ip=<?=display_str($Invite['IP'])?>"
387
-          class="brackets tooltip" title="Search">S</a>
388
-        <a href="http://whatismyipaddress.com/ip/<?=display_str($Invite['IP'])?>"
389
-          class="brackets tooltip" title="Search WIMIA.com">WI</a>
390
-        <br />
391
-        <?=Tools::get_host_by_ajax($Invite['IP'])?>
392
-      </td>
393
-    </tr>
394
-    <?php
395
-
396
-if ($Matches) {
397
-    echo $Matches;
398
-}
399
-
400
-?>
401
-  </table>
402
-</div>
403
-<?php View::show_footer();

+ 0
- 80
sections/userhistory/email_history_userview.php View File

@@ -1,80 +0,0 @@
1
-<?
2
-$UserID = $_GET['userid'];
3
-if (!is_number($UserID)) {
4
-  error(404);
5
-}
6
-
7
-$Self = ($UserID == $LoggedUser['ID']);
8
-
9
-if (!check_perms('users_mod') && !$Self) {
10
-  error(403);
11
-}
12
-
13
-if (!apcu_exists('DBKEY')) {
14
-  error('The site is currently running with partial database access. Please wait for staff to fully decrypt it');
15
-}
16
-
17
-$DB->query("
18
-  SELECT DISTINCT Email
19
-  FROM users_history_emails
20
-  WHERE UserID = '$UserID'");
21
-
22
-$EncEmails = $DB->collect("Email");
23
-$Emails = [];
24
-
25
-foreach ($EncEmails as $Enc) {
26
-  if (!isset($Emails[Crypto::decrypt($Enc)])) {
27
-    $Emails[Crypto::decrypt($Enc)] = [];
28
-  }
29
-  $Emails[Crypto::decrypt($Enc)][] = $Enc;
30
-}
31
-
32
-$DB->query("
33
-  SELECT Email
34
-  FROM users_main
35
-  WHERE ID = '$UserID'");
36
-
37
-list($Curr) = $DB->next_record();
38
-$Curr = Crypto::decrypt($Curr);
39
-
40
-if (!$Self) {
41
-  $DB->query("SELECT Username FROM users_main WHERE ID = '$UserID'");
42
-  list($Username) = $DB->next_record();
43
-
44
-  View::show_header("Email history for $Username");
45
-} else {
46
-  View::show_header("Your email history");
47
-}
48
-
49
-?>
50
-
51
-<div class="header">
52
-<? if ($Self) { ?>
53
-  <h2>Your email history</h2>
54
-<? } else { ?>
55
-  <h2>Email history for <a href="user.php?id=<?=$UserID ?>"><?=$Username ?></a></h2>
56
-<? } ?>
57
-</div>
58
-<table class="alternate_rows" width="100%">
59
-  <tr class="colhead">
60
-    <td>Email</td>
61
-    <td>Expunge</td>
62
-  </tr>
63
-<? foreach ($Emails as $Email => $Encs) { ?>
64
-  <tr class="row">
65
-    <td><?=display_str($Email)?></td>
66
-    <td>
67
-    <? if ($Email != $Curr) { ?>
68
-      <form action="delete.php" method="post">
69
-        <input type="hidden" name="action" value="email">
70
-        <? foreach ($Encs as $Enc) { ?>
71
-        <input type="hidden" name="emails[]" value="<?=$Enc?>">
72
-        <? } ?>
73
-        <input type="submit" value="X">
74
-      </form>
75
-    <? } ?>
76
-    </td>
77
-  </tr>
78
-<? } ?>
79
-</table>
80
-<? View::show_footer(); ?>

+ 21
- 66
sections/userhistory/index.php View File

@@ -1,126 +1,81 @@
1
-<?
2
-/*****************************************************************
3
-User history switch center
1
+<?php
2
+#declare(strict_types = 1);
4 3
 
4
+/**
5
+ * User history switch center
6
+ */
5 7
 
6
-This page acts as a switch that includes the real user history pages (to keep
7
-the root less cluttered).
8
-
9
-enforce_login() is run here - the entire user history pages are off limits for
10
-non members.
11
-*****************************************************************/
12
-
13
-//Include all the basic stuff...
14 8
 enforce_login();
15 9
 
16 10
 if ($_GET['action']) {
17
-  switch ($_GET['action']) {
11
+    switch ($_GET['action']) {
18 12
     case 'ips':
19 13
       //Load IP history page
20 14
       include('ip_history.php');
21 15
       break;
16
+
22 17
     case 'tracker_ips':
23 18
       include('ip_tracker_history.php');
24 19
       break;
20
+
25 21
     case 'passwords':
26 22
       //Load Password history page
27 23
       include('password_history.php');
28 24
       break;
29
-    case 'email':
30
-      //Load email history page
31
-      include('email_history.php');
32
-      break;
33
-    case 'email2':
34
-      //Load email history page
35
-      include('email_history2.php');
36
-      break;
37
-    case 'useremail':
38
-      include('email_history_userview.php');
39
-      break;
25
+
40 26
     case 'userip':
41 27
       include('ip_history_userview.php');
42 28
       break;
29
+
43 30
     case 'passkeys':
44 31
       //Load passkey history page
45 32
       include('passkey_history.php');
46 33
       break;
34
+
47 35
     case 'posts':
48 36
       //Load ratio history page
49 37
       include('post_history.php');
50 38
       break;
39
+
51 40
     case 'subscriptions':
52 41
       // View subscriptions
53 42
       require('subscriptions.php');
54 43
       break;
44
+
55 45
     case 'thread_subscribe':
56 46
       require('thread_subscribe.php');
57 47
       break;
48
+
58 49
     case 'comments_subscribe':
59 50
       require('comments_subscribe.php');
60 51
       break;
52
+
61 53
     case 'catchup':
62 54
       require('catchup.php');
63 55
       break;
56
+
64 57
     case 'collage_subscribe':
65 58
       require('collage_subscribe.php');
66 59
       break;
60
+
67 61
     case 'subscribed_collages':
68 62
       require('subscribed_collages.php');
69 63
       break;
64
+
70 65
     case 'catchup_collages':
71 66
       require('catchup_collages.php');
72 67
       break;
68
+
73 69
     case 'token_history':
74 70
       require('token_history.php');
75 71
       break;
72
+
76 73
     case 'quote_notifications':
77 74
       require('quote_notifications.php');
78 75
       break;
76
+
79 77
     default:
80 78
       //You trying to mess with me query string? To the home page with you!
81 79
       header('Location: index.php');
82 80
   }
83 81
 }
84
-
85
-/* Database Information Regarding This Page
86
-
87
-users_history_ips:
88
-  id (auto_increment, index)
89
-  userid (index)
90
-  ip (stored using ip2long())
91
-  timestamp
92
-
93
-users_history_passwd:
94
-  id (auto_increment, index)
95
-  userid (index)
96
-  changed_by (index)
97
-  old_pass
98
-  new_pass
99
-  timestamp
100
-
101
-users_history_email:
102
-  id (auto_increment, index)
103
-  userid (index)
104
-  changed_by (index)
105
-  old_email
106
-  new_email
107
-  timestamp
108
-
109
-users_history_passkey:
110
-  id (auto_increment, index)
111
-  userid (index)
112
-  changed_by (index)
113
-  old_passkey
114
-  new_passkey
115
-  timestamp
116
-
117
-users_history_stats:
118
-  id (auto_increment, index)
119
-  userid (index)
120
-  uploaded
121
-  downloaded
122
-  ratio
123
-  timestamp
124
-
125
-*/
126
-?>

+ 0
- 4
templates/admin/advanced-user-search.twig View File

@@ -83,10 +83,6 @@
83 83
                 <input type="checkbox" name="ip_history" id="ip_history"{{ checked(check_ip_history) }} />
84 84
                 <label title="Disabled accounts linked by IP must also be checked" for="ip_history">IP history</label>
85 85
             </li>
86
-            <li>
87
-                <input type="checkbox" name="email_history" id="email_history"{{ checked(check_email_history) }} />
88
-                <label title="Also search the email addresses the member used in the past" for="email_history">Email history</label>
89
-            </li>
90 86
         </ul>
91 87
         </tr>
92 88
     </table></td>

+ 0
- 9
templates/admin/registration.twig View File

@@ -72,15 +72,6 @@
72 72
                 <br />
73 73
                 {{- user.inviter.email -}}
74 74
             </td>
75
-            <td style="vertical-align: top">
76
-                <a href="userhistory.php?action=email&amp;userid={{ user.id }}" title="Email History" class="brackets tooltip">H</a>
77
-                <a href="/user.php?action=search&amp;email_history=on&amp;email={{ user.email }}" title="Email Search" class="brackets tooltip">S</a>
78
-        {%- if user.inviter -%}
79
-                <br />
80
-                <a href="userhistory.php?action=email&amp;userid={{ user.inviter.id }}" title="Email History" class="brackets tooltip">H</a>
81
-                <a href="/user.php?action=search&amp;email_history=on&amp;email={{ user.inviter.email }}" title="Email Search" class="brackets tooltip">S</a>
82
-        {%- endif -%}
83
-            </td>
84 75
             <td style="vertical-align: top">
85 76
                 <span style="float: left">
86 77
                 {{- user.ipaddr -}}

+ 0
- 16
templates/admin/user-info-email.twig View File

@@ -1,16 +0,0 @@
1
-<tr><th colspan="3">Email History</th></tr>
2
-<tr>
3
-    <th>Address</th>
4
-    <th>Registered since</th>
5
-    <th>Registered from</th>
6
-</tr>
7
-{% for i in info %}
8
-<tr class="row{{ cycle(['a', 'b'], loop.index0) }}">
9
-    <td>{{ i.0 }}</td>
10
-    <td>{{ i.1 }}</td>
11
-    <td>{{ i.2 }}
12
-        <a href="user.php?action=search&amp;ip_history=on&amp;ip={{ i.0 }}" class="brackets tooltip" title="Shared with other users?">S</a>
13
-        <a href="https://whatismyipaddress.com/ip/{{ i.0 }}" class="brackets tooltip" title="Search WIMIA.com">WI</a>
14
-    </td>
15
-</tr>
16
-{% endfor %}

+ 0
- 2
templates/user/edit-reset.twig View File

@@ -9,8 +9,6 @@
9 9
         <label for="ResetAuthkey">Authkey</label></span>
10 10
         <span style="white-space: nowrap; padding-right: 15px"><input type="checkbox" name="ResetIPHistory" id="ResetIPHistory" />
11 11
         <label for="ResetIPHistory">IP history</label></span>
12
-        <span style="white-space: nowrap; padding-right: 15px"><input type="checkbox" name="ResetEmailHistory" id="ResetEmailHistory" />
13
-        <label for="ResetEmailHistory">Email history</label></span>
14 12
         <span style="white-space: nowrap; padding-right: 15px"><input type="checkbox" name="ResetSnatchList" id="ResetSnatchList" />
15 13
         <label for="ResetSnatchList">Snatch list</label></span>
16 14
         <span style="white-space: nowrap; padding-right: 15px"><input type="checkbox" name="ResetDownloadList" id="ResetDownloadList" />

+ 0
- 59
templates/user/email-history.twig View File

@@ -1,59 +0,0 @@
1
-<div class="thin">
2
-<div class="header">
3
-    <h2><a href="user.php?id={{ user.id }}">{{ user.username }}</a> &rsaquo; Email history</h2>
4
-</div>
5
-<table>
6
-    <tr><th colspan="3">Email History</th></tr>
7
-    <tr>
8
-        <th>Address</th>
9
-        <th>Registered since</th>
10
-        <th>Registered from</th>
11
-    </tr>
12
-{% for i in user.emailHistory  %}
13
-    <tr class="row{{ cycle(['a', 'b'], loop.index0) }}">
14
-        <td>{{ i.0 }}</td>
15
-        <td>{{ i.1 }}</td>
16
-        <td>{{ i.2 }}
17
-            <a href="user.php?action=search&amp;ip_history=on&amp;ip={{ i.0 }}" class="brackets tooltip" title="Shared with other users?">S</a>
18
-            <a href="https://whatismyipaddress.com/ip/{{ i.0 }}" class="brackets tooltip" title="Search WIMIA.com">WI</a>
19
-        </td>
20
-    </tr>
21
-{% endfor %}
22
-</table>
23
-
24
-{% for r in user.emailDuplicateHistory %}
25
-{% if loop.first %}
26
-<br />
27
-<div class="header">
28
-<h3>Duplicate email addresses used</h3>
29
-</div>
30
-<table>
31
-    <tr>
32
-        <th>Username</th>
33
-        <th>Email</th>
34
-        <th>Registered since</th>
35
-        <th>Registered from</th>
36
-        <th>Enabled</th>
37
-        <th>Donor</th>
38
-        <th>Warned until</th>
39
-    </tr>
40
-{% endif %}
41
-    <tr class="row{{ cycle(['a', 'b'], loop.index0) }}">
42
-        <td><a href="userhistory.php?action=email&userid={{ r.user_id }}">{{ r.user.username }}</a></td>
43
-        <td>{{ r.user.email }}</td>
44
-        <td>{{ r.created }}</td>
45
-        <td>{{ r.ipv4 }}
46
-            <a href="user.php?action=search&amp;ip_history=on&amp;ip={{ r.ipv4 }}" class="brackets tooltip" title="Shared with other users?">S</a>
47
-            <a href="https://whatismyipaddress.com/ip/{{ r.ipv4 }}" class="brackets tooltip" title="Search WIMIA.com">WI</a>
48
-        </td>
49
-        <td>{{ r.user.isEnabled ? 'yes' : 'no' }}</td>
50
-        <td>{{ r.user.isDonor ? 'yes' : 'no' }}</td>
51
-        <td>{{ r.user.isWarned ? r.user.endWarningDate(0) : 'no' }}</td>
52
-    </tr>
53
-{% if loop.last %}
54
-</table>
55
-<br />
56
-{% endif %}
57
-{% endfor %}
58
-<br />
59
-</div>

Loading…
Cancel
Save