Urgent HTML help needed!!

Status
Not open for further replies.

Cyrus_the_virus

Unmountable Boot Volume
Hi All,

I have been faced with a unique problem while i was creating a website. I have html and php pages. The problem is I have few pages which shouldn't be directly accessed.

For eg: Page1, Page2 and Page3

Now, I do not want anyone to access Page2, and Page3 directly. Page2 should be accessible only from Page1 and Page3 should be accessible only from Page2. So, one page is linked to the other. However anyone trying to access page2 and page3 directly with it's linked should get a 404 error.

Can anyone help? I need to resolve this before midnight tonight!! :(
 

victor_rambo

हॉर्न ओके प्लीज़
You can choose to prevent hotlinking. But I am not sure if that will work or not! Moreover, people whose browsers are set not to send referrrers may never be able to see the pages.

If nothing helps, PHP can do it for sure, though it a bit more complicated.
EDIT: I just realized that it would be more easier than anything with PHP! :)
 
Last edited:

dheeraj_kumar

Legen-wait for it-dary!
You can do something using referrer links, although I dont know how to. Thats the complicated PHP rohan is talking about, I think.
 
OP
Cyrus_the_virus

Cyrus_the_virus

Unmountable Boot Volume
If nothing helps, PHP can do it for sure, though it a bit more complicated.
EDIT: I just realized that it would be more easier than anything with PHP! :)

I don't mind if it's php because, then i can just wrap the html inside the php, so as long as someone can tell me how to do it, it doesn't matter if it's php or html.

One thing that i was thinking of was to use mod_rewrite to mask the urls of all the pages to a single url, hence the end user wouldn't know the link for direct access to pages. eg: mask page1, page2, page3 url to *abc.com/abc.php. Now the user can't tell what is the link to page2 or page3.

The only problem is I do not know how to use mod_rewrite!! :p

You can do something using referrer links, although I dont know how to. Thats the complicated PHP rohan is talking about, I think.

It does not matter how complicated it is as long as someone can give me the entire script!! :D
 

victor_rambo

हॉर्न ओके प्लीज़
Just insert this snippet at the start of every page
The expected referer is the referer you want
Eg: in page2.php, expected is '*domain/page1.php', similarly for page 3
PHP:
if($_SERVER['HTTP_REFERER']!='expected referer')
{
header('Location: 404.php');//redirect to file not found error document
exit;
}

And yeah, the 404.php should contain the snippet
PHP:
<?php
header("HTTP/1.0 404 Not Found");
?>
 
Status
Not open for further replies.
Top Bottom