Hey guys, what the best practice for session check without duplicate code. I mean when check the session in some controller I have to duplicate the code to other controller, and that is not a good idea.
<?php

class Ctrl extends Controller
{
   private function _ses_check() {...}
}
class Second_ctrl extends Controller
{
   private function _ses_check() {...}
}

Where I have to write this "main" things. Write in Model is again bad idea.
For that reason I write this topic. Thanks in advance!

Create a BaseController, include the session check, and derive your class from that one.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.