Page 1 of 1
Referrer?
#1
Posted 01 August 2009 - 03:07 PM
Hi guys, I am working on a little system for personal use.
I have a "Delete Entry" feature, and when the user select to delete an entry, it takes them to a confirm page (confirmDeleteEntry.php) before that is posted to (deleteEntry.php).
My problem is, I would like to make sure that if someone ends up on deleteEntry.php, they came from confirmDeleteEntry.php.
Is there anyway to check this?
I have a "Delete Entry" feature, and when the user select to delete an entry, it takes them to a confirm page (confirmDeleteEntry.php) before that is posted to (deleteEntry.php).
My problem is, I would like to make sure that if someone ends up on deleteEntry.php, they came from confirmDeleteEntry.php.
Is there anyway to check this?
#2
Posted 01 August 2009 - 03:43 PM
I think your looking to use the isset function in php?
the button on your confirmDeleteEntry.php, lets say its called submitted.
simple if statement is all you need my dear friend
This cold will excute what you want only if the page is accessed via a button click on a form otherwise it wont work. There is most probably another way to do it as well, but this is the way i use, but i suggest changing the name of your form button.
the button on your confirmDeleteEntry.php, lets say its called submitted.
<?php
if(isset($_POST['Submitted'])){
/*if the user comes to the page correctly execute this code*/
}else{
echo'you have come to this page incorrectly!';
/*any other code you wish to use*/
}
?>
simple if statement is all you need my dear friend
This cold will excute what you want only if the page is accessed via a button click on a form otherwise it wont work. There is most probably another way to do it as well, but this is the way i use, but i suggest changing the name of your form button.
#3
Posted 01 August 2009 - 03:59 PM
Lol didn't even think about that, I'm already running that check... gah I'm so stupid :[
Thanks irnerd :]
Thanks irnerd :]
#5
Posted 01 August 2009 - 10:06 PM
Checking for a form field(isset) won't stop somebody from manually submitting the form, from their own pc for example.
You can check the referrer via $_SERVER['HTTP_REFERER'] but this can easily be spoofed.
I presume the form is in a password protected page. Obviously that's your first step.
You could then use regenerate_session_id() once the user is logged in and also check the user agent. Both attempt to stop 'session fixation'.
You can check the referrer via $_SERVER['HTTP_REFERER'] but this can easily be spoofed.
I presume the form is in a password protected page. Obviously that's your first step.
You could then use regenerate_session_id() once the user is logged in and also check the user agent. Both attempt to stop 'session fixation'.
#6
Posted 01 August 2009 - 10:38 PM
ElanMan, on 01 August 2009 - 10:06 PM, said:
Checking for a form field(isset) won't stop somebody from manually submitting the form, from their own pc for example.
You can check the referrer via $_SERVER['HTTP_REFERER'] but this can easily be spoofed.
I presume the form is in a password protected page. Obviously that's your first step.
You could then use regenerate_session_id() once the user is logged in and also check the user agent. Both attempt to stop 'session fixation'.
You can check the referrer via $_SERVER['HTTP_REFERER'] but this can easily be spoofed.
I presume the form is in a password protected page. Obviously that's your first step.
You could then use regenerate_session_id() once the user is logged in and also check the user agent. Both attempt to stop 'session fixation'.
That is true, is there a more secure way of processing a page script?
Would it be best to mix a login session with this form button submitted check?
What your thoughts on it?
#9
Posted 03 August 2009 - 12:06 PM
I add an encrypted key to my form with a session var and check on process, stops all/any spam when combined with the other checks i perform!
Share this topic:
Page 1 of 1
Help




















