Web Design Forum: Referrer? - Web Design Forum

Jump to content

WDF
WDF Premium Memberships Reseller Hosting
Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Referrer? Rate Topic: -----

#1 User is offline   dt17 

  • Advanced Member
  • PipPipPip
  • View gallery
  • Group: Members
  • Posts: 450
  • Joined: 22-May 09
  • Reputation: 14
  • Gender:Male
  • Location:Scotland
  • Experience:Advanced
  • Area of Expertise:Web Developer

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?
0

#2 User is offline   irn3rd 

  • Expert
  • PipPipPipPip
  • View gallery
  • Group: Members
  • Posts: 512
  • Joined: 13-July 08
  • Reputation: 3
  • Gender:Male
  • Location:UK
  • Experience:Beginner
  • Area of Expertise:I'm Learning

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.

<?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.
0

#3 User is offline   dt17 

  • Advanced Member
  • PipPipPip
  • View gallery
  • Group: Members
  • Posts: 450
  • Joined: 22-May 09
  • Reputation: 14
  • Gender:Male
  • Location:Scotland
  • Experience:Advanced
  • Area of Expertise:Web Developer

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 :]
0

#4 User is offline   irn3rd 

  • Expert
  • PipPipPipPip
  • View gallery
  • Group: Members
  • Posts: 512
  • Joined: 13-July 08
  • Reputation: 3
  • Gender:Male
  • Location:UK
  • Experience:Beginner
  • Area of Expertise:I'm Learning

Posted 01 August 2009 - 04:44 PM

View Postdt17, on 01 August 2009 - 03:59 PM, said:

Lol didn't even think about that, I'm already running that check... gah I'm so stupid :[

Thanks irnerd :]

:)

It's okay, happy to help :)
0

#5 User is offline   ElanMan 

  • In, out, shake it all about...
  • PipPipPipPipPip
  • View gallery
  • Group: Members
  • Posts: 3,298
  • Joined: 11-March 08
  • Reputation: 54
  • Gender:Male
  • Location:Darlington
  • Experience:Nothing
  • Area of Expertise:Nothing

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'.

0

#6 User is offline   irn3rd 

  • Expert
  • PipPipPipPip
  • View gallery
  • Group: Members
  • Posts: 512
  • Joined: 13-July 08
  • Reputation: 3
  • Gender:Male
  • Location:UK
  • Experience:Beginner
  • Area of Expertise:I'm Learning

Posted 01 August 2009 - 10:38 PM

View PostElanMan, 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'.

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?
0

#7 User is offline   ElanMan 

  • In, out, shake it all about...
  • PipPipPipPipPip
  • View gallery
  • Group: Members
  • Posts: 3,298
  • Joined: 11-March 08
  • Reputation: 54
  • Gender:Male
  • Location:Darlington
  • Experience:Nothing
  • Area of Expertise:Nothing

Posted 01 August 2009 - 11:03 PM

There's an old but still very useful guide here.
Definitely worth a read.
0

#8 User is offline   irn3rd 

  • Expert
  • PipPipPipPip
  • View gallery
  • Group: Members
  • Posts: 512
  • Joined: 13-July 08
  • Reputation: 3
  • Gender:Male
  • Location:UK
  • Experience:Beginner
  • Area of Expertise:I'm Learning

Posted 01 August 2009 - 11:29 PM

Thanks for the read, ill have a read :)
0

#9 User is offline   skidz 

  • Web Guru
  • PipPipPipPipPip
  • Group: Members
  • Posts: 1,047
  • Joined: 24-November 08
  • Reputation: 135
  • Gender:Male
  • Location:Derby
  • Experience:Advanced
  • Area of Expertise:Web Developer

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!
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users