Jump to content
xisto Community
Sign in to follow this  
maddog39

Secure Dynamic Pages Another good php tutorial.

Recommended Posts

Hello all,

 

Recently a friend of mine gave me this code to make your site completley dynamic and secure at the same time. Here is what you have to do.

 

Open a new page in your text editor and paste in this code.

<?phperror_reporting (E_ALL ^ E_NOTICE);if(!$page){ $page = $HTTP_GET_VARS['page']; }if($page=="" or $page=="main"){	include("main.php");}if($page=""){   die("You cannot access this page directly...");}?>
Then save the file as index.php.

 

After that upload the file onto your server and make your main content page 'main.php' but dont put any template graphics or things like that. Just leaave it as plain text and links, things like that.

 

Also make all your pages end with the extenstion '.php' and you can access them by

'http://ww2.yourname.com/?page=index&page=somepage'

Also the pages are now secure because if you dont put anything after the '=' sign it will think you are trying to access the page directly so thats where the 'die();' message comes in and blocks anything from going into the files. :P This will ensure that hackers cant get to things that easily. So enjoy and protect your site against evil dooers. ;):D:D

Share this post


Link to post
Share on other sites

actually, you must know that the page=NAMEHERE must be the same as NAMEHERE.php So actually, it's not secure!Thats just simple PHP Navigation! ;) I use it on my site... This is the PHP version of Frames, it uses the include php function!

Share this post


Link to post
Share on other sites

True, however, that isn't secure, it's just a run around. I guess it confuses the people who don't have a clue, but they wouldn't be hackers, now would they? ;)

Share this post


Link to post
Share on other sites

Well the way to fix that problem is to make another php snippet and put it into every single page but I cant figure out what that would be. I have been trying all different things and I cant figure it out. :D There must be some simple solution that I just not thinking of. ;):P

Share this post


Link to post
Share on other sites

The HED pe site is really good. http://www.hedrocks.com/ You cant right click, or view the source.. I wanna get their "no view source" script! lol

53618[/snapback]

you might have just been misled to believe you can't view the source code. :P if you're seeing blanks, you have to scroll down a bit more. as for the no-right click to view source, it's a simple javascript code from dynamicdrive. how did i know, i viewed their source code! :D from your browser menu, click view, then view (page) source. ;)

 

hehehe?

Share this post


Link to post
Share on other sites

doh, i was too lazy to scroll down, as for the no right click script, i've used it before and personally, it's really annoying! cause i like to be able to easily copy links from my website by right clicking and copy link locationyou can also find it at javascriptsource.com i believe!..as for scrolling down, they're slick.. lol

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | 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.