Added cookie sessions and changed error pages location.

main
Robert 3 years ago
parent 7c402571ab
commit 9b495f254f
  1. 3
      src/configs/ex/loadall.php
  2. 3
      src/configs/ex/on_tts.php
  3. 3
      src/configs/live/on_tts.php
  4. 9
      src/ex/inputs/app/home_in.php
  5. 39
      src/mockup/controllers/app/cookie_ctrl.php
  6. 60
      src/mockup/views/on_error/404_page.php
  7. 31
      src/mockup/views/on_error/dev_error.php
  8. 48
      src/mockup/views/on_error/prod_error.php

@ -58,9 +58,6 @@
\main_tts\configure::set_key('important', 'private_ip_as_local', false);
\main_tts\configure::set('tts', array(
'error_page' => 'tts', // or project
'404_page' => 'tts', // or project
'ui_kit' => 'tts', // or project
'site_name' => 'Testing',
'short_url' => true,
'default_project' => 'home',

@ -3,9 +3,6 @@
\main_tts\configure::set_key('important', 'private_ip_as_local', false);
\main_tts\configure::set('tts', array(
'error_page' => 'tts', // or project
'404_page' => 'tts', // or project
'ui_kit' => 'tts', // or project
'site_name' => 'Testing',
'short_url' => true,
'default_project' => 'home',

@ -5,9 +5,6 @@ declare(strict_types=1);
//\main_tts\configure::update('important', 'private_ip_as_local', true);
\main_tts\configure::set('tts', array(
'error_page' => 'tts', // or project
'404_page' => 'tts', // or project
'ui_kit' => 'tts', // or project
'site_name' => 'My_Site_NAME_HERE',
'short_url' => true,
'default_project' => 'home',

@ -4,10 +4,11 @@ declare(strict_types=1);
namespace prj\ex\inputs\app;
use \bs_tts\INPUTS;
use \bs_tts\FIELD_FILTER;
use \bs_tts\HTML_FLAG;
use \bs_tts\DB_FILTER;
use \tts\enum\INPUTS;
use \tts\enum\FIELD_FILTER;
use \tts\enum\HTML_FLAG;
use \tts\enum\DB_FILTER;
use \bs_tts\use_io as IO;
class home_in {

@ -0,0 +1,39 @@
<?php
declare(strict_types = 1);
/**
* @author Robert Strutts <Robert@TryingToScale.com>
* @copyright Copyright (c) 2022, Robert Strutts.
* @license https://mit-license.org/
*/
namespace prj\mockup\controllers\app;
/**
* Description of cookie_ctrl
*
* @author Robert Strutts <Robert@TryingToScale.com>
*/
class cookie_ctrl {
public function __construct() {
$key = "78a5011b9997cd03a28a3412c66565b7c32715b35e055d7abfc228236308d3b2";
$sc = new \tts\services\paragon_crypto\sodium_storage($key);
$handler = new \tts\services\sessions\cookie_sessions($sc);
session_set_save_handler($handler, true);
session_start();
}
public function save() {
$_SESSION['admin'] = "Bob";
$_SESSION['logged_in'] = true;
}
public function read() {
var_dump($_SESSION);
// var_dump($_SESSION['admin'] ?? "");
}
}

@ -0,0 +1,60 @@
<?php
declare(strict_types=1);
/**
* @author Robert Strutts <Robert@TryingToScale.com>
* @copyright Copyright (c) 2022, Robert Strutts.
* @license https://mit-license.org/
*/
$protocol = "HTTP/1.0";
if ( "HTTP/1.1" == $_SERVER["SERVER_PROTOCOL"] ) {
$protocol = "HTTP/1.1";
}
header( "{$protocol} 404 Not Found", true, 404 );
header('Content-type: text/html; charset=utf-8');
if (defined("PROJECT_ASSETS_BASE_REF")) {
$base_ref = PROJECT_ASSETS_BASE_REF;
} else {
$base_ref = "";
}
?>
<html lang="en">
<head>
<meta charset="utf-8">
<base href="<?= $base_ref ?>/">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="language" content="english">
<meta name="robots" content="no-follow">
<link rel="shortcut icon" href="<?= $base_ref ?>/favicon/favicon.ico">
<title>404 Page not found!</title>
<style>
@media only screen and (max-width: 600px) {
#nopage {
height: 150px;
width: 300px;
}
}
@media only screen and (min-width: 600px) {
#nopage {
height: 500px;
width: 1500px;
}
}
</style>
</head>
<body>
<div id="wrap">
<?php
$assets = \bs_tts\site_helper::get_asset("images/404page.jpg");
?>
<img src="<?= $assets ?>/images/404page.jpg" alt="Page not found." id="nopage"/>
<header><h1>404 Page not found!<h1></header>
<h3>Our apologies for the temporary inconvenience.</h3>
</div>
</body>
</html>
<?php
exit;

@ -0,0 +1,31 @@
<?php
declare(strict_types=1);
if (defined("PROJECT_ASSETS_BASE_REF")) {
$base_ref = PROJECT_ASSETS_BASE_REF;
} else {
$base_ref = "";
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<base href="<?= $base_ref ?>/">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="keywords" content="">
<meta name="description" content="">
<meta name="author" content="Robert Strutts">
<meta name="language" content="english">
<meta name="robots" content="">
<meta name="copyright" content="2014-<?= date('Y'); ?>">
<title>DEV ERROR!</title>
<link rel="shortcut icon" href="<?= $base_ref ?>/favicon/favicon.ico">
</head>
<body id="my-page">
<div id="wrap">
<div id="autosavemessage"></div>
<?= $local->page_output; ?>
</div> <!-- end wrap -->
</body>
</html>

@ -0,0 +1,48 @@
<?php
declare(strict_types=1);
/**
* @author Robert Strutts <Robert@TryingToScale.com>
* @copyright Copyright (c) 2022, Robert Strutts.
* @license https://mit-license.org/
*/
define('PRODUCTION', 600);
define('MAINTENACE', 3600); // 1 hour = 3600 seconds
define('RETRY_AFTER', PRODUCTION);
if(! headers_sent()) {
header('HTTP/1.1 503 Service Temporarily Unavailable');
header('Status: 503 Service Temporarily Unavailable');
header('Retry-After: ' . RETRY_AFTER);
}
if (defined("PROJECT_ASSETS_BASE_REF")) {
$base_ref = PROJECT_ASSETS_BASE_REF;
} else {
$base_ref = "";
}
?>
<html lang="en">
<head>
<meta charset="utf-8">
<base href="<?= $base_ref ?>/">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="author" content="Robert Strutts">
<meta name="language" content="english">
<meta name="robots" content="NOINDEX, NOFOLLOW">
<meta name="copyright" content="2014-<?php echo date('Y'); ?>">
<link rel="shortcut icon" href="<?= $base_ref ?>/favicon/favicon.ico">
<title>Sorry, we had an error...</title>
<style>
body { padding: 20px; background: #C00; color: white; font-size: 40px; }
</style>
</head>
<body>
<h1>Sorry, we had an error...</h1>
<p>We apologize for any inconvenience this may cause.<p>
</body>
</html>
<?php exit;
Loading…
Cancel
Save