I am creating a website for my organization that also has some web applications that run server side via CGI using Python. I am wanting a little bit more of a intuitive front end framework. I am also more familiar with Scripting languages then web languages. I have chosen Bootstrap as my frame work for it's user base and bound of documentation.
Now I am understanding the website authentication in regards to PHP and mySQL. But I have a question that I have not been able to find the answer to.
How do I set up website authentication via PHP and mySQL but not have every page end in .php
?
For example is it possible to somehow insert this CheckLogin
code at the beginning of but inside the html code of a webpage that is .html
instead of .php
:
<?PHP
require_once("./include/membersite_config.php");
if(!$fgmembersite->CheckLogin())
{
$fgmembersite->RedirectToURL("login.php");
exit;
}
?>
The CheckLogin
code:
function CheckLogin()
{
session_start();
$sessionvar = $this->GetLoginSessionVar();
if(empty($_SESSION[$sessionvar]))
{
return false;
}
return true;
I am referencing this tutorial:http://www.html-form-guide.com/php-form/php-login-form.html
Update: I am using Apache.
I am looking for some guidance besides just the name of the technology, something with a example or tutorial as again I am very new to webside programming and I would benefit most from some real world type of examples.
EDIT: I am also looking for alternatives that would be best suited for CGI type of websites. Anything in the realm of Apache and website authentication based around integration with CGI.
This question was marked as duplicate but I disagree as it has more caveats do to the CGI nature instead of how to simply insert PHP into HTML. The most common solution found when researching "Web site Authentication" is PHP. Hence why asking how to make a CGI website turn by turning PHP pages into HTML pages for the sake of simplicity of using CGI. If there are easier ways to do this by all means please share.