I'm creating a web page and I want to know if there is a way to block access to certain pages but reachable if PHP loads them. The idea is this; I have some modules that I include(); them with PHP. There will be no problem if users reach them by typing them into the address bar because they are managed with $_SESSION vars and they be seeing what they see in the included page but I just want to prevent that because if somebody discovers that link it is an uncomfortable view.
Asked
Active
Viewed 71 times
0
Ivan
- 34,531
- 8
- 55
- 100
Güney Saramalı
- 791
- 1
- 10
- 19
-
1Can you share your code, so that we can look on to the problem ? – Sulthan Allaudeen Aug 28 '17 at 15:16
-
2lookup .htaccess – clearshot66 Aug 28 '17 at 15:17
-
See [this](https://stackoverflow.com/q/33999475/863110) question. – Mosh Feu Aug 28 '17 at 15:24
-
@SulthanAllaudeen there is no code mate. You want me to share a normal web page codes? – Güney Saramalı Aug 28 '17 at 16:20
-
@clearshot66 thank you mate I will check. – Güney Saramalı Aug 28 '17 at 16:20
-
@MoshFeu this is what exactly im looking for.. – Güney Saramalı Aug 28 '17 at 16:20
-
Glad to hear :) – Mosh Feu Aug 29 '17 at 08:59
1 Answers
0
This is the answer if anybody searches.
if(!isset($_SERVER['HTTP_REFERER'])){
// redirect them to your desired location
header('location:../index.php');
exit;
}
at this to the top of the page inside php tags.
Güney Saramalı
- 791
- 1
- 10
- 19