/** * Verify CSRF tokens match. * * @param $token * @return bool */ public static function checkToken($token) { if (Session::get('csrf_token') !== $token) { return false; } return true; }
/** * Get weather data from the session cache. * * @param $remote * @return mixed */ protected static function getData($remote) { if (!Session::has('weather-data')) { $weatherData = $remote->getData('http://api.openweathermap.org/data/2.5/weather?zip=' . ZIP_CODE . ',us', null); $sessionData = ['weather-data' => $weatherData]; Session::put($sessionData); return $weatherData; } return Session::get('weather-data'); }
/** * Get the ID of the authenticated user. * * @return mixed */ public function getAuthenticatedUser() { return Session::get('id'); }
<?php use bookMe\lib\DataAccess\Database; use bookMe\lib\Http\Session; //Load the class autoloader require dirname(__FILE__) . '/../vendor/autoload.php'; //Start the session handler Session::start(); //Load config settings require dirname(__FILE__) . '/../src/config.php'; //Start Eloquent Database::start(); //Finally, load the routes list require dirname(__FILE__) . '/../src/routes.php';