Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Post New Thread Reply

Register GFY Rules Calendar
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed.

 
Thread Tools
Old 05-25-2004, 02:53 AM   #1
bawdy
Confirmed User
 
Join Date: Feb 2002
Posts: 1,424
php & form submission control

how can i make it so that a form will only be accepted if its been submitted from the domain that it is hosted on?

could check refering url etc but was wondering if someone knows a more secure way
bawdy is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 05-25-2004, 02:57 AM   #2
Lycanthrope
Confirmed User
 
Lycanthrope's Avatar
 
Industry Role:
Join Date: Jan 2004
Location: Wisconsin
Posts: 4,517
I've used this for forms:

http://www.scriptarchive.com/formmail.html
__________________
Lycanthrope is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 05-25-2004, 03:02 AM   #3
bawdy
Confirmed User
 
Join Date: Feb 2002
Posts: 1,424
Quote:
Originally posted by Lycanthrope
I've used this for forms:

http://www.scriptarchive.com/formmail.html
thanks im no perl wiz but looks like it checks referer strings to see if its submitted from an accepted domain
bawdy is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 05-25-2004, 03:04 AM   #4
init
Confirmed User
 
Join Date: Oct 2002
Location: Sarasota, FL
Posts: 973
i believe reffer is the only other way other then htaccess
__________________
icq: 2721653
init is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 05-25-2004, 03:32 AM   #5
raymor
Confirmed User
 
Join Date: Oct 2002
Posts: 3,745
Well you could always have them type in the word.




That's one of the things I just added to Strongbox.
Were you using CGI instead of damn PHP you could use
my library, which would plug right into your script.
Matter of fact, now that I've been the one to actually
give a decent answer to your question I guess I can go ahead and say:
You're concerned about securing it and you're writing it in PHP?!?!?!? ROTFL!
FOOMCLMDFHO!
(Falling Out Of My Chair Laughing My Damn Fool Head Off).
__________________
For historical display only. This information is not current:
support@bettercgi.com ICQ 7208627
Strongbox - The next generation in site security
Throttlebox - The next generation in bandwidth control
Clonebox - Backup and disaster recovery on steroids
raymor is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 05-25-2004, 03:50 AM   #6
boyw_utr
Confirmed User
 
Join Date: Oct 2003
Location: The Netherlands
Posts: 310
Quote:
Originally posted by bawdy
how can i make it so that a form will only be accepted if its been submitted from the domain that it is hosted on?

could check refering url etc but was wondering if someone knows a more secure way

You can only use the referring check like this:

Check the refer var stored in:
$HTTP_SERVER_VARS['HTTP_REFERER'];

$findme = 'www.domain.com';


$pos1 = stripos($HTTP_SERVER_VARS['HTTP_REFERER'], $findme);

// Nope,
if ($pos1 hahahaha= false) {
echo "The string '$findme' was not found in the string '$HTTP_SERVER_VARS['HTTP_REFERER']'";
}
// Yes it there
Else{
echo "We found '$findme' in '$HTTP_SERVER_VARS['HTTP_REFERER']'";
}

replace the echo's after testing by or a new header or the add to db routine...


Good Luck

__________________
SIG TOO BIG! Maximum 120x60 button and no more than 3 text lines of DEFAULT SIZE and COLOR. Unless your sig is for a GFY top banner sponsor, then you may use a 624x80 instead of a 120x60.
boyw_utr is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 05-25-2004, 04:37 AM   #7
bawdy
Confirmed User
 
Join Date: Feb 2002
Posts: 1,424
thanks guys... my main concern with using the refer method is that it is not always passed and can be forged pretty easily
bawdy is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 05-25-2004, 04:48 AM   #8
disregard
Confirmed User
 
Join Date: May 2004
Posts: 118
Here's an algorythm:

When displaying the form:

1. Generate a unique number and store it in a database table with a timestamp.

2. Delete all unique numbers older than 2 hours.

3. Hide the new unique number in the form.

When processing the form:

1. Check the unique number against the database. If it is not there, die();

2. Check the refferer. If it is incorrect, die();

3. Process the form.
disregard is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 05-25-2004, 04:52 AM   #9
boyw_utr
Confirmed User
 
Join Date: Oct 2003
Location: The Netherlands
Posts: 310
Quote:
Originally posted by disregard
Here's an algorythm:

When displaying the form:

1. Generate a unique number and store it in a database table with a timestamp.

2. Delete all unique numbers older than 2 hours.

3. Hide the new unique number in the form.

When processing the form:

1. Check the unique number against the database. If it is not there, die();

2. Check the refferer. If it is incorrect, die();

3. Process the form.
Hey this is also a sollution....
But it brings me a even greater and easier idea...

Just start a session in the form and check the sessions id in the submit routine... if not there send them to the form on the server with a header....

__________________
SIG TOO BIG! Maximum 120x60 button and no more than 3 text lines of DEFAULT SIZE and COLOR. Unless your sig is for a GFY top banner sponsor, then you may use a 624x80 instead of a 120x60.
boyw_utr is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 05-25-2004, 04:56 AM   #10
bawdy
Confirmed User
 
Join Date: Feb 2002
Posts: 1,424
Quote:
Originally posted by boyw_utr
Hey this is also a sollution....
But it brings me a even greater and easier idea...

Just start a session in the form and check the sessions id in the submit routine... if not there send them to the form on the server with a header....

yeah this is more like what i was thinking

essentially im thinking of issuing the form a one-time licence... each time the form is issued a new licence is generated.... maybe not tied to the session id as this could be easily obtained
bawdy is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 05-25-2004, 04:59 AM   #11
boyw_utr
Confirmed User
 
Join Date: Oct 2003
Location: The Netherlands
Posts: 310
Quote:
Originally posted by bawdy
yeah this is more like what i was thinking

essentially im thinking of issuing the form a one-time licence... each time the form is issued a new licence is generated.... maybe not tied to the session id as this could be easily obtained

What kind of license....

You could generate a unique number and store it like a session variable.. I don't think they can obtained that very easy....
__________________
SIG TOO BIG! Maximum 120x60 button and no more than 3 text lines of DEFAULT SIZE and COLOR. Unless your sig is for a GFY top banner sponsor, then you may use a 624x80 instead of a 120x60.
boyw_utr is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 05-25-2004, 05:04 AM   #12
kenny
Confirmed User
 
Industry Role:
Join Date: Mar 2002
Posts: 7,245
Cant you do like perl and just set the permissions?
kenny is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 05-25-2004, 05:05 AM   #13
bawdy
Confirmed User
 
Join Date: Feb 2002
Posts: 1,424
Quote:
Originally posted by boyw_utr
What kind of license....

You could generate a unique number and store it like a session variable.. I don't think they can obtained that very easy....
yeah the licence would be stored in a session var.

i was thinking of encoding something like the time and a key value... still havent thought this bit out fully... but the licence would be unique for the time that it was generated... the key would never be transmitted.... when the form is submitted decrypt the licence.... not sure if all this is redudant though
bawdy is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 05-25-2004, 05:08 AM   #14
bawdy
Confirmed User
 
Join Date: Feb 2002
Posts: 1,424
Quote:
Originally posted by kenny
Cant you do like perl and just set the permissions?
not sure i understand what you mean ??
bawdy is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 05-25-2004, 05:20 AM   #15
kenny
Confirmed User
 
Industry Role:
Join Date: Mar 2002
Posts: 7,245
Quote:
Originally posted by bawdy
not sure i understand what you mean ??
I am assuming you want to make your server so that it only accepts data submitted from your site.

For example you dont want somebody to copy the HTML of your form and modify it so they can exploit your script or what not.

I dont know exactly what you are doing but I prevent this simply by setting the permissions correctly for the script.


Prehaps I dont fully understand what you are trying to do..
kenny is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 05-25-2004, 05:21 AM   #16
grumpy
Too lazy to set a custom title
 
grumpy's Avatar
 
Join Date: Jan 2002
Location: Holland
Posts: 9,870
use session_id . Works better.
__________________
Don't let greediness blur your vision | You gotta let some shit slide
icq - 441-456-888
grumpy is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 05-25-2004, 05:27 AM   #17
bawdy
Confirmed User
 
Join Date: Feb 2002
Posts: 1,424
Quote:
Originally posted by kenny
I am assuming you want to make your server so that it only accepts data submitted from your site.

For example you dont want somebody to copy the HTML of your form and modify it so they can exploit your script or what not.

I dont know exactly what you are doing but I prevent this simply by setting the permissions correctly for the script.


Prehaps I dont fully understand what you are trying to do..
yeah that is what i want to achieve.... i will look into your suggestion more... thanks
bawdy is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 05-25-2004, 05:32 AM   #18
kenny
Confirmed User
 
Industry Role:
Join Date: Mar 2002
Posts: 7,245
Quote:
Originally posted by bawdy
yeah that is what i want to achieve.... i will look into your suggestion more... thanks
I never used PHP so it may differ.

http://www.perlfect.com/articles/chmod.shtml

Prehaps this can help you
kenny is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Post New Thread Reply
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >

Bookmarks



Advertising inquiries - marketing at gfy dot com

Contact Admin - Advertise - GFY Rules - Top

©2000-, AI Media Network Inc



Powered by vBulletin
Copyright © 2000- Jelsoft Enterprises Limited.