Jump to content

Protecting Pages Code? What am I doing wrong. Please help


daniel27lt

Recommended Posts

Hi there,

 

I am having an issue protecting sub-folders within sub-folders with PHP.

 

I have been protecting pages with only short directories (doing fine), but now I am wanting to protect new directories with a number of sub-directories and that is where I am having troubles.

 

NOTE: Links below are like this as they shorting on this site making it hard for you's to view then understand what I'm talking about.

 

Example:

PHP Login Script Location: mydomain. com/login/free/main.php

 

 

Works Fine -

Pages Protected: mydomain. com/login/free/members/free.php

 

Does not work -

Wanting Pages Protected: mydomain .com/login/free/members/free/archive/directory/2008.php

(and branched out from there)

 

 

This is the code I use on tops of all my pages, but the long one's do not work...

 

<?php

include("..../include/session.php");

if(!$session->logged_in){ header("Location: ..../main.php"); } else {

?>

<!-- -->

 

Only "../" works, not "..../" or "....../".

 

Can anyone tell me why this is the case and what I am doing wrong.

 

Thanks

Link to comment
Share on other sites

Hard for me to make sense of what you're trying to do there and where exactly that script is located (main.php). But to go back folders have you tried

 

Location: ../../../main.php

 

Or however many folders back that file is located? This is how you go back folders for a file.

Link to comment
Share on other sites

Hard for me to make sense of what you're trying to do there and where exactly that script is located (main.php). But to go back folders have you tried

 

Location: ../../../main.php

 

Or however many folders back that file is located? This is how you go back folders for a file.

 

 

That's the answer I was looking for. Just tried it and that was it. It worked. Thanks for your time and knowlegde on this subject and sorry I was'nt a little clearer.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.