middleware php

Solutions on MaxInterview for middleware php by the best coders in the world

showing results for - "middleware php"
Mirko
01 Jul 2016
1<?php
2//index.php at the beginin of the page
3require_once('./Controller/yourController.php');
4
5//if url have argument
6if (isset($_GET['action'])) {
7    switch ($_GET['action']) {
8        case 'x':
9            if (!empty($_POST)) {
10                //call Post method
11            } else {
12                //Send to x page
13            }
14            break;
15
16        case 'y':
17            //call y function
18            break;
19    }
20} else {
21  	//Call when no parameters in the url
22    //if want to use login session 
23  	//$user_id = $_SESSION['user_id'] ?? false;
24		
25    if ($user_id) {
26        //Succes Connection
27    } else {
28        //Send to login page
29    }
30}
31