I'm working on a project for web application now my problem is I have login script which contain a views folder. Inside view
folder I have three PHP files:
logged-in.php
not_logged_in.php
register.php
Apart my view
folder I have one file index.php
now have a look this picture click here.
Now when I run index.php
file, it shows login main page if user is not logged in, otherwise will show up home page( which is logged-in.php
inside view folder) if I run direct logged-in.php
file directly then it will give an error so the whole process I must startup with index.php
.
And here is code for index.php
<?php
// checking for minimum PHP version
if (version_compare(PHP_VERSION, '5.3.7', '<')) {
exit("Sorry, Simple PHP Login does not run on a PHP version smaller than 5.3.7 !");
} else if (version_compare(PHP_VERSION, '5.5.0', '<')) {
// if you are using PHP 5.3 or PHP 5.4 you have to include the password_api_compatibility_library.php
// (this library adds the PHP 5.5 password hashing functions to older versions of PHP)
require_once("libraries/password_compatibility_library.php");
}
// include the configs / constants for the database connection
require_once("config/db.php");
// load the login class
require_once("classes/Login.php");
// create a login object. when this object is created, it will do all login/logout stuff automatically
// so this single line handles the entire login process. in consequence, you can simply ...
$login = new Login();
// ... ask if we are logged in here:
if ($login->isUserLoggedIn() == true) {
// the user is logged in. you can do whatever you want here.
// for demonstration purposes, we simply show the "you are logged in" view.
include("views/logged_in.php");
} else {
// the user is not logged in. you can do whatever you want here.
// for demonstration purposes, we simply show the "you are not logged in" view.
include("views/not_logged_in.php");
}
Have a look at this pic, so the problem is I want to call my comment-folder
inside logged-in.php
so I use include('comment05/../.. .php');
inside my logged-in.php as you can see my pic.
But when I run this it shows the comment popup but when I click comment
button it's giving error 404 file not found
that mean it's recognizing the correct path. So I want to ask, do I need to change something into my index.php
file or not? Because I guess I need to change something in their like using using include('comment05')
and etc.
So can you help me with index.php
file, what should I do in that case when I call a folder into logged-in.php
file because the whole process is depend into index.php
file? I mean my website is startup firstly with index.php
.