Find this useful? Enter your email to receive occasional updates for securing PHP code.
Signing you up...
Thank you for signing up!
PHP Decode
<?php namespace App\Http\Controllers; use Illuminate\Http\Request; use App\Valores;..
Decoded Output download
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Valores;
use App\ValoresDetalles;
use DB;
use Validator;
use Redirect;
class ValorController extends Controller
{
public function index()
{
try {
$valores = Valores::select("concepto", "tipo", "habilitado", "costo", "gestion", "valores.id", "valor_primero", "obs_concepto", "valor_pre")->join("valores_detalles", "valores_detalles.valor_id", "valores.id")->orderBy("valores.tipo", "asc")->orderBy("valores.id", "asc")->get();
return view("valor.index", compact("valores"));
} catch (\Exception $e) {
return view("errors.404");
}
}
public function create()
{
try {
$id_concepto = Valores::orderby("id", "DESC")->select("id")->first();
return view("valor.create", compact("id_concepto"));
} catch (\Exception $e) {
return view("errors.404");
}
}
public function store(Request $request)
{
DB::beginTransaction();
try {
$rules = array("concepto" => array("required", "min:3", "max:200"), "tipo" => array("required"), "habilitado" => array("required"), "tipo_alm" => array("required"), "costo" => array("required:numeric"));
$validation = Validator::make($request->all(), $rules);
if ($validation->fails()) {
return Redirect::back()->withInput()->withErrors($validation);
}
$valor = new Valores();
$valor->id_concepto = $request->id_concepto;
$valor->concepto = trim($request->concepto);
$valor->habilitado = $request->habilitado;
if ($request->tipo_alm == "SI" || $request->tipo_alm == "NO") {
$valor->valor_primero = $request->tipo_alm;
} elseif ($request->tipo_alm == "valor_pre") {
$valor->valor_pre = "SI";
}
$valor->tipo = $request->tipo;
if ($request->tipo == "MT") {
if ($request->curso == null && $request->matricula_especial_checked == null && $request->matricula_programa_checked == null) {
return redirect()->back()->with("errorinfo", "SELECIONE POR LO MENOS UN CURSO O UNA OPCION");
} else {
$valor->obs_concepto = $request->obs_concepto;
if ($request->curso != null) {
$valor->cursos = json_encode($request->curso);
} elseif ($request->matricula_programa_checked) {
$valor->cursos = json_encode($request->matricula_programa_checked);
} elseif ($request->matricula_especial_checked) {
$valor->cursos = json_encode($request->matricula_especial_checked);
$valor->matricula_especial = trim($request->matricula_especial);
}
}
}
$valor->save();
$valor_detalle = new ValoresDetalles();
$valor_detalle->costo = $request->costo;
$valor_detalle->gestion = date("Y");
$valor_detalle->valor_id = $valor->id;
$valor_detalle->save();
\DB::commit();
return redirect()->to("valor")->with("info", "LOS DATOS FUERON REGISTRADOS CON EXITO!");
} catch (\Exception $e) {
\DB::rollback();
return redirect()->back()->with("errorinfo", "ERROR AL REGISTRAR");
}
}
public function edit($id)
{
try {
$valor = Valores::select("valores.id", "concepto", "tipo", "cursos", "costo", "valor_primero", "habilitado", "matricula_especial", "obs_concepto", "valor_pre")->join("valores_detalles", "valores_detalles.valor_id", "=", "valores.id")->where("valores.id", $id)->first();
return view("valor.edit", compact("valor"));
} catch (\Exception $e) {
return view("errors.404");
}
}
public function update(Request $request)
{
DB::beginTransaction();
try {
$rules = array("concepto" => array("required", "min:3", "max:200"), "tipo" => array("required"), "habilitado" => array("required"), "tipo_alm" => array("required"), "costo" => array("required:numeric"));
$validation = Validator::make($request->all(), $rules);
if ($validation->fails()) {
return Redirect::back()->withInput()->withErrors($validation);
}
$valor = Valores::find($request->id);
$valor->concepto = trim($request->concepto);
$valor->habilitado = $request->habilitado;
if ($request->tipo_alm == "valor_pre") {
$valor->valor_pre = "SI";
} else {
$valor->valor_primero = $request->tipo_alm;
}
$valor->tipo = $request->tipo;
if ($request->tipo == "MT") {
$valor->obs_concepto = $request->obs_concepto;
if ($request->curso == null && $request->matricula_especial_checked == null && $request->matricula_programa_checked == null) {
return redirect()->back()->with("infoerror", "SELECIONE POR LO MENOS UN CURSO O OPCION");
} else {
if ($request->curso != null) {
$valor->cursos = json_encode($request->curso);
$valor->matricula_especial = null;
} elseif ($request->matricula_programa_checked) {
$valor->cursos = json_encode($request->matricula_programa_checked);
$valor->matricula_especial = null;
} elseif ($request->matricula_especial_checked) {
$valor->cursos = json_encode($request->matricula_especial_checked);
$valor->matricula_especial = trim($request->matricula_especial);
}
}
} else {
$valor->cursos = null;
$valor->obs_concepto = null;
}
$valor->update();
$valor_detalle = ValoresDetalles::where("valor_id", $request->id)->first();
$valor_detalle->costo = $request->costo;
$valor_detalle->update();
DB::commit();
return redirect()->to("valor")->with("info", "LOS DATOS SE ACTUALIZO CON EXITO!");
} catch (\Exception $e) {
DB::rollback();
return redirect()->back()->with("errorinfo", "ERROR AL ACTUALIZAR DATOS");
}
}
}
?>
Did this file decode correctly?
Original Code
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Valores;
use App\ValoresDetalles;
use DB;
use Validator;
use Redirect;
class ValorController extends Controller
{
public function index()
{
try {
$valores = Valores::select("\x63\x6f\x6e\143\145\x70\164\x6f", "\x74\x69\x70\x6f", "\150\x61\142\x69\x6c\x69\x74\x61\x64\x6f", "\143\x6f\x73\x74\x6f", "\147\x65\163\x74\151\x6f\x6e", "\166\x61\154\157\162\x65\163\56\151\144", "\166\x61\x6c\157\x72\x5f\160\162\151\155\145\x72\157", "\x6f\x62\x73\137\x63\x6f\x6e\x63\145\x70\164\157", "\x76\x61\154\157\x72\x5f\160\162\145")->join("\x76\141\x6c\x6f\162\145\163\137\144\145\x74\141\154\x6c\145\x73", "\x76\141\x6c\x6f\x72\x65\163\x5f\x64\x65\x74\141\154\154\145\163\x2e\166\x61\x6c\157\x72\137\151\144", "\166\141\x6c\x6f\162\145\x73\56\x69\144")->orderBy("\x76\x61\154\x6f\162\x65\x73\x2e\x74\151\x70\157", "\141\x73\x63")->orderBy("\166\141\x6c\x6f\162\145\x73\56\151\144", "\141\163\143")->get();
return view("\166\x61\x6c\157\162\56\151\x6e\144\145\170", compact("\x76\141\x6c\x6f\162\145\163"));
} catch (\Exception $e) {
return view("\145\x72\x72\x6f\x72\x73\56\64\60\x34");
}
}
public function create()
{
try {
$id_concepto = Valores::orderby("\151\x64", "\104\105\123\x43")->select("\x69\144")->first();
return view("\x76\x61\x6c\x6f\162\56\x63\162\145\141\164\145", compact("\151\x64\x5f\143\x6f\156\x63\x65\160\164\x6f"));
} catch (\Exception $e) {
return view("\145\x72\162\x6f\162\163\56\64\60\64");
}
}
public function store(Request $request)
{
DB::beginTransaction();
try {
$rules = array("\x63\157\x6e\143\145\x70\164\157" => array("\x72\x65\x71\x75\x69\x72\x65\144", "\155\x69\156\x3a\x33", "\x6d\141\170\72\x32\x30\60"), "\x74\151\x70\157" => array("\x72\x65\161\165\x69\162\145\x64"), "\x68\141\x62\x69\x6c\x69\x74\141\144\157" => array("\162\x65\161\x75\151\x72\x65\x64"), "\x74\x69\160\x6f\x5f\x61\154\155" => array("\162\145\x71\x75\151\x72\145\144"), "\x63\x6f\x73\164\157" => array("\x72\x65\x71\165\x69\162\x65\144\72\x6e\165\x6d\x65\162\x69\x63"));
$validation = Validator::make($request->all(), $rules);
if ($validation->fails()) {
return Redirect::back()->withInput()->withErrors($validation);
}
$valor = new Valores();
$valor->id_concepto = $request->id_concepto;
$valor->concepto = trim($request->concepto);
$valor->habilitado = $request->habilitado;
if ($request->tipo_alm == "\x53\x49" || $request->tipo_alm == "\116\117") {
$valor->valor_primero = $request->tipo_alm;
} elseif ($request->tipo_alm == "\x76\x61\154\x6f\x72\137\x70\162\x65") {
$valor->valor_pre = "\x53\111";
}
$valor->tipo = $request->tipo;
if ($request->tipo == "\x4d\x54") {
if ($request->curso == null && $request->matricula_especial_checked == null && $request->matricula_programa_checked == null) {
return redirect()->back()->with("\x65\x72\x72\x6f\162\151\x6e\146\x6f", "\123\105\114\105\103\x49\x4f\116\x45\40\x50\117\122\40\114\117\x20\115\x45\x4e\x4f\x53\40\x55\x4e\40\103\x55\122\x53\117\40\x4f\40\125\x4e\x41\40\x4f\x50\x43\x49\117\x4e");
} else {
$valor->obs_concepto = $request->obs_concepto;
if ($request->curso != null) {
$valor->cursos = json_encode($request->curso);
} elseif ($request->matricula_programa_checked) {
$valor->cursos = json_encode($request->matricula_programa_checked);
} elseif ($request->matricula_especial_checked) {
$valor->cursos = json_encode($request->matricula_especial_checked);
$valor->matricula_especial = trim($request->matricula_especial);
}
}
}
$valor->save();
$valor_detalle = new ValoresDetalles();
$valor_detalle->costo = $request->costo;
$valor_detalle->gestion = date("\x59");
$valor_detalle->valor_id = $valor->id;
$valor_detalle->save();
\DB::commit();
return redirect()->to("\x76\x61\x6c\x6f\x72")->with("\x69\x6e\146\x6f", "\x4c\117\x53\x20\104\101\x54\117\x53\40\106\x55\105\x52\117\116\40\x52\x45\x47\x49\123\x54\x52\101\104\x4f\123\x20\103\x4f\x4e\x20\x45\130\111\124\x4f\x21");
} catch (\Exception $e) {
\DB::rollback();
return redirect()->back()->with("\145\162\162\157\162\151\156\146\x6f", "\x45\x52\x52\x4f\x52\x20\101\114\x20\x52\105\107\x49\x53\x54\122\x41\x52");
}
}
public function edit($id)
{
try {
$valor = Valores::select("\x76\141\154\x6f\x72\145\x73\x2e\x69\144", "\x63\x6f\x6e\x63\145\x70\164\x6f", "\164\x69\x70\157", "\143\x75\x72\x73\x6f\163", "\x63\157\x73\x74\157", "\x76\x61\154\157\x72\137\160\x72\x69\155\x65\162\x6f", "\x68\141\142\151\154\151\x74\141\x64\157", "\x6d\x61\x74\x72\x69\x63\x75\x6c\141\x5f\145\163\x70\x65\143\151\x61\x6c", "\157\142\x73\137\143\157\x6e\143\x65\160\164\x6f", "\x76\x61\154\x6f\x72\137\160\x72\145")->join("\x76\x61\154\x6f\x72\145\163\x5f\x64\145\164\x61\x6c\x6c\x65\163", "\166\141\x6c\x6f\x72\145\163\x5f\x64\x65\164\141\154\154\145\163\x2e\166\x61\154\x6f\162\137\x69\144", "\75", "\x76\141\x6c\157\x72\x65\x73\x2e\x69\x64")->where("\x76\141\154\x6f\162\145\163\x2e\x69\144", $id)->first();
return view("\166\141\154\157\x72\x2e\x65\x64\x69\164", compact("\x76\141\154\x6f\162"));
} catch (\Exception $e) {
return view("\145\x72\x72\157\x72\x73\56\x34\x30\64");
}
}
public function update(Request $request)
{
DB::beginTransaction();
try {
$rules = array("\x63\157\x6e\143\x65\x70\x74\157" => array("\162\x65\161\x75\151\162\x65\x64", "\155\151\x6e\x3a\63", "\155\x61\170\x3a\62\60\60"), "\164\x69\160\157" => array("\x72\145\161\165\151\162\145\x64"), "\150\141\x62\151\x6c\151\x74\x61\x64\157" => array("\x72\145\161\x75\151\162\145\144"), "\164\x69\x70\x6f\137\141\x6c\x6d" => array("\x72\145\161\165\151\162\x65\144"), "\143\157\163\164\x6f" => array("\x72\x65\161\x75\151\162\x65\144\72\x6e\x75\x6d\x65\x72\x69\143"));
$validation = Validator::make($request->all(), $rules);
if ($validation->fails()) {
return Redirect::back()->withInput()->withErrors($validation);
}
$valor = Valores::find($request->id);
$valor->concepto = trim($request->concepto);
$valor->habilitado = $request->habilitado;
if ($request->tipo_alm == "\166\141\154\x6f\x72\x5f\x70\162\145") {
$valor->valor_pre = "\x53\x49";
} else {
$valor->valor_primero = $request->tipo_alm;
}
$valor->tipo = $request->tipo;
if ($request->tipo == "\x4d\x54") {
$valor->obs_concepto = $request->obs_concepto;
if ($request->curso == null && $request->matricula_especial_checked == null && $request->matricula_programa_checked == null) {
return redirect()->back()->with("\x69\156\x66\x6f\145\x72\162\x6f\x72", "\123\105\114\x45\x43\x49\x4f\x4e\105\40\x50\x4f\122\x20\x4c\117\40\x4d\x45\x4e\117\x53\40\x55\116\x20\x43\125\122\x53\117\40\x4f\40\x4f\x50\x43\x49\117\x4e");
} else {
if ($request->curso != null) {
$valor->cursos = json_encode($request->curso);
$valor->matricula_especial = null;
} elseif ($request->matricula_programa_checked) {
$valor->cursos = json_encode($request->matricula_programa_checked);
$valor->matricula_especial = null;
} elseif ($request->matricula_especial_checked) {
$valor->cursos = json_encode($request->matricula_especial_checked);
$valor->matricula_especial = trim($request->matricula_especial);
}
}
} else {
$valor->cursos = null;
$valor->obs_concepto = null;
}
$valor->update();
$valor_detalle = ValoresDetalles::where("\x76\x61\154\x6f\162\x5f\x69\144", $request->id)->first();
$valor_detalle->costo = $request->costo;
$valor_detalle->update();
DB::commit();
return redirect()->to("\x76\x61\154\157\x72")->with("\x69\156\x66\x6f", "\114\x4f\123\40\x44\101\x54\x4f\x53\40\x53\105\x20\x41\x43\x54\x55\x41\114\111\132\117\x20\103\117\116\40\105\130\111\124\x4f\41");
} catch (\Exception $e) {
DB::rollback();
return redirect()->back()->with("\145\x72\x72\157\162\151\156\x66\x6f", "\x45\x52\122\x4f\122\40\101\x4c\x20\101\103\124\x55\x41\114\111\132\x41\122\x20\104\x41\124\x4f\123");
}
}
}
Function Calls
None |
Stats
MD5 | dc361acb6a4d7784996b549086db50cc |
Eval Count | 0 |
Decode Time | 93 ms |