feri_soft Posted October 29, 2006 Share Posted October 29, 2006 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 :) Quote Link to comment https://forums.phpfreaks.com/topic/25481-access-to-a-file/ Share on other sites More sharing options...
Orio Posted October 29, 2006 Share Posted October 29, 2006 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. Quote Link to comment https://forums.phpfreaks.com/topic/25481-access-to-a-file/#findComment-116281 Share on other sites More sharing options...
feri_soft Posted October 29, 2006 Author Share Posted October 29, 2006 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. Quote Link to comment https://forums.phpfreaks.com/topic/25481-access-to-a-file/#findComment-116354 Share on other sites More sharing options...
wildteen88 Posted October 29, 2006 Share Posted October 29, 2006 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. Quote Link to comment https://forums.phpfreaks.com/topic/25481-access-to-a-file/#findComment-116362 Share on other sites More sharing options...
feri_soft Posted October 29, 2006 Author Share Posted October 29, 2006 Isnt there any way like in phpbb forums with the define function? Quote Link to comment https://forums.phpfreaks.com/topic/25481-access-to-a-file/#findComment-116407 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.