Welcome to Dream.In.Code
Getting PHP Help is Easy!

Join 132,380 PHP Programmers for FREE! Get instant access to thousands of PHP experts, tutorials, code snippets, and more! There are 1,198 people online right now. Registration is fast and FREE... Join Now!




secure a .txt file

 
Reply to this topicStart new topic

secure a .txt file

Koenie
post 17 Dec, 2002 - 05:05 AM
Post #1


What?!

*****
Joined: 8 Jul, 2002
Posts: 1,313

I have a .txt file and I don't want anyone to view it (including myself) but I still want my PHP scripts be able to read it and write to it. Is there a way of securing that .txt file like that?

Thanks, Koenie
User is offlineProfile CardPM

Go to the top of the page

fyrestorm
post 17 Dec, 2002 - 05:16 PM
Post #2


D.I.C Lover

Group Icon
Joined: 4 Apr, 2002
Posts: 3,103



Thanked 1 times

Dream Kudos: 228
My Contributions


yup there is, it's called a .htaccess page, and i'll tell you how to make it, in a moment, gotta pull up the code...
User is offlineProfile CardPM

Go to the top of the page

fyrestorm
post 17 Dec, 2002 - 05:18 PM
Post #3


D.I.C Lover

Group Icon
Joined: 4 Apr, 2002
Posts: 3,103



Thanked 1 times

Dream Kudos: 228
My Contributions


ok create a file named .htaccess

and put the following in it

CODE

<files "*.*">
deny from all
</files>


and then upload it to the dir where the file you don't want anyone to see is. i usually make a config folder and it only ever contains a config file and the .htaccess file

hope this helps you, if not ask more and i'll try to help you out better
User is offlineProfile CardPM

Go to the top of the page

gneato
post 18 Dec, 2002 - 01:03 AM
Post #4


<title>Untitled Document</title>

*****
Joined: 3 Sep, 2001
Posts: 1,311

That won't prevent people with shell access from viewing it.
User is offlineProfile CardPM

Go to the top of the page

fyrestorm
post 18 Dec, 2002 - 07:51 AM
Post #5


D.I.C Lover

Group Icon
Joined: 4 Apr, 2002
Posts: 3,103



Thanked 1 times

Dream Kudos: 228
My Contributions


then what do you suggest?
User is offlineProfile CardPM

Go to the top of the page

Quik
post 18 Dec, 2002 - 07:58 AM
Post #6


D.I.C Lover

Group Icon
Joined: 6 Mar, 2001
Posts: 3,750



Thanked 1 times
My Contributions


QUOTE(gneato @ Dec 18 2002, 05:03 AM)
That won't prevent people with shell access from viewing it.

nothign will prevent someone from accesing a file.. IF THEY HAVE SHELL ACCESS!
User is offlineProfile CardPM

Go to the top of the page

gneato
post 18 Dec, 2002 - 08:21 AM
Post #7


<title>Untitled Document</title>

*****
Joined: 3 Sep, 2001
Posts: 1,311

QUOTE(Quik @ Dec 18 2002, 09:58 AM)
QUOTE(gneato @ Dec 18 2002, 05:03 AM)
That won't prevent people with shell access from viewing it.

nothign will prevent someone from accesing a file.. IF THEY HAVE SHELL ACCESS!



Unix has this really cool feature called permissions.

Unfortunately, Guardian's current setup runs every single site's php with the same username (most web hosts are like this) so if one site's php script can look at a file, so can the other site's php scripts.


If you're only worried about people viewing the file from the internet, then the .htaccess is a great way.
User is offlineProfile CardPM

Go to the top of the page

Koenie
post 19 Dec, 2002 - 05:01 AM
Post #8


What?!

*****
Joined: 8 Jul, 2002
Posts: 1,313

Can my PHP scripts still work with it this way?
How does the file need to be called? just '.htacces'?
Can I make that file using something like: notepad?

Koenie
User is offlineProfile CardPM

Go to the top of the page

fyrestorm
post 19 Dec, 2002 - 07:54 AM
Post #9


D.I.C Lover

Group Icon
Joined: 4 Apr, 2002
Posts: 3,103



Thanked 1 times

Dream Kudos: 228
My Contributions


call the file .htaccess

yes your scripts can still work, if of course, they're being included in another script...

and yes, you can use notepad to create that file in
User is offlineProfile CardPM

Go to the top of the page

Cookie Mobster
post 19 Dec, 2002 - 08:38 AM
Post #10


nooneenooneenooonee

Group Icon
Joined: 12 Oct, 2001
Posts: 4,723



Dream Kudos: 18
My Contributions


But if you make it one a windows machine you will have to name is something other then .htaccess and upload it and change the name, windows doesn't like a filename starting with .
User is offlineProfile CardPM

Go to the top of the page

fyrestorm
post 19 Dec, 2002 - 08:41 AM
Post #11


D.I.C Lover

Group Icon
Joined: 4 Apr, 2002
Posts: 3,103



Thanked 1 times

Dream Kudos: 228
My Contributions


QUOTE(Cookie Mobster @ Dec 19 2002, 10:38 AM)
But if you make it one a windows machine you will have to name is something other then .htaccess and upload it and change the name, windows doesn't like a filename starting with .

that's odd, i have no problems making .htaccess files on a windows machine...
User is offlineProfile CardPM

Go to the top of the page

Fast ReplyReply to this topicStart new topic
Time is now: 11/22/08 06:24AM

Live PHP Help!

PHP Tutorials

Reference Sheets

PHP Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month