助けてください。
サイトの構造は次のようになります。
root folder(mysite):
- subfolder: includes (has inside the initialize.php - I include it on the top of ALL my pages )
- subfolder: admin (has inside the localhost/mysite/admin/index.php, localhost/mysite/admin/edit.php, localhost/mysite/admin/delete.php)
index.php(localhost/mysite/admin/index.php )
albums.php
ユーザーがログインしている場合にのみ管理フォルダー内のページへのアクセスを許可する関数 login() もあります。したがって、管理ページ内のコードは次のようになります。
<?php require_once('../includes/initialize.php'); ?>
<?php loggedin(); //I put this only in pages inside admin folder ?>
<?php include('header.php'); ?>
/// Instead inside root pages is like this:
<?php require_once('includes/initialize.php'); ?>
<?php include('header.php'); ?>
私がやりたいことは、関数を initialize.php 内に配置し、loggedin() が admin フォルダー内のすべてのページにのみ含まれていることを確認するチェックを実行することです。つまり、localhost/mysite/ index.php には含まれず、代わりに localhost/mysite/admin/index.php に含まれます。