Hello,
I have not found a clear way of doing what I want and resort to posting
my question.
I have a php file that will link to pdf files from a directory called
pdf (within the apache htdocs folder). The way I have it coded now, the
address to the pdf shows in the address bar, and a user can modify just
the file name to read other files, which is something I don't want.
I am trying to deny access to this pdf directory to anyone except the
localhost, so that changing the file name will not allow viewing it. Is
this the proper way I should go about resolving the matter?
Is there a better way?
Thank you,
psion
P.S. I have tried what I think would be best, which is to display a pdf
file by "printing" it with the php file, ie:
$file_contents = file_get_conten ts('$filename') ;
header('Content-type: application/pdf');
print $file_contents;
but I get an error, stating that the pdf file can't be displayed
because it may be corrupt, and it isn't. Was anyone successful in doing
something like this? 2 4725
psion wrote: P.S. I have tried what I think would be best, which is to display a pdf file by "printing" it with the php file, ie:
$file_contents = file_get_conten ts('$filename') ; header('Content-type: application/pdf'); print $file_contents;
but I get an error, stating that the pdf file can't be displayed because it may be corrupt, and it isn't. Was anyone successful in doing something like this?
The reason you get an error, is because you are trying to read the
content of the file named $filename, as opposed to the file named
whatever the variable $filename contains. Check up on the difference
between single ' and double " quotes. Another thing is that you
shouldn't be using quotes at all in this case. The line should read
something like this:
$file_contents = file_get_conten ts($filename);
--
Tommy Gildseth http://design.twobarks.com/
Either way, without quotes or with quote (single or double), I seem to
end up with an error:
File does not begin with 'PDF%'
Searching for this on google does not point to solutions. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Jan Bols |
last post by:
I'm using PHP 4.3 and APACHE2.0. I have a website that requires people
to log in before they can download files from my website. A person is
logged in if there is a session-variable $logged_in set to TRUE.
How can I prevent people from downloading a file (f.e. myfile.doc)
without being logged in when they know the direct link to the file
(http://www.mysite.com/somedir/myfile.doc)?
Putting the file in an obscure place by working with...
|
by: spike |
last post by:
I tried to upload a .htaccess-file to the directory that i wanted to
protect.
This is what I wrote in it:
------------------------------------------------
<Limit GET>
order deny,allow
deny from all
allow from mydomain.com
</Limit>
|
by: CJM |
last post by:
I have a intranet-based system running IIS5/6. We have a secure logon
feature whereby certain users can access restricted content. While most of
this is ASP pages, and thus we can control that, some of the content is
served directly as a PDF or plain html (automatically generated from
MSOffice!).
If a user discovers the location of this content, he access it directly
through the browser (bypassing the menus), which rather makes a mockery...
|
by: ABC |
last post by:
How can I deny all users directly access image files from images folder?
|
by: Tim::.. |
last post by:
Hi can someone please tell me why this web.config file doesn't deny access to
all for the folder it is in???
I have the web.config file in a folder called contents but for some reason I
can still access this folder. I am using Forms authentification and I just
can't get it to work!
PLEASE help...
Thanks
| |
by: Nosferatum |
last post by:
I am in need of a solution on how to solve this problem:
I need to limit access to six different folders. My users are
validated in a system which check their prescence with a couple of
variables in a db and then forwards them if they exist. Based upoen
their status they are redirected to one of six folders.
Users belonging to group A shall get access to folder A, but not B, C
etc. It must be possible to limit access in this order by...
|
by: ramakanaveen |
last post by:
Hi ,
I have an applet like
<Applet code="x.class" codebase="a.jar,b.jar" ...>
The above a.jar and b.jar are in defaultwebapp folder of web application which is a public access folder, so everybody can download the jar files by typing
http://url/a.jar.
The requirement is not to allow the jar files to download , so i denied access by modifying the <URL-Pattern> in web.xml ,
|
by: Jankie |
last post by:
Good morning everyone
Am hopeful that someone can share me some advice as to the best .htaccess example for a site under development.
When i use something like this:
<Limit GET POST>
order deny,allow
deny from all
allow from my ip
|
by: samvb |
last post by:
Hi,
I have a folder within my root website (cant move it out cos of restrictions). I have placed htaccess file in it which works just fine. It displays the usual log in box when someone tries to access it. But my script needs to access the folder in a hidden way. is there nyway, i can pass the login info the htaccess files and log in to the folder without havin to display the login window?
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
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 captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |