iEntry 10th Anniversary Forum Rules Search
WebProWorld
Register FAQ Calendar Mark Forums Read
Web Programming Discussion Forum Working with an API? Developing a plugin? Writing a Mod or script for your favorite blog, Web 2.0 site or Forum? Welcome.

Share Thread: & Tags

Share Thread:

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 10-02-2003, 03:25 AM
wclew's Avatar
WebProWorld Member
 
Join Date: Aug 2003
Location: Iowa
Posts: 73
wclew RepRank 0
Default php form submission

I have an html form that is submitted to a php page. Along with the form variables I would like to post a couple of hidden variables, but I don't want these hidden variables to be seen by viewing the source of the page. One thought I had was to submit the form to the php page and have the hidden variables on the php page and then have it automatically submit itself with all the variables to another php page. I am very new to php, is this possible? Or I am open to any better suggestions.
Thanks in advance,
Dennis
Reply With Quote
  #2 (permalink)  
Old 10-02-2003, 07:47 AM
WebProWorld Member
 
Join Date: Aug 2003
Location: United Kingdom
Posts: 45
OSFan RepRank 0
Default

What would be in the hidden variables?

If they are static, i.e. always the same, why not just put them straight into the PHP script?
Reply With Quote
  #3 (permalink)  
Old 10-02-2003, 07:30 PM
wclew's Avatar
WebProWorld Member
 
Join Date: Aug 2003
Location: Iowa
Posts: 73
wclew RepRank 0
Default variables

The variables would contain credit card vendor information that must be submitted to their php page. That is why I would like our php page to automatically submit itself to the vendor's php page. Is this possible? Like in Javascript where you place a submit() funtion in the onload event handler for the page.
Thanks,
Dennis
Reply With Quote
  #4 (permalink)  
Old 10-03-2003, 07:15 PM
WebProWorld New Member
 
Join Date: Oct 2003
Location: Puerto Vallarta, Jalisco
Posts: 6
Shanti RepRank 0
Default Try this

I am a newbie to PHP, but i am quite familiar with Web programing (asp mainly) i had to do almost the same thing you are facing right now, i had 2 options to do this.

1 .- use the Hiden field to send the ID of the client so i could get the rest of the info from the database after i submit the form then send it to the vendor.

2 .- the other one was to send fake info onto those hiden fields and then reconbine them on the submit page (something like using TRIM and SPLIT on ASP)

lets say you have a credit card number you want to hide, well you could make this number from lets say 10 numbers and scramble it to like 100 or so but keeping the "right" numbers on strategic places so you then use split or trim or other commands that i am sure are available on PHP to remake this info, sounds complicated but its not.

i mean unless people know your "algo" they will have a very hard time figuring out what your real info is under those hiden numbers

personally i ended up using number 1 since the information was static, but the second option is better for information that is not as static.

gee i hope i explained myself and i hope i was of any help :)

sorry for my bad english ;)
Reply With Quote
  #5 (permalink)  
Old 10-04-2003, 07:21 AM
WebProWorld Member
 
Join Date: Aug 2003
Location: United Kingdom
Posts: 45
OSFan RepRank 0
Default

I think the question is that:

You have a form on your website for credit card info?
This form must be submit to the gateway company who will verify the payment?
You need to put certain info in the form about you, hidden, but you dont want it to be seen?

One way I can think around this is to submit to a local php page which contains the variables, then you'd have to manually open a socket connection to the other server, and manually form a HTTP Header and body for the POST request.

Is the stuff in the hidden fields so secret its worth the bother?
Reply With Quote
  #6 (permalink)  
Old 10-04-2003, 08:23 AM
redcircle's Avatar
WebProWorld Veteran
 
Join Date: Aug 2003
Location: Grand Rapids, MI USA
Posts: 425
redcircle RepRank 0
Default

session variables may be your solution.

www.php.net/session

this will allow you to save information on the server and be able to access the information from page to page without the user even knowing that it exists. The only thing that references it is a unique session id. What is in that session id is unknown.

If you need some more help let me know I can explain more but the php docs should be enough to give you an idea.
Reply With Quote
  #7 (permalink)  
Old 10-07-2003, 08:07 PM
wclew's Avatar
WebProWorld Member
 
Join Date: Aug 2003
Location: Iowa
Posts: 73
wclew RepRank 0
Default Exactly

Yes OSFan, you've got it right. That is exactly how I am proceeding with it, I was just hoping there was an easier way that I didn't know about. I don't know if it's actually worth the trouble either, but that's what the customer wants.
Thanks,
Dennis


Quote:
Originally Posted by OSFan
I think the question is that:

You have a form on your website for credit card info?
This form must be submit to the gateway company who will verify the payment?
You need to put certain info in the form about you, hidden, but you dont want it to be seen?

One way I can think around this is to submit to a local php page which contains the variables, then you'd have to manually open a socket connection to the other server, and manually form a HTTP Header and body for the POST request.

Is the stuff in the hidden fields so secret its worth the bother?
Reply With Quote
  #8 (permalink)  
Old 10-30-2003, 01:26 PM
WebProWorld Member
 
Join Date: Oct 2003
Location: St. Louis
Posts: 30
lutenegger RepRank 0
Default

I have never done this but it should be possible and relatively simple. You could use a dynamically generated javascript include. Which would "write" your hidden input statements to the page only if it was coming from the correct referring page. That way the info would never show up in the source, nor would someone be able to download it directly from the server.

That being said I would try to convince the client that this is pointless. I've developed a number of custom ecomm. solutions and the merchant info thats tranferred to a gateway is pretty much useless except for its intended purpose. Do they think it will be exploited in some way?
Reply With Quote
  #9 (permalink)  
Old 11-06-2003, 06:38 PM
wclew's Avatar
WebProWorld Member
 
Join Date: Aug 2003
Location: Iowa
Posts: 73
wclew RepRank 0
Default thanks

We eventually ended up using a different vender that the customers felt more comfortable with. I'm not sure why they were so concerned about that. Thanks.

Quote:
That being said I would try to convince the client that this is pointless. I've developed a number of custom ecomm. solutions and the merchant info thats tranferred to a gateway is pretty much useless except for its intended purpose. Do they think it will be exploited in some way?
Reply With Quote
  #10 (permalink)  
Old 11-07-2003, 10:00 PM
httpman's Avatar
WebProWorld Pro
 
Join Date: Aug 2003
Location: France
Posts: 124
httpman RepRank 0
Default

wclew

To keep as close as possible from your initial request, you could use an "autosubmit" feature in the second PHP page (the page that adds confidential information into hidden fields).
This is easily achieved via an "onload" parameter in the <body> tag of the page :

<body onload="self.document.formname.submit()">

where "formname" is the name of your form.
This will automatically submit the form after the page is fully loaded, means : after your PHP script have got the card number from the incoming form, and put it in the new form together with your confidential information.

JP
__________________
www.net-createurs.com [ french only website sorry ! ]
Reply With Quote
  #11 (permalink)  
Old 11-11-2003, 02:16 AM
wclew's Avatar
WebProWorld Member
 
Join Date: Aug 2003
Location: Iowa
Posts: 73
wclew RepRank 0
Default autosubmit

Thanks JP, that was one option I had considered. I had 2 problems though, I wasn't sure if php handled an onload event in the body tag and secondly the client was still unsure that the 2nd page couldn't be intercepted right before the triggering of the onload event. I didn't think that would be a problem but I couldn't convince them of that. I'm just glad we've moved on. ;) Take care.

Quote:
Originally Posted by httpman
wclew

To keep as close as possible from your initial request, you could use an "autosubmit" feature in the second PHP page (the page that adds confidential information into hidden fields).
This is easily achieved via an "onload" parameter in the <body> tag of the page :

<body onload="self.document.formname.submit()">

where "formname" is the name of your form.
This will automatically submit the form after the page is fully loaded, means : after your PHP script have got the card number from the incoming form, and put it in the new form together with your confidential information.

JP
Reply With Quote
  #12 (permalink)  
Old 11-12-2003, 02:40 AM
redcircle's Avatar
WebProWorld Veteran
 
Join Date: Aug 2003
Location: Grand Rapids, MI USA
Posts: 425
redcircle RepRank 0
Default

The onload event is Javascript not php.
Reply With Quote
  #13 (permalink)  
Old 11-12-2003, 05:11 PM
wclew's Avatar
WebProWorld Member
 
Join Date: Aug 2003
Location: Iowa
Posts: 73
wclew RepRank 0
Default onload

I didn't think php had an onload event, I thought tht was simply Javascript. Again, the client was not conivinced that the page could not be intercepted though.
Reply With Quote
Reply

  WebProWorld > Webmaster, IT and Security Discussion > Web Programming Discussion Forum

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -4. The time now is 02:35 AM.



Search Engine Optimization by vBSEO 3.3.0