get('/view_apply_job', function ( $request, $response) { if( !$login = $this->get(Session::class)->get('login') ){ $response = $response->withHeader('Location', "/login")->withStatus(302); return $response; } $is_admin_login = is_admin_login_simple(); if(!$is_admin_login){ die('You are not admin.'); } echo'xxx'; return $response; }); /* no need $app->get('/go', function ( $request, $response) { $go = isset($_GET['go']) ? $_GET['go'] : ''; if(!$go){ header('location:/'); exit; } $checked_go = $go; if(substr($checked_go, -1)==='/'){ $checked_go = substr($checked_go,0,-1); } $is_valid = false; foreach(array('.tw','.fashion','.com','.cc','.org','.edu')as$v){ echo$x = substr($checked_go, -1*strlen($v)); if($x==$v){ $is_valid=true;break; } } if(!$is_valid){ die('invalid. Go back'); } header('location:'.$checked_go); exit; }); */