Structure File

Encrypted Messenger PHP

basename

Given a string containing the path to a file or directory, this function will return the trailing name component.

Create a file named secured-structure.php


<?php

//***********************************************************************************************

function gns_first($t="Secured")
{
echo
'<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="Omid Bahrami">
<meta name="author" content="Omid Bahrami">
<link rel="icon" href="../private/icon/omid-bahrami.png">
<title>'.$t.'</title>
<link href="../private/css/style.css" rel="stylesheet" type="text/css">
<link href="../private/css/bootstrap.min.css" rel="stylesheet">
<link href="../private/css/ie10-viewport-bug-workaround.css" rel="stylesheet">
<link href="../private/css/navbar-fixed-top.css" rel="stylesheet">
</head>';
}

//***********************************************************************************************

function gns_second()
{
$x='class="active"';
$su=$si=$h="";

if(gns_dir()=="home")
$h=$x;

else if(gns_dir()=="sign-up")
$su=$x;

else if(gns_dir()=="sign-in")
$si=$x;

echo
'<body>
<nav class="navbar navbar-default navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="https://omid-bahrami.com/">Omid Bahrami</a>
</div>
<div id="navbar" class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li '.$h.'><a href="../home/">Home</a></li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li '.$su.'><a href="../sign-up/">Sign up</a></li>
<li '.$si.'><a href="../sign-in/">Sign in</a></li>
</ul>
</div>
</div>
</nav>
<div class="container">';
}

//***********************************************************************************************

function gns_second_pro()
{
$x='class="active"';
$p=$n=$i=$s="";

if(gns_dir()=="profile")
$p=$x;

else if(gns_dir()=="new")
$n=$x;

else if(gns_dir()=="inbox")
$i=$x;

else if(gns_dir()=="sent")
$s=$x;

echo
'<body>
<nav class="navbar navbar-default navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="https://omid-bahrami.com/">Omid Bahrami</a>
</div>
<div id="navbar" class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li '.$p.'><a href="../profile/">Profile</a></li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li '.$n.'><a href="../new/">New</a></li>
<li '.$i.'><a href="../inbox/">Inbox</a></li>
<li '.$s.'><a href="../sent/">Sent</a></li>
<li><a href="../sign-out/">Sign out</a></li>
</ul>
</div>
</div>
</nav>
<div class="container">';
}

//***********************************************************************************************

function gns_foot()
{
echo
'</div>
<script src="https://www.google.com/recaptcha/api.js" async defer></script>
<script src="../private/js/ie-emulation-modes-warning.js"></script>
<script src="../private/js/jquery.min.js"></script>
<script src="../private/js/bootstrap.min.js"></script>
<script src="../private/js/ie10-viewport-bug-workaround.js"></script>
</body>
</html>';
}

//***********************************************************************************************

function gns_head($t="Secured")
{
gns_first($t);
gns_second();
}

//***********************************************************************************************

function gns_head_pro($t="Secured")
{
gns_first($t);
gns_second_pro();
}

//***********************************************************************************************

function gns_welcome($x="Welcome")
{
echo '<p class="text-primary text-center">'.$x.'</p>';
}

//***********************************************************************************************

function gns_dir()
{
return basename($_SERVER["REQUEST_URI"]);
}

//***********************************************************************************************

?>

Full structure is available at Encrypted Messenger PHP