// Desativa users ociosos UsersModel::userDeleteIdle(); // Dados enviados if (count($_POST)) { $user = substr($_POST['user'], 0, 20); $user = Filters::convert($user); $captcha = $_POST['captcha']; $id_room = (int) $_POST['id_room']; if ($_SESSION['captcha_code'] == $captcha) { // Rooms $rooms_model = new RoomsModel(); $room = $rooms_model->load($id_room); if (count($room)) { // Users online $users_model = new UsersModel(); $users_model->setFieldsSelect(array('user')); $users_model->setCond('id_room = ' . $id_room); $users_model->setOrderBy('chat_users.id'); $users = $users_model->load_all(); $total = $users_model->count(); if ($room['capacity'] > $total) { // Verifica se tem user com o mesmo nome $users_model = new UsersModel(); $users_model->setCond('user = "******"'); $users = $users_model->load_all(); // IP's bloqueados $ip_model = new IpBlockModel(); $ip_model->setCond('ip = "' . $_SERVER['REMOTE_ADDR'] . '"'); $ip = $ip_model->load_all(); if (count($ip)) { $message = 'You are blocked from accessing chat.';
<th>IP</th> <th>Active</th> <th>Room</th> <th>Capacity</th> <th>Capacity exclusive</th> </tr> </thead> <tbody> <?php $conditions = null; if (isset($_GET['room'])) { $id_room = (int) $_GET['room']; $conditions = 'chat_rooms.id = ' . $id_room; } $users_model = new UsersModel(); $users_model->setFieldsSelect(array('chat_users.*', 'chat_rooms.room', 'chat_rooms.description', 'chat_rooms.capacity', 'chat_rooms.capacity_exclusive')); $users_model->setJoin('INNER JOIN chat_rooms ON (chat_users.id_room = chat_rooms.id)'); $users_model->setCond($conditions); $users = $users_model->load_all(); foreach ($users as $user) { echo '<tr>'; echo '<td><a href="?delete=' . $user['id'] . '">Delete User</a> | <a href="?block_ip=' . $user['ip'] . '">Block IP</a> | <a href="?block_user='******'id'] . '">Block User</a></td>'; echo '<td>' . $user['id'] . '</td>'; echo '<td>' . $user['user'] . '</td>'; echo '<td>' . $user['ip'] . '</td>'; echo '<td>' . ($user['active'] ? 'Yes' : 'No ') . '</td>'; echo '<td>' . $user['room'] . '</td>'; echo '<td>' . $user['capacity'] . '</td>'; echo '<td>' . $user['capacity_exclusive'] . '</td>'; echo '</tr>'; }