473,385 Members | 1,798 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

include question

Jon
All,

I have a question regarding include files. I'm currently wanting to secure
all of the pages within a directory by having a login script that queries a
MySQL DB, and writes a session variable confirming the user is successfully
logged in.

Now, I've done this many times before, however I'm getting kind of sick of
putting the include file to check the session variable on EVERY page within
a directory. This is especially irritating if I for whatever reason want to
unsecure a directory, or change the structure of the login system - it
forces me to go into each file of the admin area and remove the call to the
file.

My question is: Is there a way to have PHP force an include file per
directory instead of just file? Maybe have a global file inside the
directory that will cascade the include to every page below? Or am I simply
forced to manually include the file on each page?

Thank you in advance.

Jon
Jan 30 '06 #1
4 1321
Jon wrote:
All,

Now, I've done this many times before, however I'm getting kind of sick of
putting the include file to check the session variable on EVERY page within
a directory. This is especially irritating if I for whatever reason want to
unsecure a directory, or change the structure of the login system - it
forces me to go into each file of the admin area and remove the call to the
file.


Wouldn'y it be easier to comment out the neccesarry lines in the include
file, this way you don't need to open every file and change it?

Jonathan
Jan 30 '06 #2
Jon
Yeah, unless I want to completely kill off the check all together (I could
leave it by commenting, but would prefer to have no code left if I were to
decide to remove it). The bigger issue is adding it to each file.

"Jonathan" <jo******@heelal.nl> wrote in message
news:43***********************@text.nova.planet.nl ...
Jon wrote:
All,

Now, I've done this many times before, however I'm getting kind of sick
of putting the include file to check the session variable on EVERY page
within a directory. This is especially irritating if I for whatever
reason want to unsecure a directory, or change the structure of the login
system - it forces me to go into each file of the admin area and remove
the call to the file.


Wouldn'y it be easier to comment out the neccesarry lines in the include
file, this way you don't need to open every file and change it?

Jonathan

Jan 30 '06 #3
d
"Jon" <jo***@netins.com> wrote in message
news:dr**********@news.netins.net...
All,

I have a question regarding include files. I'm currently wanting to secure
all of the pages within a directory by having a login script that queries
a MySQL DB, and writes a session variable confirming the user is
successfully logged in.

Now, I've done this many times before, however I'm getting kind of sick of
putting the include file to check the session variable on EVERY page
within a directory. This is especially irritating if I for whatever reason
want to unsecure a directory, or change the structure of the login
system - it forces me to go into each file of the admin area and remove
the call to the file.

My question is: Is there a way to have PHP force an include file per
directory instead of just file? Maybe have a global file inside the
directory that will cascade the include to every page below? Or am I
simply forced to manually include the file on each page?

Thank you in advance.

Jon


Have you tried using the httpd.conf to set the auto_prepend_file directive
for specific directories? You can put it in the <directory> section, so you
can set different directories to prepend your login script. That would take
it out of your code and put it in apache...

http://uk2.php.net/manual/en/configuration.changes.php

dave
Jan 30 '06 #4
Jon wrote:
Yeah, unless I want to completely kill off the check all together (I could
leave it by commenting, but would prefer to have no code left if I were to
decide to remove it). The bigger issue is adding it to each file.

"Jonathan" <jo******@heelal.nl> wrote in message
news:43***********************@text.nova.planet.nl ...
Jon wrote:
All,

Now, I've done this many times before, however I'm getting kind of sick
of putting the include file to check the session variable on EVERY page
within a directory. This is especially irritating if I for whatever
reason want to unsecure a directory, or change the structure of the login
system - it forces me to go into each file of the admin area and remove
the call to the file.


Wouldn'y it be easier to comment out the neccesarry lines in the include
file, this way you don't need to open every file and change it?

Jonathan



so just write include("includes.php") and from it include the other stuff.
Marek
Jan 30 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: qaz | last post by:
I run a web site on both a testing server and a "production" server. I noticed that references to the include file do not work on the testing server but they do work on the production server. I...
6
by: Simon Elliott | last post by:
(Note: this is a real C++ question and not an MS Windows question. The window handle I introduce is just an example of OS specific data, which I've used to illustrate my question.) I have some...
3
by: Arpi Jakab | last post by:
I have a main project that depends on projects A and B. The main project's additional include directories list is: ...\ProjectA\Dist\Include ...\ProjectB\Dist\Include Each of the include...
3
by: sunnylele | last post by:
Hi, all, I have a question on the use of #include: #include <unistd.h> #include <asm/unistd.h> #include "nn.h" What are the differences between the above three usages? It seems the third...
2
by: key9 | last post by:
Hi all look at the organize tree main.c ------ #include lib_adapter.c main() { foo();
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.