Hi Bob,
I think I saw this mentioned as a possible solution. Pass a variable and
test for the content of that that variable in the page passed to. I think It
called for a hidden form field.
A more secure version would be to use this same technique using session
variables instead of hidden form fields. This way you could:
<? //form page
session_start();
$_SESSION['special_var'] = "island in the sun";
?>
<? //form page posted to
session_start();
if ( $_SESSION['special_var'] = "island in the sun") {
// do stuff
} else {
// destroy the session.
session_destroy();
// Redirect browser
header("Location: http://www.example.com/");
exit;
?>
It is much simpler than writing files and clearing them. Sessions are self
cleaning and can be cleared upon form posting successfully. Sessions would
keep your test var somewhat hidden, more so than just a hidden form field.
Mike
--
Mike Brandonisio * Web Hosting
Tech One Illustration * Database Applications
tel (630) 759-9283 * e-Commerce
[EMAIL PROTECTED] * http://www.jikometrix.net
JIKOmetrix - Reliable web hosting
on 3/22/05 1:00 PM, Bob at [EMAIL PROTECTED] scribbled:
>
> Hi Patrick,
> Some great tips. I'll definitely use them.
> Thanks a bunch, Bob.
>
>
> ----- Original Message -----
> From: "Patrick Bierans" <[EMAIL PROTECTED]>
>>> $dir = $_SERVER['DOCUMENT_ROOT']."/tmp";
>>
>> Make sure that you do not delete temporary files from other scripts. I would
>> suggest a seperate folder for all "referer-semaphore-files":
>>
>> $dir=$_SERVER['DOCUMENT_ROOT']."/tmp/referers/";
>>
>> Another tip: If you write the ending "/" to $dir you can skip it later at
>> filemtime($dir.$fname) and unlink($dir.$fname).
>>
>> And make sure that the filenames also have a defined length and
>> file-extension: /^[a-zA-Z0-9]{32}\.semaphore$/ so you do not delete foreign
>> files.
>
>
>
> Community email addresses:
> Post message: [email protected]
> Subscribe: [EMAIL PROTECTED]
> Unsubscribe: [EMAIL PROTECTED]
> List owner: [EMAIL PROTECTED]
>
> Shortcut URL to this page:
> http://groups.yahoo.com/group/php-list
> Yahoo! Groups Links
>
>
>
>
>
>
>
>
>
Community email addresses:
Post message: [email protected]
Subscribe: [EMAIL PROTECTED]
Unsubscribe: [EMAIL PROTECTED]
List owner: [EMAIL PROTECTED]
Shortcut URL to this page:
http://groups.yahoo.com/group/php-list
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/php-list/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/