Hi,
I built a homepage. Some folders/pages should be no-accessible to visitors. Could someone show me a simple php script to do this.
Thanks.
phpnovice :lol:
Use .htaccess and .htpasswd to protect folders
Read more.
http://www.clockwatchers.com/htaccess_tool.html
http://web-bureau.com/modules/bsecure.php
Hope it helps.
Thanks a lot. I am working on it.
phpnovice
Use .htaccess and .htpasswd to protect folders
Read more.
http://www.clockwatchers.com/htaccess_tool.html
http://web-bureau.com/modules/bsecure.phpHope it helps.
Also I find this handy if I want to completely block users from viewing the contents of a folder; just put deny from all in a .htaccess file to block all users! :) This is great for a folder that contains include files that are included by other scripts but are never seen directly :)
Also I find this handy if I want to completely block users from viewing the contents of a folder; just put deny from all in a .htaccess file to block all users! :) This is great for a folder that contains include files that are included by other scripts but are never seen directly :)
Hi Gary,
Thanks for your help. I tried .htaccess, but it did not work. Once I set it up, I could not access mysql. Any attempt was refused by mysql. I tried different php code, and none of them worked. Then I switched my apache server to abyss server. Now I can easily access mysql. The problem is that abyss appears not support .htaccess. It will be greatly appreciated if you would help me set this protection up.
Thank you very much.
phpnovice
Yep, .htaccess is only for Apache; and that's the only webserver I know, sorry ;)
apache is better than abyss... try switching back.
With .htaccess a little trick learned is to use:
IndexIgnore *.php
You can use things other than php but basically this hides all files from being seen in a directory if they have a .php extension. You can still open them however, so this should only really be used to hide rather than to block.
Interesting, thanks YoungCoder ;) If I had the time, I would look through the whole Apache doc to learn more things - but sadly, I don't :p
Interesting, thanks YoungCoder ;) If I had the time, I would look through the whole Apache doc to learn more things - but sadly, I don't :p
That would acctually make quite a nice bedtime read! So when you goto bed after a hard day coding, and are ready to unwind, you can have a nice thorough read! I have done similar before and have acctually dreamt about programming!
Same with me ;) But I have had stranger dreams as well.
That would acctually make quite a nice bedtime read! So when you goto bed after a hard day coding, and are ready to unwind, you can have a nice thorough read! I have done similar before and have acctually dreamt about programming!
Nice, it must be very fancy if you display your programming dream on web. I can not because I can only spend a little time each day on this.
Thanks for your help.
pnpnovice
I built a homepage. Some folders/pages should be no-accessible to visitors. Could someone show me a simple php script to do this.
There is simple php script which I'm using. It does not have a lot of extra features, but performs its primary task very good.
http://www.zubrag.com/scripts/password-protect.php
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.