Jump to content

lordrain11

New Members
  • Posts

    8
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

lordrain11's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I have some code that forces a download of a pdf file whent the user clicks a link. My issues is that it puts it in my current window so when the user is done with the pdf if they close it they have left the site. I really want the pdf to either open directly in acrobat or in a new browser window. I have heard that I can't control that with php so I tried another approach... When the user clicks the link it opens in a new window (Target _blank) which processes the code to force the pdf download. Problem is this new window is blank and the pdf opens in the orginal window. Is there a way to chnage which is the "parent" window or something so that it opens in the perfectly good blank window and leaves the orginal website alone? Perhaps it has to be javascript, I am open to all suggestions, thanks.
  2. After a bit more playing around it seems the exit; command is what is causing the unlink to not work. If I comment it out then it deletes the file. However, when I don't have exit; then the pdf won't open I get an I/O error. Maybe that helps you?
  3. Thanks for the quick response but I am still having a few issues. First, the unlink isn't working. Its like once the file gets pushed to the brower it stops reading the script and never executes the unlink. Any thoughts? Secondly, doing it this way opens up Acrobat and then proceeds to open the actual document up inside my exisitng window. I wanted it to open in a seperate window so when user was done with file they could just close it and continue on the site. I even tried opening this page in a new window (target_blank whent the user clicks) but the pdf file always opens in the original page.
  4. Hello, I have a php script that builds a .fdf file and stores it in a folder. No trouble there. Then I was using a header/location redirect to open that file (the .fdf file is linked to a pdf so it opens the pdf filled out). No trouble here either. The issues is there is sensative information in the fdf file so as soon as the user opens it I want it deleted off the server. Basically the user will open this file and print it but in the background I want it deleted from the server. I tried to unlink the file after my redirect but it always unlinks first so then my redirect points to something that doesn't exist. I tried putting a sleep function in but it just delays the unlink and then redirects. I need the redirect to happen first but continue to run the script on the page so it unlinks without the user having to do anything. Here is a snippit: header ("Location: https://www.mysite.com/formdata/$fdf_file"); unlink("formdata/$fdf_file"); Please help. And if there is a different way I am all ears. Thanks.
  5. Hello all, I am working on a site where I will gather info from users and store in a database. Thats the easy part. I then want to be able to pull up a pdf form (stored on the website) and have it automatically filled out by pulling info from the database. Thoughts?
  6. By block the directory from internet access do you mean with permissions? What number would accomplish that? Then how can I have the php get around that block? Also, any detail on the send header/readfile() method would be great as I am not familar with this. Thanks.
  7. WHat you said about combining the user id with the file name is actually what I am doing already. And I understand that by putting an index page up it will block the directory. But these are very sensitive files, isn't this still a security risk? Can't someone experienced still find the file names in the directory and then get the files by just typing them in? There has to be some more security I cna add. Thanks.
  8. Hello, I am a moderate php user and for a new site I am working on have come across something that I haven't had to do before. Users on the site can upload personal documents, .doc, .xls, .mp3, etc. files to the site for storage. The files are copied to a directory and the locations are inserted into the mysql table, nothing tricky there. My question is this though... I want to password protect the directory and files so that only the person who uploaded the files can view them. When users login I use php to create a session, each page of the member area checks to make sure there is a session, thats how I handle the uploads for example. How can I password protect the directory from everyone else, but allow the user to see it if they are logged in. I don't want the seperate login screen to popup, like you are logging onto a control panel because my users will have already loged on to the site, I want to do this part all behind the scenes. I further would like to do a similar thing with the individual files themselves. My first thought was to change the permissions. I didn't want to do this at the directory level though since if I changed it back for one user, then until that user was done everyone would have access to the directory. SO I thought I'd user permissions on the files. SO when the file is uploaded I set the permissions to 0, no one has access. Then when the user is logged in and click to view their file, the php can change the permission to 777 or something in between and let them look at the file. This works, but then I am stuck with how do I make sure the files get the permissions changed back to 0 when the user is done. To do it in php there needs to be an action and I don't want to trust the user that they will click another link. I also don't like the idea of people being able to go to htt://www.mypage.com/filedir/ and being able to see the list of files even if they are protected by permissions. How can I get around my problem, or is there a better way to do this that is standard? The files are very sensitive so security is a big concern here. Also, and words of advice on how to protect the server from users uploading viruses? Thanks so much, I am very appreciative of any help.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.