473,395 Members | 1,676 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

.php files - permissions are set public readable - so can public get to see actual raw file?

Hi there,

As a newbie to PHP is it in anyway possible for a casual web surfer to
actually get to see the PHP behind my .php file.

E.g.

if index.php contained PHP code to check if the page had been called with a
variable such as "password", is there anyway a public member can get to see
the raw php file and therefore see what the password is?

index.php might be:

if ($_REQUEST[password]="secret") {
Then show one page elseshow another page

}

So if a user visits with
index.php?password=secret

they get to see the secret page.
But as the index.php has to have file permission set so that anyone can read
it, I'm worried that the public can just somehow view the file and learn the
password.

Can someone shed any light on this (assuming it makes sense).

Kind regards

Dave.
Jul 17 '05 #1
4 1719
On Wed, 26 Jan 2005 00:13:25 -0000, "Dave Smithz" <SPAM FREE WORLD> wrote:
As a newbie to PHP is it in anyway possible for a casual web surfer to
actually get to see the PHP behind my .php file.
Not unless your server is badly misconfigured.
E.g.

if index.php contained PHP code to check if the page had been called with a
variable such as "password", is there anyway a public member can get to see
the raw php file and therefore see what the password is?

index.php might be:

if ($_REQUEST[password]="secret") {
>Then show one page

else
>show another page

}

So if a user visits with
index.php?password=secret

they get to see the secret page.
But as the index.php has to have file permission set so that anyone can read
it, I'm worried that the public can just somehow view the file and learn the
password.


If the "public" is just people who view through the web server, then no,
unless your server config is broken. That rules out "casual web surfers".

However, people logged into the server itself through shell access, or running
their own PHP code on the same server would likely be able to access
public-readable scripts.

--
Andy Hassall / <an**@andyh.co.uk> / <http://www.andyh.co.uk>
<http://www.andyhsoftware.co.uk/space> Space: disk usage analysis tool
Jul 17 '05 #2

"Andy Hassall" <an**@andyh.co.uk> wrote in message >
If the "public" is just people who view through the web server, then no,
unless your server config is broken. That rules out "casual web surfers".

However, people logged into the server itself through shell access, or running their own PHP code on the same server would likely be able to access
public-readable scripts.


OK, so other users on my server from shared hosting account (like webfusion
or something) would be able to gain access to my raw php files.

So what is ideally a quick and easy way to implement security so that no one
other then the programmers get to see the raw code?
I tried password protected folders, but the problem is that then when we
want the "public" (causal web surfers) to submit information that gets
entered into the DB, they get prompted for username and password.

(See earlier post yesterday titled:
"Maybe easy - securing php files containing DB access passwords etc." )

Any thoughts?

Kind regards

Dave
Jul 17 '05 #3
.oO("Dave Smithz" <SPAM FREE WORLD>)
OK, so other users on my server from shared hosting account (like webfusion
or something) would be able to gain access to my raw php files.
Probably.
So what is ideally a quick and easy way to implement security so that no one
other then the programmers get to see the raw code?


On many shared hosts there simply is no way, because all PHP scripts run
with the same username. There are ways to run scripts under the username
of their owner, but this has to be configured by the host.

Micha
Jul 17 '05 #4
Dave Smithz wrote:
So what is ideally a quick and easy way to implement security so
that
no one other then the programmers get to see the raw code?


If the webhost supports it, Zend Encoder. Quick, easy, but definetly
not cheap. On the other hand, if there really is something worth
protecting, the price of Zend Encoder is small to pay for the
protection you get.

--
Markku Uttula

Jul 17 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

15
by: lkrubner | last post by:
I want to give users the power to edit files from an easy interface, so I create a form and a PHP script called "fileUpdate". It does a reasonable about of error checking and prints out some...
17
by: Lonnie Princehouse | last post by:
In short: Is there any way to run Python WITHOUT trying to create .pyc files (or ..pyo) or to have Python not attempt to import the .pyc files it finds? Reason: We have a site-specific...
3
by: Matthew Moran | last post by:
I am creating a series of downloadable articles, career tools, spreadsheets, etc. However, some of the content is for "registered" guest. The registrants are stored in a database and logon. I...
1
by: Rik Hoeflaak | last post by:
Hi there, I'm struggling with this problem: in a website I developed, XML files are created by users of the site to describe. The creation is OK, the (new) file is present, but it can not be...
2
by: Sathyaish | last post by:
I am using MCI (winmm.dll) to read, record and playback sound. For now, I am doing this with disk files instead of realtime doing it straight from the memory. If I want to stream/relay/transmit...
2
by: Tom Wells | last post by:
I have a little file upload page that I have been able to use to successfully upload files to the C: drive of LocalHost (my machine). I need to be able to upload to a network drive from the intranet...
0
by: FusionGuy | last post by:
I've created a file uploading handler, implemented as an httpHandler. Each time I attempt to upload a file, or files, my HttpContext.Request.Files property never contains the files that were...
2
by: FusionGuy | last post by:
I've created a file uploading handler, implemented as an httpHandler. Each time I attempt to upload a file, or files, my HttpContext.Request.Files property never contains the files that were...
9
by: jab3 | last post by:
So I'm considering a small project that involves online file storage. Let's say I wanted to set up a site that allows people to log-on, create an account, and then have space to upload files. The...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.