You've already forked bryanpedini.it_old
							
							
		
			
				
	
	
		
			149 lines
		
	
	
		
			7.6 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			149 lines
		
	
	
		
			7.6 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
<?php
 | 
						|
    $session_timeout_days = 3;
 | 
						|
    $session_timeout_hours = 0;
 | 
						|
    $session_timeout_minutes = 0;
 | 
						|
    $session_timeout_seconds = 0;
 | 
						|
    $session_timeout = ($session_timeout_days*86400)+($session_timeout_hours*3600)+($session_timeout_minutes*60)+$session_timeout_seconds;
 | 
						|
    session_set_cookie_params ( $session_timeout, "/" );
 | 
						|
    session_start ();
 | 
						|
    $section_page_titles = [
 | 
						|
        0 => '',
 | 
						|
        1 => 'Home',
 | 
						|
        2 => 'About myself',
 | 
						|
        3 => 'What I\'ve done so far',
 | 
						|
        4 => 'Who I would like to be',
 | 
						|
        5 => 'Web Form contact'
 | 
						|
    ];
 | 
						|
    if ( ! isset ( $_POST ['section'] ) ) {
 | 
						|
        $requested_section_title = 'Home';
 | 
						|
    }
 | 
						|
    else {
 | 
						|
        if ( ! in_array ( $_POST ['section'], array_keys( $section_page_titles ) ) ) {
 | 
						|
            $page_content_array = [
 | 
						|
                'status' => 400,
 | 
						|
                'errorCode' => 'Bad Request',
 | 
						|
                'errorText' => 'Requested section \'' . $_POST [ 'section' ] . '\' does not exist: do not attempt to compromise the website.',
 | 
						|
            ];
 | 
						|
            $page_content_json = json_encode ( $page_content_array );
 | 
						|
            header('Content-Type: application/json');
 | 
						|
            echo $page_content_json;
 | 
						|
            exit;
 | 
						|
        }
 | 
						|
        $requested_section = $_POST ['section'];
 | 
						|
        if ( $requested_section == 0 ) {
 | 
						|
            if ( isset ( $_SESSION [ 'section' ] ) ) {
 | 
						|
                $requested_section = $_SESSION [ 'section' ];
 | 
						|
            }
 | 
						|
            else {
 | 
						|
                $requested_section = 1;
 | 
						|
            }
 | 
						|
        }
 | 
						|
        $_SESSION [ 'section' ] = $requested_section;
 | 
						|
        $requested_section_title = $section_page_titles [ $requested_section ];
 | 
						|
        $section_templates = [
 | 
						|
            1 => file_get_contents ( 'templates/home.phtml' ),
 | 
						|
            2 => file_get_contents ( 'templates/description.phtml' ),
 | 
						|
            3 => file_get_contents ( 'templates/projects.phtml' ),
 | 
						|
            4 => file_get_contents ( 'templates/ideas.phtml' ),
 | 
						|
            5 => file_get_contents ( 'templates/contact-form.phtml' ),
 | 
						|
        ];
 | 
						|
        $page_content_array = [
 | 
						|
            'status' => 200,
 | 
						|
            'pageTitle' => $requested_section_title.' | Bryan Pedini',
 | 
						|
            'html' => $section_templates [ $requested_section ]
 | 
						|
        ];
 | 
						|
        $page_content_json = json_encode($page_content_array);
 | 
						|
        header('Content-Type: application/json');
 | 
						|
        echo $page_content_json;
 | 
						|
        exit;
 | 
						|
    }
 | 
						|
?>
 | 
						|
<!DOCTYPE html>
 | 
						|
<html>
 | 
						|
    <head>
 | 
						|
        <meta charset="utf-8">
 | 
						|
        <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
 | 
						|
        <meta name="description" content="">
 | 
						|
        <meta name="author" content="">
 | 
						|
        <title id="page-title"><?=$requested_section_title?> | Bryan Pedini</title>
 | 
						|
        <link href="https://static.bjphoster.com/images/icons/bryanpedini.it/favicon.png" rel="icon" type="image/png">
 | 
						|
        <link href="vendor/bootstrap/css/bootstrap.min.css" rel="stylesheet">
 | 
						|
        <link href="vendor/fontawesome-free/css/all.min.css" rel="stylesheet" type="text/css">
 | 
						|
        <link href='https://fonts.googleapis.com/css?family=Lora:400,700,400italic,700italic' rel='stylesheet' type='text/css'>
 | 
						|
        <link href='https://fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,700italic,800italic,400,300,600,700,800' rel='stylesheet' type='text/css'>
 | 
						|
        <link href="css/clean-blog.min.css" rel="stylesheet">
 | 
						|
        <link href="css/hidden-scrollbar-GUI.css" rel="stylesheet">
 | 
						|
    </head>
 | 
						|
    <body>
 | 
						|
        <nav class="navbar navbar-expand-lg navbar-light fixed-top" id="mainNav">
 | 
						|
            <div class="container">
 | 
						|
                <a class="navbar-brand" href="#" id="navbar-home">Bryan Pedini</a>
 | 
						|
                <button class="navbar-toggler navbar-toggler-right" type="button" data-toggle="collapse" data-target="#navbarResponsive" aria-controls="navbarResponsive" aria-expanded="false" aria-label="Toggle navigation">
 | 
						|
                    Menu <i class="fas fa-bars"></i>
 | 
						|
                </button>
 | 
						|
                <div class="collapse navbar-collapse" id="navbarResponsive">
 | 
						|
                    <ul class="navbar-nav ml-auto">
 | 
						|
                        <li class="nav-item dropdown">
 | 
						|
                            <a class="nav-link dropdown-toggle" href="#" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">About me</a>
 | 
						|
                            <ul class="dropdown-menu">
 | 
						|
                            <li class="dropdown-item"><a href="#" id="navbar-description">A brief description</a></li>
 | 
						|
                            <li class="dropdown-divider"></li>
 | 
						|
                            <li class="dropdown-item"><a href="#" id="navbar-work">My current projects</a></li>
 | 
						|
                            <li class="dropdown-item"><a href="#" id="navbar-ideas">My future ideas</a></li>
 | 
						|
                        </ul>
 | 
						|
                        </li>
 | 
						|
                        <li class="nav-item dropdown">
 | 
						|
                        <a class="nav-link dropdown-toggle" href="#" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Contact me</a>
 | 
						|
                        <div class="dropdown-menu">
 | 
						|
                            <a href="#" class="dropdown-item" id="navbar-contact-form">Web form</a>
 | 
						|
                            <a href="#" class="dropdown-item" id="navbar-contact-email">Email</a>
 | 
						|
                        </div>
 | 
						|
                        </li>
 | 
						|
                    </ul>
 | 
						|
                </div>
 | 
						|
            </div>
 | 
						|
        </nav>
 | 
						|
        <div id="user-content">
 | 
						|
 | 
						|
        </div>
 | 
						|
        <footer>
 | 
						|
            <div class="container">
 | 
						|
                <div class="row">
 | 
						|
                    <div class="col-lg-8 col-md-10 mx-auto">
 | 
						|
                        <ul class="list-inline text-center">
 | 
						|
                            <li class="list-inline-item">
 | 
						|
                                <a href="https://www.instagram.com/bryanpedini/">
 | 
						|
                                    <span class="fa-stack fa-lg">
 | 
						|
                                        <i class="fas fa-circle fa-stack-2x"></i>
 | 
						|
                                        <i class="fab fa-instagram fa-stack-1x fa-inverse"></i>
 | 
						|
                                    </span>
 | 
						|
                                </a>
 | 
						|
                            </li>
 | 
						|
                            <li class="list-inline-item">
 | 
						|
                                <a href="https://git.bryanpedini.it/">
 | 
						|
                                    <span class="fa-stack fa-lg">
 | 
						|
                                        <i class="fas fa-circle fa-stack-2x"></i>
 | 
						|
                                        <i class="fab fa-git fa-stack-1x fa-inverse"></i>
 | 
						|
                                    </span>
 | 
						|
                                </a>
 | 
						|
                            </li>
 | 
						|
                            <li class="list-inline-item">
 | 
						|
                                <a href="https://dev.bryanpedini.it/">
 | 
						|
                                    <span class="fa-stack fa-lg">
 | 
						|
                                        <i class="fas fa-circle fa-stack-2x"></i>
 | 
						|
                                        <i class="fab fa-dev fa-stack-1x fa-inverse"></i>
 | 
						|
                                    </span>
 | 
						|
                                </a>
 | 
						|
                            </li>
 | 
						|
                        </ul>
 | 
						|
                        <p class="copyright text-muted">© Bryan Pedini <?php echo date("Y"); ?> - All rights reserved.<br>Send me an email at <a href="mailto:copyright@bryanpedini.it">this</a> link for copyright and permissions questions.</p>
 | 
						|
                    </div>
 | 
						|
                </div>
 | 
						|
            </div>
 | 
						|
        </footer>
 | 
						|
        <script src="vendor/jquery/jquery.min.js"></script>
 | 
						|
        <script src="vendor/bootstrap/js/bootstrap.min.js"></script>
 | 
						|
        <script src="js/clean-blog.min.js"></script>
 | 
						|
        <script src="js/onePageApp-sections-control.js"></script>
 | 
						|
    </body>
 | 
						|
</html>
 |