473,545 Members | 1,759 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

password-protection

Wm
Something just occurred to me... <yeah, I know, it scared me too> I just
password-protected a website by including a password authentication script
in each page of a private section. The script checks the login against the
mySQL database. This type of protection will only affect the .php pages,
won't it? The images that are contained in the pages are not protected, as
they would be if I had a .htaccess file on the parent directory..? This
method will not protect me from people hot-linking images from my directory
and calling them directly, will it? What is the "best" way of protecting
the entire directory, both pages AND images?

Thanx,
Wm

Jul 17 '05 #1
3 3404

This type of protection will only affect the .php pages,
won't it? The images that are contained in the pages are not protected, as they would be if I had a .htaccess file on the parent directory..?


You're right. Use .htaccess.
Jul 17 '05 #2
> Something just occurred to me... <yeah, I know, it scared me too>
I just password-protected a website by including a password
authentication script in each page of a private section. The
script checks the login against the mySQL database. This type of
protection will only affect the .php pages, won't it?
Indeed.
The images that are contained in the pages are not protected, as
they would be if I had a .htaccess file on the parent
directory..? This method will not protect me from people
hot-linking images from my directory and calling them directly,
will it? What is the "best" way of protecting the entire
directory, both pages AND images?


Probably an .htaccess file.
--
SeeSchloß - http://www.seeschloss.net

Jul 17 '05 #3

"Wm" <LA*******@hotm ail.com> wrote in message
news:xN******** **************@ news.easynews.c om...
Something just occurred to me... <yeah, I know, it scared me too> I just
password-protected a website by including a password authentication script
in each page of a private section. The script checks the login against the
mySQL database. This type of protection will only affect the .php pages,
won't it? The images that are contained in the pages are not protected, as they would be if I had a .htaccess file on the parent directory..? This
method will not protect me from people hot-linking images from my directory and calling them directly, will it? What is the "best" way of protecting
the entire directory, both pages AND images?

Thanx,
Wm


I totally agree that .htaccess is the right way to go. However, if that is
not available to you or you have other reasons not to use it, a method I
have used to protect HTML and other downloadable files (e.g., a Word
Document) is to store the sensitive material in a directory that is not
accessible to web browsers. Under Apache, anything on the same directory
level as /htdocs will work, such as /etc or /cgi-bin. Then your protected
PHP script (which can reach into other directories besides the
web-accessible ones) obtains the document and makes it available to the
user, either immediately through the fpassthru() or readfile() functions
(for text and HTML files), or by setting up a download action via header()
statements to send binary files. Look up help topics in "file download" on
PHP websites for more info.

Note that the latter technique can be directly applied to images on your
page if you write a PHP script that grabs the desired image and sends it to
stdout, setting the appropriate header() elements to let the browser know
that an image is "on the way". Then you use the image tag in your original
php/html file to point to this "image script" file in the "src=" attribute,
e.g.,

<img src="get_my_ima ge.php?image_id =4">

Since the <img> tag lives within your protected php file, and your image
file (whatever corresponds to image_id=4) resides outside the web directory,
this will only provide the image to someone with access to your original
page.

Douglas Abernathy
Jul 17 '05 #4

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

Similar topics

11
3689
by: John Victor | last post by:
In my mysql database, I've stored all the passwords using the PASSWORD() function. Now I'm running a test and need to compare the password in my php document to that saved in the database. I used the string "Select name From users Where password = PASSWORD('$testPass')" and ran mysql_query() using the string. But nothing was returned. ...
3
14494
by: arktikturtle | last post by:
Hi! I'm looking for a way to validate a password within PL/SQL. I want to write CREATE PROCEDURE change_password(old_password IN VARCHAR2) IS BEGIN -- check if old_password is correct... but how? I can get the hashed value of the password from DBA_USERS, of course, but is there a way to hash old_password to see if it matches? (I...
2
5997
by: Jill Elaine | last post by:
I am building an Access 2002 frontend with linked tables to an encrypted Paradox 7 database. When I first create these linked tables, I'm asked for the password to the encrypted Paradox database, and the linked tables are successfully created. I use the data from these linked tables in several forms. All works great until I close the Access...
10
9842
by: Fabrizio | last post by:
(Sorry for the crosspost, but I really don't know which is the right newsgroup!) Hi all, I try to change the password to a user that as to change the password at first logon: try {
6
2282
by: Andre Ranieri | last post by:
I'm trying to create a login page for customers to log into our corporate website, our presidents naturally wants the user and password fields to populate from a cookie so the customer doesn't have to type their credentials every time, this seems like a pretty common thing. However, when I try to populate the password HTML textbox from the...
5
16898
by: scorpion53061 | last post by:
is it possible to set the database password that you can set in access for a database from a vb.net application?
26
5450
by: David Garamond | last post by:
I read that the password hash in pg_shadow is salted with username. Is this still the case? If so, since probably 99% of all PostgreSQL has "postgres" as the superuser name, wouldn't it be better to use standard Unix/Apache MD5 hash instead? -- dave ---------------------------(end of broadcast)---------------------------
8
3303
by: Katash | last post by:
Hello, I am new to PHP and am working on a login system for my site, currently supplied passwords are passed to MySQL and stored as md5 hashes, my question is :- seeing as md5 is 1 way only what would be the best way to implement a 'Forgotten Password' system whereby the user supplies an e-mail address and the password is mailed to the user?...
3
11353
by: julianmoors | last post by:
Hey, Currently I'm writing a VB.NET/1.1 app and I need to mask the input for the password field. Does anyone know how to do this in VB? I've seen a C# example, but wouldn't know how to convert it myself. Here's the URL: http://www.codeproject.com/dotnet/ConsolePasswordInput.asp
2
3176
by: DarthPeePee | last post by:
Hello everyone. I am working on a Password Strength Meter and I am running into 1 problem that I would like to fix. When pressing the "Clear Password & Try Again" button, the password clears out of the text box, but the meter will stay at its current position until text is entered back into the textbox. Once text is re-entered, the meter...
0
7467
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7807
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7419
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7756
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5326
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3450
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3442
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1014
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
703
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.