473,383 Members | 1,788 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,383 software developers and data experts.

Secure File

Wes
I have sessions working where individual users have their own person
information and can't view others personal info... The problem is, the
sessions block them in php but I can't block them from files that I can't
have the session security.

I tried imbedding the file into a secured php file but it did not work, my
code is below that I used. For reference, 00231 is the username to login so
it checks if the username is the same etc.

<?
// Agent Access - secure page

// session check
session_start();
if ($SESSION_UNAME != "00231" )
{
// if session check fails, invoke error handler
header("Location: error.php?e=2");
exit();
}
require("http://www.cmiteam.com/privagents/contests/test.pdf");
?>
Jul 17 '05 #1
2 3368
On Fri, 19 Dec 2003 13:38:37 -0500, Wes wrote:
I have sessions working where individual users have their own person
information and can't view others personal info... The problem is, the
sessions block them in php but I can't block them from files that I can't
have the session security.

I tried imbedding the file into a secured php file but it did not work, my
code is below that I used. For reference, 00231 is the username to login
so it checks if the username is the same etc.

<?
// Agent Access - secure page

// session check
session_start();
if ($SESSION_UNAME != "00231" )
{
// if session check fails, invoke error handler header("Location:
error.php?e=2");
exit();
}
require("http://www.cmiteam.com/privagents/contests/test.pdf");
?>

Store the PDF (and whatnot) in a directory outside of your Web accessible
directories and write a small download function to download the files. As
they're read in via the PHP script for downloading, they don't physically
need to be accessible by the Web, meaning people can't bypass your script
and access them directly. This enables you to limit access depending on
your session data.

Have the URIs such as:
<http://domain.com/privagents/contents/download.php/1
Then the likes of:
<?php
$path_info = explode('/', $_SERVER['PATH_INFO']);
$file_id = intval($path_info[1]);

download_file($file_id);
?>
Write the download_file(int ID) function to read the filename and details
from a database or equivalent and send a binary header so that the file
downloads (I'll leave this as an educational experience).
HTH =)

Regards,

Ian

--
Ian.H [Design & Development]
digiServ Network - Web solutions
www.digiserv.net | irc.digiserv.net | forum.digiserv.net
Programming, Web design, development & hosting.

Jul 17 '05 #2
Wes
Thank you Ian.H for your reply.

I will try your suggestion out.

Wes

"Ian.H" <ia*@WINDOZEdigiserv.net> wrote in message
news:pa****************************@hybris.digiser v.net...
On Fri, 19 Dec 2003 13:38:37 -0500, Wes wrote:
I have sessions working where individual users have their own person
information and can't view others personal info... The problem is, the
sessions block them in php but I can't block them from files that I can't have the session security.

I tried imbedding the file into a secured php file but it did not work, my code is below that I used. For reference, 00231 is the username to login so it checks if the username is the same etc.

<?
// Agent Access - secure page

// session check
session_start();
if ($SESSION_UNAME != "00231" )
{
// if session check fails, invoke error handler header("Location:
error.php?e=2");
exit();
}
require("http://www.cmiteam.com/privagents/contests/test.pdf");
?>

Store the PDF (and whatnot) in a directory outside of your Web accessible
directories and write a small download function to download the files. As
they're read in via the PHP script for downloading, they don't physically
need to be accessible by the Web, meaning people can't bypass your script
and access them directly. This enables you to limit access depending on
your session data.

Have the URIs such as:
<http://domain.com/privagents/contents/download.php/1
Then the likes of:
<?php
$path_info = explode('/', $_SERVER['PATH_INFO']);
$file_id = intval($path_info[1]);

download_file($file_id);
?>
Write the download_file(int ID) function to read the filename and details
from a database or equivalent and send a binary header so that the file
downloads (I'll leave this as an educational experience).
HTH =)

Regards,

Ian

--
Ian.H [Design & Development]
digiServ Network - Web solutions
www.digiserv.net | irc.digiserv.net | forum.digiserv.net
Programming, Web design, development & hosting.

Jul 17 '05 #3

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

Similar topics

21
by: Boris Genc | last post by:
Hi everybody. I was wandering is there a method or a function already implemented in python that supports secure deletion of data? I'm interested in something which is able to securely wipe data...
6
by: Billy Jacobs | last post by:
I have a website which has both secure and non-secure pages. I want to uses forms authentication. How do I accomplish this? Originally I had my web.config file in the root with Forms...
7
by: Dan V. | last post by:
Situation: I have to connect with my Windows 2000 server using VS.NET 2003 and C# and connect to a remote Linux server at another company's office and query their XML file. Their file may be...
1
by: jaYPee | last post by:
anyone know how can i secure / compile or make it secure just like mdb file to use a user level security? thanks in advance...
7
by: Norm | last post by:
Hi All, I have an MDB file which I want to remain secure. It checks for certain parameters upon startup, and will automatically exit if the program is opened/executed by an unauthorized user. ...
3
by: Pooja Renukdas | last post by:
Hello, I have this web site where only two pages have to be secure pages and I need to call them using https, but since I have my development server and my production web server, I dont want to...
3
by: Bill | last post by:
I'm running a C#.Net application that is using the HttpWebRequest to upload an xml file to a https site with FIPS complicancy turned on. On the "GetRequestStream()" method I get: "The underlying...
5
by: DraguVaso | last post by:
Hi, I need a SECURE way to copy parts of a file. I'm having files which contains a whole bunch of records. In one 'fysical' file I'm having one or more logical files. What I need to do is to...
2
by: morph276 | last post by:
I am working on a program and need to store sensitive data. I am able to create text files but I need to files to be secure. Do I use the hash class to secure my data and how would this affect new...
0
by: amitvps | last post by:
Secure Socket Layer is very important and useful for any web application but it brings some problems too with itself. Handling navigation between secure and non-secure pages is one of the cumbersome...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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...
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...

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.