Computing.Net > Forums > Web Development > php data security on server

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

php data security on server

Reply to Message Icon

Name: smbotans
Date: January 8, 2007 at 18:31:19 Pacific
OS: Windows XP Home
CPU/Ram: AMD XP 2000 and 512 Megs
Comment:

hey all,

i need help with securing customer data on a server via php

each customer has his/her own folder that contains his/her data and i want to make sure that only that customer can access that data

currently i am using a membership program to manage all this but i want to offer more ... specifically:

1. when they log in, their data folder and data files have their permission changed to allow them to make changes ... and when they log out, the permissions set to a secure level

2. i want to encrypt their data file (which will get decrypted when they log in)

could you point me to the right php commands to do that, please?

i tried 1. once with another membership site and got nowhere ... i kept getting an error every time i used 'chmod'

thanks in advance

serge

SEO Resources

Target the right Keywords

FREE SEO Report



Sponsored Link
Ads by Google

Response Number 1
Name: Michael J (by mjdamato)
Date: January 9, 2007 at 08:18:59 Pacific
Reply:

That sounds a little over the top to me. Changing read/write permissions of files dynamically doesn't accomplish much, IMHO. I'd suggest puttng the files in a directory outside of the public folder where they are only accessible through scripts. That way they cannot (through the web) access the files without properly logging in - assuming there are no holes.

Your biggest threat would be from someone gaining access at the server level, which is why using chmod is pointless, IMHO. So, encryption is an option. The problem, however, is that if someone already has access to the files directly, they would have access to the PHP files as well - which would identify how the files were encrypted.

You would want to use a key for the encryption that the hacker would not have access to. Assuming you have the user's passwords MD5 hashed (or something similar) you could use a combination of that hash + the actual passowrd to encrypt/decrypt the files. You would have to make sure if you allow the user's to change their passwords that take care to do everything properly so they aren't locked out. Also, encrypting/decrypting can be CPU intensive so it could introduce a time barrier for your clients. I would only decrypt when they request a file - not decrypt all when they login.

I don't like to recommend alternate forums when I'm posting on one, but I think you would get a much better wealth of knowledge by asking this question on phpfreaks.com.

Michael J


0

Response Number 2
Name: smbotans
Date: January 9, 2007 at 19:06:27 Pacific
Reply:

thanks michael ... will check out the suggested forum and the idea of storing it in a non public folder and the md5 idea

serge

SEO Resources

Target the right Keywords

FREE SEO Report


0

Response Number 3
Name: Michael J (by mjdamato)
Date: January 9, 2007 at 19:28:46 Pacific
Reply:

The MD5 "idea" was ONLY in reference to the user's password. MD5 is a hashing method not an encryption method. It is a one way conversion, if you were to hash the user's data using MD5 it would be lost forever.

Michael J


0

Response Number 4
Name: smbotans
Date: January 10, 2007 at 18:30:40 Pacific
Reply:

i am still getting to terms with encryption with php and especially the use of the term hash ... i think i understand now ... thanks again

serge

SEO Resource

FREE Keyword Report from Meta Keywords Advice


0

Response Number 5
Name: Taurus
Date: January 26, 2007 at 18:04:57 Pacific
Reply:

Changing the file permissions upon a login and re-securing them when they log out isn't the best way to go about it. That would mean that a user's files are vulnerable to attack once the user has logged in. And what if they don't log out? A timer of some sort would have to be created to keep re-secure the files after a certain time. But I still wouldn't recommend it.

I wouldn't recommend using a file system at all to store user accounts but it is possible. I would much rather use a database. But if the facility to do that isn't available to you, then the file system would work.

You should use a file permission of 600 to only allow an owner read or write, the files will only be accessed by scripts that way. A simple way of doing it would be to read each line of a file into an array with the file() function (check out php.net) and edit them based on array indexes. :)

Well that's my two cents. Good luck. :)


0

Related Posts

See More



Response Number 6
Name: smbotans
Date: January 26, 2007 at 18:37:57 Pacific
Reply:

thanks for your thoughts taurus ... my idea with chmod was to change file permissions when the data is read/saved and then set them back to secure mode straight away ... this way the file would be 'vulnerable' only for the amount of time it takes for the file to be read/saved

cheers

serge

SEO Resources

Target the right Keywords

FREE SEO Report


0

Response Number 7
Name: Taurus
Date: January 27, 2007 at 04:12:27 Pacific
Reply:

Hey. I understand what your trying to do now but theres no need. If you change the permissions to 600 then only an owner can read and write to that file. It could still be accessed by a script but not by anyone else. And a simple control panel would be easy to set up to actually read and write data to the file. Every member would need there own file to make things handy.

Developers have a sense of humour, it's just commented out.


0

Response Number 8
Name: smbotans
Date: January 28, 2007 at 17:47:50 Pacific
Reply:

thanks taurus

i have a control panel done and each member has his/her own folder and files ... i will use the chmod 600 to secure the pages ... better than nothing

thanks again

serge


SEO Resources

Target the right Keywords

FREE SEO Report


0

Response Number 9
Name: Taurus
Date: January 30, 2007 at 12:13:36 Pacific
Reply:

Excellent. There should be no worries with that. Best of luck. (",)

Developers have a sense of humour, it's just commented out.


0

Sponsored Link
Ads by Google
Reply to Message Icon






Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Web Development Forum Home


Sponsored links

Ads by Google


Results for: php data security on server

PHP- Open Results on new Page? www.computing.net/answers/webdevel/php-open-results-on-new-page/211.html

Secure PHP - SQL Injects, etc www.computing.net/answers/webdevel/secure-php-sql-injects-etc/257.html

Setting up apache server w/php+mysq www.computing.net/answers/webdevel/setting-up-apache-server-wphpmysq/2743.html