Example #1
0
.listright {
	background-color: #e9f3ff;
	width: 65%;
	padding: 10px 0px 10px 10px;
}
</style>
<?php 
outHtml2("View User: "******"db/Users/" . $_GET['userId'] . ".dat"));
echo "<tr><td class='listLeft'>Name</td><td class='listRight'>" . $temp->getUserId() . "</td></tr>";
if ($temp->isBanned() == 'false') {
    echo "<tr><td class='listLeft'>Banned</td><td class='listRight'>No</td></tr>";
} else {
    echo "<tr><td class='listLeft'>Banned</td><td class='listRight'>Yes</td></tr>";
}
if ($temp->isHideEmail() == false && $_SESSION['loggedIn'] == true) {
    echo "<tr><td class='listLeft'>Email Address</td><td class='listRight'>" . $temp->getEmail() . "</td></tr>";
}
echo "<tr><td class='listLeft'>Join Date</td><td class='listRight'>" . $temp->getJoinDate() . "</td></tr>";
echo "<tr><td class='listLeft'>No Of Posts</td><td class='listRight'>" . $temp->getNoPosts() . "</td></tr>";
echo "<tr><td class='listLeft'>No Of Topics</td><td class='listRight'>" . $temp->getNoTopics() . "</td></tr>";
echo "<tr><td class='listLeft'>Level</td><td class='listRight'>" . $temp->getLevel() . "</td></tr>";
if ($temp->getSig() != "") {
    echo "<tr><td class='listLeft'>Signature</td><td class='listRight'>" . $temp->getSig() . "</td></tr>";
}
if ($temp->getAvatar() != "") {
<?php

include "common.php";
$dir = dir("db/Users/");
while ($filename = $dir->read()) {
    if ($filename != "." && $filename != "..") {
        $filename = substr($filename, 0, strlen($filename) - 4);
        $temp = new User(file_get_contents("db/Users/" . $filename . ".dat"));
        if ($temp->getLevel() != $_POST[$filename][0] || $temp->isBanned() == 'false' && $_POST[$filename][1] == "yes" || $temp->isBanned() != 'false' && $_POST[$filename][1] != "yes") {
            $fileC = file("db/Users/" . $filename . ".dat", FILE_IGNORE_NEW_LINES);
            if ($_POST[$filename][0] == 1 || $_POST[$filename][0] == 2 || $_POST[$filename][0] == 3) {
                $fileC[6] = $_POST[$filename][0];
            }
            if ($_POST[$filename][1] == "yes") {
                $fileC[2] = "true";
            } else {
                $fileC[2] = "false";
            }
            $str = "";
            foreach ($fileC as $line) {
                $str .= $line . "\n";
            }
            file_put_contents("db/Users/" . $filename . ".dat", $str);
        }
    }
}
header("location: userAdmin.php");
 public function testBanUser()
 {
     $app = $this->app;
     $appPath = $app['path.base'];
     $app['path.base'] = $appPath . '/..';
     $commentRepo = $this->app->make('MicheleAngioni\\MessageBoard\\Repos\\EloquentCommentRepository');
     $likeRepo = $this->app->make('MicheleAngioni\\MessageBoard\\Repos\\EloquentLikeRepository');
     $postRepo = $this->app->make('MicheleAngioni\\MessageBoard\\Repos\\EloquentPostRepository');
     $purifier = $this->app->make('MicheleAngioni\\MessageBoard\\PurifierInterface');
     $presenter = $this->app->make('MicheleAngioni\\Support\\Presenters\\Presenter');
     $viewRepo = $this->app->make('MicheleAngioni\\MessageBoard\\Repos\\EloquentViewRepository');
     $app['path.base'] = $appPath;
     $app['config']['auth.model'] = 'User';
     $app['config']['ma_messageboard.message_types'] = ['public_mess', 'private_mess'];
     $app['config']['ma_messageboard.posts_per_page'] = 20;
     $app['config']['ma_messageboard.user_named_route'] = 'user';
     $mbGateway = new MicheleAngioni\MessageBoard\MbGateway($commentRepo, $likeRepo, $postRepo, $presenter, $purifier, $viewRepo, $app);
     $user = new User();
     $user->id = 1;
     $user->save();
     $this->assertFalse($user->isBanned());
     $mbGateway->banUser($user, 3, $reason = 'Ban');
     $user = User::find(1);
     $this->assertTrue($user->isBanned());
 }
Example #4
0
 /**
  *
  * @return Message
  */
 public function postMessage(User $objRecipient, $strContent)
 {
     $strContent = trim($strContent);
     if ($objRecipient->isBanned() || $objRecipient->getId() == $this->getId()) {
         throw new Exception('Can\'t send message to ' . $objRecipient->getLogin());
     }
     if (empty($strContent)) {
         throw new Exception('Can\'t send empty message to ' . $objRecipient->getLogin());
     }
     $objMessage = new Message(['sender_id' => $this->getId(), 'recipient_id' => $objRecipient->getId(), 'unread' => 1, 'message' => $strContent]);
     $objMessage->save();
     return $objMessage;
 }
Example #5
0
<?php

session_start();
include_once "class.User.php";
include_once "function.OnlineList.php";
if (file_exists("db/Users/" . $_POST['username'] . ".dat")) {
    $str = file_get_contents("db/Users/" . $_POST['username'] . ".dat");
    $user = new User($str);
    if ($_POST['password'] == $user->getPassword()) {
        if ($user->isBanned() == 'false') {
            if ($_POST['remember'] == 'checked') {
                setcookie("username", $_POST['username'], time() + 60 * 60 * 24 * 14);
                setcookie("password", $_POST['password'], time() + 60 * 60 * 24 * 14);
            }
            $_SESSION['loggedIn'] = true;
            $_SESSION['user'] = $user;
            removeGuest($_SERVER['SERVER_ADDR']);
            header("location: index.php");
            exit;
        } else {
            header("location: login.php?badLogin=2");
            exit;
        }
    } else {
        header("location: login.php?badLogin=1");
        exit;
    }
}
header("location: login.php?badLogin=1");