include question

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Jon

    #1

    include question

    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


  • Jonathan

    #2
    Re: include question

    Jon wrote:[color=blue]
    > 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.[/color]

    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

    Comment

    • Jon

      #3
      Re: include question

      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" <jonathan@heela l.nl> wrote in message
      news:43de473c$0 $12840$ba620dc5 @text.nova.plan et.nl...[color=blue]
      > Jon wrote:[color=green]
      >> 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.[/color]
      >
      > 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[/color]


      Comment

      • d

        #4
        Re: include question

        "Jon" <jonra@netins.c om> wrote in message
        news:drldh5$c2d $1@news.netins. net...[color=blue]
        > 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
        >[/color]

        Have you tried using the httpd.conf to set the auto_prepend_fi le 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...



        dave


        Comment

        • Marek Simon

          #5
          Re: include question

          Jon wrote:[color=blue]
          > 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" <jonathan@heela l.nl> wrote in message
          > news:43de473c$0 $12840$ba620dc5 @text.nova.plan et.nl...
          >[color=green]
          >>Jon wrote:
          >>[color=darkred]
          >>>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.[/color]
          >>
          >>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[/color]
          >
          >
          >[/color]

          so just write include("includ es.php") and from it include the other stuff.
          Marek

          Comment

          Working...