TalkPHP

TalkPHP (http://www.talkphp.com/forums.php)
-   General (http://www.talkphp.com/general/)
-   -   Direct Access Help (http://www.talkphp.com/general/4397-direct-access-help.html)

tego10122 05-19-2009 06:23 PM

Direct Access Help
 
I need to find out how to define, if the browser is on login.php so (http://domain.com/login.php) If so then render and error ('no direct acess -> redirect(/); , but if login.php was fetched by jquery "lightbox" or a include('login.php'); I want it to show the login form.

Note: its complicated for me because I need it to figure out if its beeing fetched by the website cause anyone can do a include('http://domain.com/login.php'); and get it.

maZtah 05-19-2009 07:39 PM

You can define a variable on every page. Then check within the login.php file if the variable is defined before.

So on every page:

PHP Code:

define('ACCESS'TRUE); 

Then on the login.php page:
PHP Code:

if (!defined('ACCESS'))
{
    die(
'No direct access allowed!');


Good luck!


All times are GMT. The time now is 02:52 PM.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0