• 0
Votes
name

A PHP Error was encountered

Severity: Notice

Message: Undefined index: userid

Filename: views/question.php

Line Number: 191

Backtrace:

File: /var/www/html/cnasolution/application/views/question.php
Line: 191
Function: _error_handler

File: /var/www/html/cnasolution/application/controllers/Questions.php
Line: 419
Function: view

File: /var/www/html/cnasolution/index.php
Line: 315
Function: require_once

name Punditsdkoslkdosdkoskdo

Define validation on all controller routes

Let's say I create Admin Controller that includes all refers to administration pages. In each controller i do validation that the user is admin and other validations, Its look like my code repeats itself and i want to make local event on enter any route in admin controller and do these validations, I know i can declare one function that do these validations but again I must need to set her on any method in AdminController.

Thanks for helpers.

Example of admin controller method:

public IActionResult References() {     var user = Systems.Users.GetUser(HttpContext);     if (Systems.Users.IsValid(user) &&          Systems.Users.IsPermission(user, Models.User.EUPermissions.Admin))             return View();     return View("Error404"); } 
Download script demo [LINK]
Download script demo [LINK 2] Download script demo [LINK 2]