How can u download a php file?!
Moderator: General Moderators
-
Black Majin
- Forum Newbie
- Posts: 22
- Joined: Wed Jul 16, 2003 12:51 pm
- Location: Garland, Texas
How can u download a php file?!
Is there any way at all that u can download a php file without it executing?
- Heavy
- Forum Contributor
- Posts: 478
- Joined: Sun Sep 22, 2002 7:36 am
- Location: Viksjöfors, Hälsingland, Sweden
- Contact:
Its in the manual header()
If you want the user to be prompted to save the data you are sending, such as a generated PDF file, you can use the Content-Disposition header to supply a recommended filename and force the browser to display the save dialog.
Note: There is a bug in Microsoft Internet Explorer 4.01 that prevents this from working. There is no workaround. There is also a bug in Microsoft Internet Explorer 5.5 that interferes with this, which can be resolved by upgrading to Service Pack 2 or later.Code: Select all
<?php // We'll be outputting a PDF header("Content-type: application/pdf"); // It will be called downloaded.pdf header("Content-Disposition: attachment; filename=downloaded.pdf"); // The PDF source is in original.pdf readfile('original.pdf'); ?>
Note: If safe mode is enabled the uid of the script is added to the realm part of the WWW-Authenticate header if you set this header (used for HTTP Authentication).
-
Black Majin
- Forum Newbie
- Posts: 22
- Joined: Wed Jul 16, 2003 12:51 pm
- Location: Garland, Texas
- Heavy
- Forum Contributor
- Posts: 478
- Joined: Sun Sep 22, 2002 7:36 am
- Location: Viksjöfors, Hälsingland, Sweden
- Contact:
That's like hacking a site. If you want to know, because you want to protect yourself, then it is OK. There are books on the subject.
EDIT: I mean cracking not hacking... We use the hacking word for that in Sweden.
Generally it is not possible to do what you want, since site admins and programmers generally do all they can to prevent what you want to do from happening.
EDIT: I mean cracking not hacking... We use the hacking word for that in Sweden.
Generally it is not possible to do what you want, since site admins and programmers generally do all they can to prevent what you want to do from happening.
-
Black Majin
- Forum Newbie
- Posts: 22
- Joined: Wed Jul 16, 2003 12:51 pm
- Location: Garland, Texas