Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Old 11-10-2005, 05:41 AM Security of php code
Nahele's Avatar
Extreme Talker

Posts: 204
Trades: 1
So I know that any PHP code that you have on a webpage doesn't show up when you view source as it is run server side and only the HTML output is shown, but how easy is it for someone to get access to that script. For example, say I have a site that you login with. Once you hit submit, it accesses another script for authentication. That script contains the address, name, username and password of the database I need to access to authenticate.

How easy is it for someone to actually look at that php coding and get that information. Any suggestions on how to better blockade that information.
Nahele is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 11-10-2005, 05:43 AM
ibbo's Avatar
Super Spam Talker

Posts: 880
Location: Leeds UK
Trades: 0
They would not need to see the code itself as many request are transmitted in clear.

If you want to prevent this then you need to encrypt your post data or you can use https with SSL.

Ibbo
__________________

Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE

Linux user #349545 :
(GNU/Linux)iD8DBQBAzWjX+MZAIjBWXGURAmflAKCntuBbuKCWenpm XoA7LNydllVQOwCf
ibbo is offline
Reply With Quote
View Public Profile Visit ibbo's homepage!
 
Old 11-10-2005, 10:49 AM
Christopher's Avatar
Iced Cap

Latest Blog Post:
Cross-domain AJAX with JSONP
Posts: 3,110
Location: Toronto, Ontario
Trades: 0
No end user will be able to see your PHP code unless your server is sending it as plain text (ie. .php extension isn't registered to be interpreted as PHP).

If you want to be extra secure, create a separate 'config' file that holds your sensitive data (passwords etc) and place it outside of your public web directory. Most servers have a public_html/ directory which is used to store all of your files. If you place it somewhere out of this directory, no user will ever be able to access it from the web (unless they've got FTP access etc). You can then just include() the file.

ibbo, I think Nahele means information in the actual PHP code (like database passwords etc), not the form data the user is submitting to the server.
__________________

Please login or register to view this content. Registration is FREE
- Latest Articles:
Please login or register to view this content. Registration is FREE
,
Please login or register to view this content. Registration is FREE

--
Please login or register to view this content. Registration is FREE

Christopher is offline
Reply With Quote
View Public Profile
 
Old 11-10-2005, 10:25 PM
Super Talker

Posts: 110
Trades: 0
how about using the PHP encoders like sourceguardian.com and ioncube.com ???
__________________

Please login or register to view this content. Registration is FREE
varunbihani is offline
Reply With Quote
View Public Profile Visit varunbihani's homepage!
 
Old 11-10-2005, 10:55 PM
Christopher's Avatar
Iced Cap

Latest Blog Post:
Cross-domain AJAX with JSONP
Posts: 3,110
Location: Toronto, Ontario
Trades: 0
Those work too (Don't forget Zend Encoder!)
__________________

Please login or register to view this content. Registration is FREE
- Latest Articles:
Please login or register to view this content. Registration is FREE
,
Please login or register to view this content. Registration is FREE

--
Please login or register to view this content. Registration is FREE

Christopher is offline
Reply With Quote
View Public Profile
 
Old 11-14-2005, 11:41 AM
ibbo's Avatar
Super Spam Talker

Posts: 880
Location: Leeds UK
Trades: 0
"ibbo, I think Nahele means information in the actual PHP code (like database passwords etc), not the form data the user is submitting to the server."

Ah well.

Keeping sensitive files outside your docroot is the way forward and I even extend it requiring a class to load another class. (which is a bog standard factory pattern).

Ibbo
__________________

Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE

Linux user #349545 :
(GNU/Linux)iD8DBQBAzWjX+MZAIjBWXGURAmflAKCntuBbuKCWenpm XoA7LNydllVQOwCf
ibbo is offline
Reply With Quote
View Public Profile Visit ibbo's homepage!
 
Old 11-15-2005, 03:03 PM
Average Talker

Posts: 24
Trades: 0
I recommend only putting your static documents in the Document Root along with a few php stub files (front controllers) and then moving all the rest of the PHP files outside of the Document Root.
__________________

Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE
Selkirk is offline
Reply With Quote
View Public Profile Visit Selkirk's homepage!
 
Old 11-15-2005, 05:40 PM
MrRundog's Avatar
Average Talker

Posts: 19
Trades: 0
How about if you have the config folder in a password protected folder in the root - does that work?
__________________
"Tell Me & I Forget; Show Me & I Remember; Involve Me & I Understand"


Please login or register to view this content. Registration is FREE
MrRundog is offline
Reply With Quote
View Public Profile
 
Old 11-15-2005, 10:18 PM
Nahele's Avatar
Extreme Talker

Posts: 204
Trades: 1
Thanks for all the notes, but the host for this site is not like the others I've worked with. Usually there is a specific folder that all pages go into and then other folders for scripts that people don't have access to, but this is just a folder that everything goes in and where my index.html is. Can I possibly create a folder in my root and set the permissions of that folder where it is not accessible to the public...what should that permission value be if I will have scripts that authenticate users in it...maybe 711 (or drwx--x--x)?
Nahele is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Security of php code
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.28224 seconds with 12 queries