Pagina de Ban

2 participantes

Luan Martins Luan Martins  • 19.01.16 19:34

Pagina de Ban Empty Pagina de Ban 19.01.16 19:34

Olá pessoal, baixei a One CMSestava testando quando me deparei com o seguinte erro:

Fatal error: Can't use method return value in write context in C:\xampp\htdocs\ACP4.0\bans.php


Abrir a pasta ACP4.0
Abrir o arquivo bans.php
Substituir tudo pelo código informado


Fui investigar, e percebi que havia um erro na condição usada estava sendo usado ou = || e no caso deveria ser se = && 

em fim, abaixo o print da pagina funcionando


Link https://uploaddeimagens.com.br/images/000/556/456/full/banfuncionando.png?1453239008


Não editei pq n vou usar, mais pra quem quiser é super facil.
[Tens de ter uma conta e sessão iniciada para poderes visualizar esta imagem]


Aqui o Codigo da pagina

Código:
<?php
ob_start();
 require_once '../global.php';
 $TplClass->SetParam('title', 'Baneos');
 $TplClass->SetParam('zone', 'Banear');
 $Functions->LoggedHk("true");
 
 $users = $db->query("SELECT * FROM users WHERE username = '{$_SESSION['username']}' AND password = '{$_SESSION['password']}'");
 $user = $users->fetch_array();
 $action = $Functions->FilterText($_GET['action']);
 $id = $Functions->FilterText($_GET['id']);
 
 if($user['rank'] <= 7){
 $_SESSION['ERROR_RETURN'] = "Herramienta solo para cargos altos";
 header("LOCATION: ". HK ."/");
 exit;
 }

 $TplClass->SetAll();
 if( $_SESSION['ERROR_RETURN'] ){
 $TplClass->SetParam('error', '<div id="generic"><div id="error">'.$_SESSION['ERROR_RETURN'].'</div></div>');
 unset($_SESSION['ERROR_RETURN']);
 }
 if( $_SESSION['GOOD_RETURN'] ){
 $TplClass->SetParam('error', '<div id="generic"><div id="error" style="background: #88B600;border: 1px solid #88B600;">'.$_SESSION['GOOD_RETURN'].'</div></div>');
 unset($_SESSION['GOOD_RETURN']);
 }
 $result = $db->query("SELECT * FROM cms_settings WHERE id = 1 LIMIT 1");
 $data = $result->fetch_array();
 $SHORTNAME = $data['hotelname'];
 $FACE = $data['facebook'];
 $LOGO = $data['logo'];
 if($_POST['addban']){
 $check = $db->query("SELECT * FROM users WHERE username = '".$Functions->FilterText($_POST['user'])."' LIMIT 1");
 $row = $check->fetch_array();
 $checkb = $db->query("SELECT * FROM users_bans WHERE value = '".$Functions->FilterText($_POST['user'])."' || '".$Functions->FilterText($row['ip_last'])."' LIMIT 1");
 $actv = $checkb->fetch_array();
 if(isset($_POST['user']) && isset($_POST['time']) && isset($_POST['tipo']) && isset($_POST['razon'])){
 $time = $Functions->FilterText($_POST['time']);
 $razon = $Functions->FilterText($_POST['razon']);
 
 if($actv['expire'] > time()){
 $_SESSION['ERROR_RETURN'] = "El usuario ya se encuentra Baneado";
 header("LOCATION: ". HK ."/bans.php");
 }else{
 if($check->num_rows > 0){
 $db->query("DELETE FROM users_bans WHERE value = '".$Functions->FilterText($_POST['user'])."' || '".$Functions->FilterText($row['ip_last'])."' LIMIT 1");
 if($row['rank'] >= $Functions->Get('rank')){
 $_SESSION['ERROR_RETURN'] = "No puedes banear a un superior o a ti mismo";
 header("LOCATION: ". HK ."/bans.php");
 }else{
 $db->query("INSERT INTO cms_stafflogs (username, action, message, rank, userid, timestamp) VALUES ('". $_SESSION['username'] ."','Baneos', 'Baneo a ". $row['username'] .", Razón: ".$razon."', '". $user['rank'] ."', '". $user['id'] ."', '".date("Y-m-d ")."')");
 if($_POST['tipo'] == "2"){
 $banuuu = $row['ip_last'];
 $baneee = "machine";
 }else{
 $banuuu = $Functions->FilterText($_POST['user']);
 $baneee = "user";
 }
 $dbAdd= array();
 $dbAdd['id'] = NULL;
 $dbAdd['bantype'] = $baneee;
 $dbAdd['value'] = $banuuu;
 $dbAdd['reason'] = $razon;
 $dbAdd['expire'] = time() + $time;
 $dbAdd['added_by'] = $_SESSION['username'];
 $dbAdd['added_date'] = time();
 $query = $db->insertInto('users_bans', $dbAdd);
 //$db->query("INSERT INTO users_bans_access (user_id, ip, attempts) VALUES ('". $row['id'] ."', '". $row['ip_last'] ."', '1')");
 $_SESSION['GOOD_RETURN'] = "Usuario Baneado correctamente";
 header("LOCATION: ". HK ."/bans.php");
 }
 }else{
 $_SESSION['ERROR_RETURN'] = "No puedes banear a este usuario";
 header("LOCATION: ". HK ."/bans.php");
 
 }
 }
 }
 }
 
 if($action == "err" && !empty($id)){
 $db->query("INSERT INTO cms_stafflogs (username, action, message, rank, userid, timestamp) VALUES ('". $_SESSION['username'] ."','Desbaneos', 'Ha desbaneado a un usuario', '". $user['rank'] ."', '". $user['id'] ."', '".date("Y-m-d ")."')");
 $db->query("DELETE FROM users_bans WHERE id = '{$id}' LIMIT 1");
 $_SESSION['GOOD_RETURN'] = "Baneo borrado correctamente";
 header("LOCATION: ". HK ."/bans.php");
 }
 $TplClass->AddTemplateHK("templates", "header");
 ob_end_flush();
