code to secure .txt / .dat file?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
mesz
Forum Contributor
Posts: 216
Joined: Fri May 23, 2003 8:11 am
Location: M/cr

code to secure .txt / .dat file?

Post by mesz »

Code: Select all

<?php
<?php 
session_start();
if ($permission=="yes") { 
?> 
[b]T E X T[/b]<?php }else{ ?> 
you are not allowed to access this page 

<?php } ?>
?>
the above code is what I would typically use to keep a casual user away from the content of a php page.....
but
how do I secure a text file?
Nay
Forum Regular
Posts: 951
Joined: Fri Jun 20, 2003 11:03 am
Location: Brisbane, Australia

Post by Nay »

If you want to protect them from direct access, then take a look at:

viewtopic.php?t=12878

-Nay
User avatar
Derfel Cadarn
Forum Contributor
Posts: 193
Joined: Thu Jul 17, 2003 12:02 pm
Location: Berlin, Germany

Post by Derfel Cadarn »

I was just about to suggest one of the sollutions when my computer crashed 8O
And now I saw that my suggestion is already in the posting mentioned in Nay's answer:
- hide the file in an not-accessible dir and
- indlude it.
User avatar
mesz
Forum Contributor
Posts: 216
Joined: Fri May 23, 2003 8:11 am
Location: M/cr

Post by mesz »

Cheers ( once ) again for your help.
I opted for the . htaccess file
I understand that this is not the most ' complex ' answer to go for, but it does kill prying eyes dead.
Post Reply