Closed Thread Icon

Topic awaiting preservation: Downloadable .php files, but only in a certain directory? (Page 1 of 1) Pages that link to <a href="http://ozoneasylum.com/backlink?for=12476" title="Pages that link to Topic awaiting preservation: Downloadable .php files, but only in a certain directory? (Page 1 of 1)" rel="nofollow" >Topic awaiting preservation: Downloadable .php files, but only in a certain directory? <span class="small">(Page 1 of 1)</span>\

 
Synthetic
Paranoid (IV) Inmate

From: under your rug,
Insane since: Jul 2001

posted posted 10-17-2002 18:59

I want to setup a directory where i can share some of my .php script files with a few friends of mine. I know I can just .zip the file and do it that way, but is it possible to maybe put something in my .htacess file to say all .php files in this directory should not be parsed but instead should be downloadable or treated as a .zip file or something to that effect?

I've been reading on several sites for the solution but not had much luck so far

Thanks in advance, let me know if I wasn't clear enough...

Pugzly
Paranoid (IV) Inmate

From: 127.0.0.1
Insane since: Apr 2000

posted posted 10-18-2002 01:16

Hmmm... I wonder if doing something with headers might work...

I make a db query for some fields, and then print them, with the following at the top of the page:

code:
header("Content-Description: source for $fname - $fname.php"); 
header("Content-Type: text/x-vcard;\n");
if (strstr($HTTP_USER_AGENT, 'MSIE 5.5')) { // spell attachment wrong for msie5.5 sp1, cause microsoft is retarded
header("Content-Disposition: atttachment; filename=\"$fname.php\"");
} else {
header("Content-Disposition: attachment; filename=\"$fname.php\"");
}
header("Content-Transfer-Encoding: 8bit");



This causes the prompt to save the file (in this case, a v-card). Dunno if it's of much help....

bitdamaged
Maniac (V) Mad Scientist

From: 100101010011 <-- right about here
Insane since: Mar 2000

posted posted 10-18-2002 01:28

Try dropping an .htaccess file in with this line

AddType text/plain .php


That should overwrite the php parsing. Won't make them downloadable but they can see the php



.:[ Never resist a perfect moment ]:.

[This message has been edited by bitdamaged (edited 10-18-2002).]

Synthetic
Paranoid (IV) Inmate

From: under your rug,
Insane since: Jul 2001

posted posted 10-18-2002 04:31

Thanks you both

I had already tried your idea bitdamaged and it was ok but still not what I wanted, so I just kept playing with it and finally figured it out...

code:
AddType application/octet-stream .php

Makes all .php files in my script directory prompt for download just like an exe file would

[This message has been edited by Synthetic (edited 10-18-2002).]

mr.maX
Maniac (V) Mad Scientist

From: Belgrade, Serbia
Insane since: Sep 2000

posted posted 10-18-2002 08:50

I'll point out another way for showing PHP source code that people like to use - by renaming your files to *.phps extension, they will be showed directly in browser with PHP's default syntax highlighting...


Synthetic
Paranoid (IV) Inmate

From: under your rug,
Insane since: Jul 2001

posted posted 10-18-2002 19:43

wow very cool mr.maX , thanks a bunch

*I can't belive I didn't already know about that*

[This message has been edited by Synthetic (edited 10-18-2002).]

mr.maX
Maniac (V) Mad Scientist

From: Belgrade, Serbia
Insane since: Sep 2000

posted posted 10-18-2002 20:30

You can also change syntax highlighting colors by modifying appropriate values in php.ini configuration file...


« BackwardsOnwards »

Show Forum Drop Down Menu