View Full Version : Restricted folders on server
Vectar
August 31st, 2006, 03:56 AM
Hey everbody,
I want to make a restricted area on my website.
I want a folder to be named test area and make it accessable by typing in a username and password. I know how to make a page restricted with cookies but how can i make a folder restricted ? and make it include all the other folders as well ?
I also want to make a nice custom inlog page, this is no problem but can i use my oun build inlog screen for loggin in to a folder on my server ?
Pleace help me out, maybe with a nice PHP tutorial or anything is welcome
Thanks
chrisclick
August 31st, 2006, 04:36 AM
.htaccess
Edit: Oh a cookie and nice login page enabled one... Dreamweaver has alot of features like log in user and more... they require MySQL though
Vectar
August 31st, 2006, 05:33 AM
cant really find anything i am looking for with .htaccess It should work like this. Let say my site is www.website.com I want the folder www.website.com/protected to be protected with a password. When somebody will open the url www.website.com/protected a nice form will appear, asking a user name and password when that is filled in the user will have access to that folder and all the other folders in it. All the the .htaccess password protections i found are the once with a popup prompt screen but i dont want that. I just need a nice login form to show up with my logo and a nice font. Building a form is no problem and building a protected url is also not a problem, but building a protected folder is the problem. Please give me some more info
chrisclick
August 31st, 2006, 06:47 AM
Oh... I can create one. I'll create a demo one to see if its what you want
I know what you mean
Vectar
August 31st, 2006, 07:26 AM
That would be great.
chrisclick
August 31st, 2006, 09:43 AM
It might take a while... I have a problem with my MySQL tables
Vectar
August 31st, 2006, 09:57 AM
take your time i will watch the forum to see if you made it
chrisclick
September 1st, 2006, 06:10 PM
Ok. Its not secure as I thought as my MySQL is under repair for some stupid reason
Its just a log-in page which you enter a username and password, it sends the info to a file to see if its correct and then dicides if it is correct you are sent to welcome.php if its incorrect you are sent to error.php
Here it it http://support.chrisphp.com
Edit: Files have been removed from support.chrisphp.com
GPP
September 1st, 2006, 06:19 PM
You should add cookies so that somone doesn't just type in http://support.chrisphp.com/welcome.php and looks at the protected page :)
chrisclick
September 1st, 2006, 06:27 PM
yes... I know Im creating a javascript that will dissallow that and I will use cookies.
Edit: Or prehaps sessions if the user is editing then saving work... (depends on my mood)
Sniper Jo
September 2nd, 2006, 06:51 AM
Dont use javascript if you want to make it secure. use sessions in php, ( $_SESSION )
Vectar
September 2nd, 2006, 01:56 PM
thanks for all the help everybody.
Is it possible to have the files or the script or the way to protect my folder on my server ?
I think your system might work for me.
But it should not ask to log in for every file i click on in the same folder, cant really test if your system is working that way but if i can get the files then i would like to try it on my server
chrisclick
September 5th, 2006, 11:19 AM
ok...
@Sniper Jo: Javascript will be used to prevent bypassing the loging system. And Sessions shall be used.
@Vectar: I will get the files from my server now.
Edit:
38833
error.php >> The user is redirected here if he inserts the incorrect details.
welcome.php >> The user is redirected here if he inserts the correct details.
t34h53i78s07i8s7a689s7e7c8u8r6t3yme786as78u6374ur3 43e.php >> The details the user inserted are checked to see if they are correct here.
index.php >> The log in page is here.
Vectar
September 6th, 2006, 04:43 AM
Hi Chris,
Thanks for all your help but still its not what i needed.
When i place my files in the folder (www.vectar.nl/protected) and type in the direct link to that folder.
I have to log in first (that part is good) but if i place in a different folder in that folder (www.vectar.nl/protected/newfolder) then that folder is not protected with the password.
This protection is just for one file but i need the whole folder to be protected.
En let it work with a cookie so every file can be opent when you are logged in.
I am not sure if its even possible what i want but i know it is with a pop up prompt login but i just needed a nice custom log in screen that i allready made to be the login screen for that folder.
Again thanks for all your help, i am sorry for taking your time.
Greetz,
Vectar
raz
September 6th, 2006, 06:02 PM
You need to use .htaccess. There isnt a way PHP can protect a ENTIRE folder if it has subdirectories.
If you need to, you could even insert a index.html page in each subfolder and have it meta refresh to your login page. Thats simple enough and always works... You cant get by it. (I'm pretty sure you cant atleast).
mBm
September 7th, 2006, 03:26 PM
see http://www.mng.cc/admin
if you want i make a new code similar with this.
mBm
September 7th, 2006, 03:27 PM
it uses MySQL+PHP authentication.
mBm
September 7th, 2006, 03:38 PM
it uses MySQL+PHP authentication. if you want i can do it only in PHP for you.
chrisclick
September 9th, 2006, 08:39 AM
as i said in an earlier post and raz in a recent post its best to use .htaccess
raz
September 9th, 2006, 03:45 PM
as i said in an earlier post and raz in a recent post its best to use .htaccess
Lol it would be the easiest but some people like the more difficult approach :) As for me, I like easy if it gets the job done and is efficient.
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.