?>
 <html>
 <body>
 <div class="row">
 <div class="col-lg-12">
 <div class="panel border-1 border-red-300">
 <div class="panel-title bg-red-300">
 <div class="panel-head color-white"><i class="fa fa-user-times"></i> Baneos del Hotel</div>
 </div>
 <div class="panel-body" style="padding:3px;max-height:800px;display: block;overflow: auto;">
 <tab[b][/b]le border="1" style="width:100%">
  <tr>
 <th style="padding:3px;"><center>Usuario</center></th>
 <th style="padding:3px;"><center>Estado</center></th>
 <th style="padding:3px;"><center>Razón</center></th>
 <th style="padding:3px;"><center>Banido por</center></th>
 <th style="padding:3px;"><center>IP</center></th>
 <th style="padding:3px;"><center>Desde</center></th>
 <th style="padding:3px;"><center>Ate</center></th>
 <th style="padding:3px;"><center>IP-Ban</center></th>
 <th style="padding:3px;"><center>Quitar Ban</center></th>
  </tr>
 <tbody>
 <?php global $db;
 $get_bans = $db->query("SELECT * FROM users_bans ORDER BY id DESC");
 if($get_bans->num_rows > 0){
 while($row = $get_bans->fetch_array()){
 if($row['bantype'] == 'user'){
 $userdata = $db->query("SELECT * FROM users WHERE username = '".$row['value']."'");
 $users = $userdata->fetch_array();
 $ip_last = $users['ip_last'];
 $ip = 'No';
 }else{
 $ip_last = $row['value'];
 $ip = 'Sí';
 }
 $minuten = $row['expire'] - time();
 if(time() >= $row['expire']){
 $stat = "Expirado";
 $color="green";
 }elseif(time() + 3600 >= $row['expire']){
 if(date('i', $minuten) > 0){
 $stat = "(Le restan ".date('i', $minuten)." minutos)";
 $color="red";
 }else{
 $stat = "(Le restan ".date('s', $minuten)." segundos)";
 $color="red";
 }
 }else{
 $stat = "Activo";
 $color="red";
 } ?>
 <tr>
 <td style="width:10%;padding:3px;"><center><?php echo $row['value']; ?></center></td>
 <td style="width:8%;padding:3px;"><center><b style="color:<?php echo $color; ?>"><?php echo $stat; ?></b></center></td>
 <td style="width:20%;padding:3px;"><center><?php echo $row['reason']; ?></center></td>
 <td style="width:10%;padding:3px;"><center><?php echo $row['added_by']; ?></center></td>
 <td style="width:12%;padding:3px;"><center><?php echo $ip_last; ?></center></td>
 <td style="padding:3px;"><center><?php setlocale(LC_TIME,"spanish"); echo utf8_encode(strftime("%A %d de %B del %Y", $row['added_date'])); ?></center></td>
 <td style="padding:3px;"><center><?php setlocale(LC_TIME,"spanish"); echo utf8_encode(strftime("%A %d de %B del %Y", $row['expire'])); ?></center></td>
 <td style="width:3%;padding:3px;"><center><?php echo $ip; ?></center></td>
 <td style="width:3%;padding:3px;"><center><a href="<?php echo HK; ?>/bans.php?action=err&id=<?php echo $row['id']; ?>"><img src="<?php echo CDN; ?>/images/icons/del.gif"></a></center></td>
 </tr>
 <?php } }else{ echo "<center><b style='color:red;'>No hay usuarios baneados</b></center>"; }?>
 </tbody>
 </tab[b][/b]le>
 </div>
 </div>
 </div>
 <div class="col-lg-6">
 <div class="panel border-1 border-red-500">
 <div class="panel-title bg-red-500">
 <div class="panel-head color-white"><i class="fa fa-user-times"></i> Banea un Usuario</div>
 </div>
 <div class="panel-body">
 <form action="" method="post">
 <p class="text-light margin-bottom-20">Rellena todos los campos para agregar un Baneo</p>
 <div class="form-group">
 <label for="input-text" class="control-label">Usuario</label>
 <input type="text" class="form-control" id="input-text" name="user" placeholder="Usuario a Banear" value="">
 </div>
 <div class="form-group">
 <label for="input-text" class="control-label">Duración</label>
 <script type="text/javascript">function banPreset(val){document.getElementById('banlength').value = val;}</script>
 <input type="text" name="time" id="banlength" class="form-control" value="" placeholder="Tiempo en segundos"><br />
 <small>
 <a href="#addban" onclick="banPreset(3600);">1 hora,</a>
 <a href="#addban" onclick="banPreset(7200);">2 horas,</a>
 <a href="#addban" onclick="banPreset(10800);">3 horas,</a>
 <a href="#addban" onclick="banPreset(14400);">4 horas,</a>
 <a href="#addban" onclick="banPreset(43200);">12 horas,<br><br></a>
 <a href="#addban" onclick="banPreset(86400);">1 dia,</a>
 <a href="#addban" onclick="banPreset(259200);">3 dias,<br><br></a>
 <a href="#addban" onclick="banPreset(604800);">1 semana,</a>
 <a href="#addban" onclick="banPreset(1209600);">2 semanas,<br><br></a>
 <a href="#addban" onclick="banPreset(2592000);">1 mes,</a>
 <a href="#addban" onclick="banPreset(7776000);">3 meses,<br><br></a>
 <a href="#addban" onclick="banPreset(1314000);">1 año,</a>
 <a href="#addban" onclick="banPreset(2628000);">2 años,</a>
 <a href="#addban" onclick="banPreset(360000000);">> 10 años</a>
 </small>
 </div>
 <div class="form-group">
 <label for="input-text" class="control-label">Banear por IP o User</label>
 <br><select class="form-control"name="tipo">
 <option value="1">Banear por nombre</option>
 <option value="2">Banear también por IP</option>
 </select>
 </div>
 <div class="form-group">
 <label for="input-text" class="control-label">Razón</label>
 <input type="text" class="form-control" id="input-text" name="razon" placeholder="Razón del Baneo" value="">
 </div>
 <input name="addban" type="submit" class="btn btn-dark bg-blue-grey-800 color-white margin-left-10" value="Banear">
 </form>
 </div>
 </div>
 </div>
 <div class="col-lg-6 col-md-6 col-sm-12 col-xs-12">
 <?php require_once 'templates/facebook.tpl'; ?>
 </div>
 </div>
 <?php require_once 'templates/footer.tpl'; ?>
 </body>
 </html>
<?php ob_end_flush(); ?>


Última edição por megalodonte em 19.01.16 19:43, editado 1 vez(es)

Peeta Peeta  • 19.01.16 19:40

Pagina de Ban Empty Re: Pagina de Ban 19.01.16 19:40

Only cms? wtf isso dai é o painel da One cms v4

Luan Martins Luan Martins  • 19.01.16 19:41

Pagina de Ban Empty Re: Pagina de Ban 19.01.16 19:41

ashashasash Digitei errado
Permissões neste sub-fórum
Não podes responder a tópicos

BH Servers

Recomendamos a BH Servers com proteção DDOS gratuita em Cloud Server de alta performance. Entrega imediata.