Hey guys!
Okay so at the moment I'm half way through working on a huge web script, and I have files that are included in certain pages.
But I don't want these pages to be accessed individually, as they just display an error anyway.
So how would I create a script that displayed an error message if say getposts.php was accessed?
You could set a variable in index.php and check it with each page as the first step.
Okay, so could I create a file named protect.php and within that have the code
And then another file named protectmsg.php with the codeCode:<?php
define('protect', 1);
?>
and if I don't want the file public accessible just include protectmsg.php and if I do want the script to be ran include protect.php?Code:<?php
if(!defined('protect')){
echo 'Denied.';
die;
}
?>
Yea.. here I made a little tutorial months ago that explains Bioshox's method :
Protect Php Files - Trill Designs
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks