PHP Classes
elePHPant
Icontem

File: calcul/app_dev.php

Recommend this page to a friend!
  Classes of eureka2  >  G6K  >  calcul/app_dev.php  >  Download  
File: calcul/app_dev.php
Role: Example script
Content type: text/plain
Description: Example script
Class: G6K
Generate simulator tools to perform calculations
Author: By
Last change:
Date: 1 year ago
Size: 818 bytes
 

 

Contents

Class file image Download
<?php

use Symfony\Component\HttpFoundation\Request;
use
Symfony\Component\HttpFoundation\Response;
use
Symfony\Component\Debug\Debug;

$loader = require_once __DIR__.'/../app/bootstrap.php.cache';
Debug::enable();

require_once
__DIR__.'/../app/AppKernel.php';

$request = Request::createFromGlobals();

$clientIp = $request->getClientIp();
$authorizedHosts = ['127.0.0.1', 'fe80::1', '::1', 'localhost', 'yourIpAddress'];
if (! (
in_array($clientIp, $authorizedHosts) || php_sapi_name() === 'cli-server')) {
   
$response = new Response(
       
"Forbidden",
       
Response::HTTP_FORBIDDEN,
        array(
'content-type' => 'text/html')
    );
   
$response->send();
    exit();
}

$kernel = new AppKernel('dev', true);
$kernel->loadClassCache();
$response = $kernel->handle($request);
$response->send();
$kernel->terminate($request, $response);