Jump to content

Archived

This topic is now archived and is closed to further replies.

feri_soft

Access to a file

Recommended Posts

How to restrict the direct access to a certain file but in the same way when i redirect from one script to this file the user can see and operate it.I know that it can be done with define but i dont know the way its done :)

Share this post


Link to post
Share on other sites
You want to be able to only include it, but not view it?

Here's how to do it-
[code]<?php
//This is the place where you include-
$confrim="";
include("OnlyInclude.php");


//This is how the included file should look-
if(!isset($confrim)) die("No direct access");
//rest of included file here
?>[/code]

Orio.

Share this post


Link to post
Share on other sites
I dont want to include i want to redirect to a file fron another one using meta but a user must not be able to access the 2-nd file directly if not redirected from the first.

Share this post


Link to post
Share on other sites
You'll either have to set a temporary cookie which has a unique identifier which will be used by the send page to work out whether the user has visited the first one. Or use the $_SERVER['HTTP_REFERER'] variable to check whether tehy have come from the first page. However this is easily spoofed.

Share this post


Link to post
Share on other sites

×

Important Information

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.