Hello people,
If I want to access to my admin back-end, you will get a form to input your name and password.
I have created a class that sets my session in a file called
StartSession.class.php
here it is:
<?php
class StartSession{
static $admin_s;
static $password_s;
function __consrtuct($admin_session,$password_session){
session_start();
$_SESSION['admin']=$admin_session;
$_SESSION['password']=$password_session;
self::$admin_s=$admin_session;
self::$password_s=$password_session;
}
}
?>
In my admin file that I named
admin.php
I called to my StartSession() class like this:
$startsession=new StartSession($adminad,$passwordad);
Then I cread an awelcome.php file in my admin folder, which calls to a class that checks if my session is set, if not it redirects you to input your form, like this:
<?php
require_once('StartSession.class.php');
class SessionCheck{
function __construc(){
if(!isset(StartSession::$admin_s)||!isset(StartSession::$password_s)){
header('Location:admin/index.php');
exit();
}
}
}
?>
In my
awelcome.php
file, I called this class like this:
<?php
require_once('../Classes/SessionCheck.class.php');
$sessioncheck=new SessionCheck();
require_once('Includes/aheader.inc.php');
require_once('Includes/alMenu.inc.php');
?>
<div id="centered_content">
present
</div>
<?php
require_once('Includes/afooter.inc.php');
?>
Everything seems to work well, but then, when I taped the url to my
awelcome.php
file it did not redirect to my form input :( which thing means my session are not set as it is supposed to be : any one can help, please ?