如何将一个文件夹调用到登录文件中,但是当我通过index.php连接我的文件时?

时间:2014-04-21 15:04:46

标签: javascript php jquery mysql css

我正在开发一个用于Web应用程序的项目现在我的问题是我有一个包含一个views文件夹的登录脚本。在view文件夹里面我有三个PHP文件:

  1. logged-in.php
  2. not_logged_in.php
  3. register.php
  4. 除了我的view文件夹,我有一个文件index.php现在可以查看此图片click here

    现在,当我运行index.php文件时,如果用户未登录则显示登录主页面,否则将显示主页(视图文件夹中为logged-in.php)如果我直接运行{{直接1}}文件然后它会给出一个错误,所以整个过程我必须用logged-in.php启动。

    以下是index.php

    的代码
    index.php

    看看这个pic,问题是我想在<?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"); } 内调用comment-folder,所以我在登录的.php中使用logged-in.php作为你可以看到我的照片。

    但是当我运行它时会显示注释弹出窗口,但是当我点击include('comment05/../.. .php');按钮时,它会给出错误comment,这意味着它正在识别正确的路径。所以我想问一下,我是否需要将某些内容更改为404 file not found文件?因为我想我需要使用index.php等等来改变他们喜欢的东西。

    那么你可以帮助我使用include('comment05')文件,当我将文件夹调入index.php文件时,我应该怎么办,因为整个过程都依赖于logged-in.php文件?我的意思是我的网站首先启动index.php

0 个答案:

没有答案