Also, if they want directly to the file instead of using the forum, then no POST/GET data will be sent (although it is possible to send faux POST/GET data).
Check this with
All great ways, but you could also use a PHP session if you want that extra bit of security, anyone can fake referrers or post data. Sessions let you keep variables specific to a user, stored in temporary files on the server and identified by session cookies that expire as soon as the browser closes.
PHP:
File:
<?php
session_start();
$_SESSION['IP']=$_SERVER['REMOTE_ADDR'];
?>
<html>
...
In Form:
<?php
session_start();
if ($_SESSION['IP']!=$_SERVER['REMOTE_ADDR'])
header('Location: http://www.yoursite.com/');
?>
<html>
...
I agree with twinkie, curl can easily trick your page to make it believe that the referrer is legitimate I suggest you put a captcha and store the password in as a session variable and you will be sure of your security.
but basically you use the header() function to redirect in php.