]> git.datanom.net - qtadmin.git/commitdiff
Enhance security
authorMichael Rasmussen <mir@datanom.net>
Thu, 11 Jun 2015 16:01:33 +0000 (18:01 +0200)
committerMichael Rasmussen <mir@datanom.net>
Thu, 11 Jun 2015 16:01:33 +0000 (18:01 +0200)
lib/utils.inc.php
mail_report.php

index 9c6be9b51fe8e301a2e59c5d6725e9eacd216826..0b9fe701e4a17199b9807c8e44f39e7363c91457 100644 (file)
@@ -25,7 +25,7 @@ class Utils {
 <body><div id="container">';
     private $footer = '</div><div id="footer"><p>Powered by <a href="https://qtadmin.datanom.net"
             title="Goto QtAdmin homepage">QtAdmin</a>. &copy; 2015 by Michael Rasmussen</p>
-       </div></body></html>';
+    </div></body></html>';
     private $heading = '<p id="time" class="time">Session timeout:
             <span id="timer"></span></p><h1 class="h1">__TITLE__</h1>';
 
@@ -314,6 +314,16 @@ class Utils {
         return $user;
     }
 
+    public function authorized($recipient) {
+        $authorized = false;
+
+        if ($this->isAdmin() || $this->getUser() == $recipient) {
+            $authorized = true;
+        }
+
+        return $authorized;
+    }
+
     public function getHeader() {
         $this->log("getHeader", 4);
 
index 21e826465d0a42d61bc9e219a045678deafed136..60405f7d124df6aab50cbc9684dc8a7ac5c13945 100644 (file)
@@ -8,13 +8,18 @@
     $util = new Utils;
     $loggedIn = $util->isLoggedIn();
     if ($loggedIn && isset($_GET['id'])) {
+        $id = $_GET['id'];
+        $mail = unserialize($_SESSION['mailInfo'][$id]);
+
+        if (false == $util->authorized($mail->recipient)) {
+            header('Location: index.php');
+            exit;
+        }
+
         $util->setHeading('Spam Report');
         echo $util->getHeader();
         echo $util->getHeading();
 
-        $id = $_GET['id'];
-        $mail = unserialize($_SESSION['mailInfo'][$id]);
-
         $row = $DB->getMail($id);
         $string = $row->mail_text;
         $sa_tests = null;
This page took 0.034867 seconds and 5 git commands to generate.