Jump to content


Photo

Access to a file


  • Please log in to reply
4 replies to this topic

#1 feri_soft

feri_soft
  • Members
  • PipPipPip
  • Advanced Member
  • 147 posts

Posted 29 October 2006 - 01:30 PM

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 :)

#2 Orio

Orio
  • Staff Alumni
  • Advanced Member
  • 2,491 posts

Posted 29 October 2006 - 03:19 PM

You want to be able to only include it, but not view it?

Here's how to do it-
<?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
?>

Orio.
Think you're smarty?

(Gone until 20 to November)

#3 feri_soft

feri_soft
  • Members
  • PipPipPip
  • Advanced Member
  • 147 posts

Posted 29 October 2006 - 06:07 PM

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.

#4 wildteen88

wildteen88
  • Staff Alumni
  • Advanced Member
  • 10,482 posts
  • LocationUK, Bournemouth

Posted 29 October 2006 - 06:15 PM

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.

#5 feri_soft

feri_soft
  • Members
  • PipPipPip
  • Advanced Member
  • 147 posts

Posted 29 October 2006 - 07:28 PM

Isnt there any way like in phpbb forums with the define function?




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users