PHP Developers Network

A community of PHP developers offering assistance, advice, discussion, and friendship.
 
Loading
It is currently Sat Nov 22, 2014 9:08 am

All times are UTC - 5 hours




Post new topic Reply to topic  [ 2 posts ] 
Author Message
PostPosted: Fri Feb 17, 2012 6:55 pm 
Offline
Forum Regular
User avatar

Joined: Tue Sep 25, 2007 8:36 am
Posts: 521
Location: Greece
I have several files that I include as the page body for a CMS e.g.

dashboard.php
products.list.php
products.add.php
products.edit.php

Those are included through index.php using a switch. index php has the login check code and also defines a constant define('AllowAccess',1);

My question is, is a check like:
<?php if (!defined('AllowAccess')){exit();} ?> at the very top of each included page enough to protect them from direct access? Or do I have to add the login check in all those as well?

I mean constants are server-side, there shouldn't be any problem correct?


Top
 Profile  
 
PostPosted: Sat Feb 18, 2012 1:21 am 
Offline
Forum Regular
User avatar

Joined: Tue Sep 28, 2010 11:41 am
Posts: 963
Location: Columbus, Ohio
That is enough. I use something similar for mine.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group