Welcome Guest, Not a member yet? Register   Sign In
Error 404 Ci4 on remote hosting
#1

Hello good! In my current project it works perfect for me on localhost (all the ccontrollers without exception), but when I install it remotely, some ccontrollers work and others don't, and in turn, all the files in the / public / folder other than the / folders css / and / js /, I leave the codes used.

I already tried changing the .htaccess, but it does not seem to have any fault, and the only thing I see that they have different is the ResponseTrait, but is it not an error?

https://epmo.tech/seguridad/roles    <-- work
https://epmo.tech/login/actual          <-- don't work , why?

this one doesn't work:
PHP Code:
<?php
namespace App\Controllers;

use 
App\Models\Persona;
use 
App\Models\SeguridadRolPersona;
use 
mysql_xdevapi\Session;

class 
Login extends BaseController
{
    public function index(){
        $inputs $_POST;

        $pModel = new Persona();
        $data $pModel->where(['dni' => $inputs['dni'],'password' => sha1($inputs['password'])])->findAll();

        if(count($data) > ){
            $usuario $data[0];
            $sModel = new SeguridadRolPersona();
            $data2 $sModel->where('idpersona' $usuario['idpersona'])->findAll();
            if($data2 == true){
                $rol $data2[0];
                $session = \Config\Services::session();
                unset($usuario['idpersona']);
                $out array_merge($usuario $rol);
                $session->set(array('datos' => $out));
                die(json_encode(['error' => null'data' => $out]));
            }
            else{
                die(json_encode(['error' => 'No se le asigno el rol al usuario, solicitelo al admin.']));
            }
        }
        else{
            die(json_encode(['error' => 'Datos incorrectos']));
        }
    }

    public function actual(){
        $session = \Config\Services::session();
        //die(print_r($session->datos));
        $usr $session->datos;
        if(is_array($usr)){
            die(json_encode(['error' => null'data' => $usr]));
        }
        else{
            die(json_encode(['error' => 'No hay sesion iniciada']));
        }
    }

    public function cerrar(){
        $session = \Config\Services::session();
        $session->destroy();
        die(json_encode(['error' => null'msj' => 'Session cerrada']));
    }


This Works:

PHP Code:
<?php

namespace App\Controllers;
use 
App\Models\SeguridadAccesos;
use 
App\Models\SeguridadModulos;
use 
App\Models\SeguridadPermisos;
use 
App\Models\SeguridadRol;
use 
CodeIgniter\API\ResponseTrait;

class 
Seguridad extends BaseController
{
    use ResponseTrait;

    public function Roles(){
        $rolModel = new SeguridadRol();
        $data $rolModel->findColumn('rol');
        die(json_encode($data));
    }

    public function ModulosGenerales(){
        $rolModel = new SeguridadModulos();
        $data $rolModel->findColumn('modulo');
        die(json_encode($data));
    }

    public function Permisos(){
        $rolModel = new SeguridadPermisos();
        $data $rolModel->findColumn('permiso');
        die(json_encode($data));
    }


    public function PermisosDefault(){
        $AccesoNodel = new SeguridadAccesos();

        for($i 1;$i <= 4;$i++){
            for($k 1;$k <= 10;$k++){
                $data = [
                    'idpermiso' => ($i == 1) ? 2//si es administrador tiene lectura y escritura, si no, negado
                    'rol_idrol'    => $i,
                    'idmodulo'    => $k,
                ];
                $AccesoNodel->insert($data);
            }
        }
    }

Reply
#2

I managed to solve the problem, what happened was that the driver that I edited in my hosting was not the same, and it was incomplete.

Also just in case I gave all the permissions to the server's .htaccess to avoid problems, thanks to those who read!
Reply




Theme © iAndrew 2016 - Forum software by © MyBB