943,101 Members | Top Members by Rank

Ad:
  • PHP Discussion Thread
  • Unsolved
  • Views: 1100
  • PHP RSS
You are currently viewing page 1 of this multi-page discussion thread
Jan 29th, 2010
0

invisible file name in action attribute of a form

Expand Post »
Hi,

Can we make secret.php bit invisible in action attribute of a form? I don't want users seing my post pages.

PHP Syntax (Toggle Plain Text)
  1. <form name='form1' method='post' action='secret.php'>

Thanks
Reputation Points: 38
Solved Threads: 0
Master Poster
veledrom is offline Offline
724 posts
since Apr 2008
Jan 29th, 2010
0
Re: invisible file name in action attribute of a form
How about posting the form values to mask1.php page and including a redirect header with required values to your secret.php page and again redirecting it to final.php page with the computed values. This is a quick thought from my side, let me know if it works. I m sure there is better sol fr this prob.
Last edited by Kavitha Butchi; Jan 29th, 2010 at 8:54 am.
Reputation Points: 10
Solved Threads: 4
Junior Poster in Training
Kavitha Butchi is offline Offline
69 posts
since May 2008
Jan 29th, 2010
0
Re: invisible file name in action attribute of a form
There shouldn't be an issue with this as long as you lock down the code with form validation. All the data should be checked for datatype and sanitized. You could create a hashed verification code with the form to ensure that it was sent from that page (not spoofed), although this can be circumvented. Making multiple redirects sounds a bit extreme.
Sponsor
Featured Poster
Reputation Points: 1036
Solved Threads: 935
Sarcastic Poster
ardav is offline Offline
6,620 posts
since Oct 2006
Jan 29th, 2010
0
Re: invisible file name in action attribute of a form
php forms
self posting, the user sees very little not even a filename, everything is on the server
php Syntax (Toggle Plain Text)
  1. <?php // form processing verification
  2. if isset($_post['bla bla bla']) { /*mysql bla bla bla etc */ }
  3. ?>
  4. <html><head></head><body><form method='post' name='form1'>
the default action for a form is to post to itself
Last edited by almostbob; Jan 29th, 2010 at 10:43 am.
Reputation Points: 561
Solved Threads: 365
Posting Maven
almostbob is offline Offline
2,964 posts
since Jan 2009
Jan 29th, 2010
0
Re: invisible file name in action attribute of a form
you mean u dont want user see where the form redirected when the user view its source code?

PHP Syntax (Toggle Plain Text)
  1. <?php
  2.  
  3. if(isset($_POST['btnsubmit'])){
  4. echo "<script>window.location='secret.php';</script>";
  5. }
  6.  
  7. ?>
  8. <form name='form1' method='post'>
  9. <input type='submit' name='btnsubmit' value='go' />
  10. </form>

tried and tested....this should hide the action attribute of the form... but it still show in the url. if you want to change the url. then you have to use .htaccess. after all you only want the action attribute to be invisible... so i just give u what u ask.
Reputation Points: 32
Solved Threads: 58
Posting Pro in Training
vaultdweller123 is online now Online
470 posts
since Sep 2009
Jan 29th, 2010
0
Re: invisible file name in action attribute of a form
@AB - thanks - straightforward - cutting through the nonsense as usual. How about validation? Will lacking an action attribute cause failure?

As for js redirects: will not the client pick up the redirect as it is client-based (js), i.e. redirect after page has loaded. Whereas (*I think*) the php header() will redirect before page load on client and therefore hide its tracks. Thought WCAG had suggested that all redirects should be server-side. Maybe wrong here.

What about page refresh? Won't sending the form to itself resend the form on refresh?

Is all this 'hiding' necessary in the first place? $_SERVER['HTTP_REFERER'] could check the 'sender' and if it is not the form sending page - alert, alert, alert. I know it can't be trusted 100%.

$_SESSION variables could be used to store a string (e.g. salt + unixdatetime + another salt) which could be checked against a hidden field (hashed) in the form.

The receiving form handler page then checks the session variable for a value and then hashes it and then compares it to the hidden form field. If 'true' then form "must" have come from the true form page. Where 'false' bounce user back to form page with a message.
Last edited by ardav; Jan 29th, 2010 at 11:38 am.
Sponsor
Featured Poster
Reputation Points: 1036
Solved Threads: 935
Sarcastic Poster
ardav is offline Offline
6,620 posts
since Oct 2006
Jan 29th, 2010
0
Re: invisible file name in action attribute of a form
ei by the way im not copying AB's post. Actually when i read this post, i only see kivata and ardav post. And im pretty slow coz. i test it 1st and run on my localhost before i submit my solutions. Upon submitting i was surprise AB's post 1st on my post.
Reputation Points: 32
Solved Threads: 58
Posting Pro in Training
vaultdweller123 is online now Online
470 posts
since Sep 2009
Jan 29th, 2010
0
Re: invisible file name in action attribute of a form
ei by the way im not copying AB's post. Actually when i read this post, i only see kivata and ardav post. And im pretty slow coz. i test it 1st and run on my localhost before i submit my solutions. Upon submitting i was surprise AB's post 1st on my post.
Yeah, yeah. I always use that excuse too!
Sponsor
Featured Poster
Reputation Points: 1036
Solved Threads: 935
Sarcastic Poster
ardav is offline Offline
6,620 posts
since Oct 2006
Jan 29th, 2010
0
Re: invisible file name in action attribute of a form
Click to Expand / Collapse  Quote originally posted by ardav ...
Yeah, yeah. I always use that excuse too!
waaaaaaaaaaaaaaaaa! seriously dude! i didn't mean it!
Reputation Points: 32
Solved Threads: 58
Posting Pro in Training
vaultdweller123 is online now Online
470 posts
since Sep 2009
Jan 29th, 2010
0
Re: invisible file name in action attribute of a form
Click to Expand / Collapse  Quote originally posted by ardav ...
@AB - thanks - straightforward - cutting through the nonsense as usual. How about validation? Will lacking an action attribute cause failure?
no the default action is valid to xhtml and html5, it is only necessary to supply an action if the form is NOT posting to itself
Quote ...

As for js redirects: will not the client pick up the redirect as it is client-based (js), i.e. redirect after page has loaded. Whereas (*I think*) the php header() will redirect before page load on client and therefore hide its tracks. Thought WCAG had suggested that all redirects should be server-side. Maybe wrong here.
quite correct, the php given should have used a header redirect
Quote ...

What about page refresh? Won't sending the form to itself resend the form on refresh?
no 'post' destroys the data
Quote ...
Is all this 'hiding' necessary in the first place? $_SERVER['HTTP_REFERER'] could check the 'sender' and if it is not the form sending page - alert, alert, alert. I know it can't be trusted 100%.

$_SESSION variables could be used to store a string (e.g. salt + unixdatetime + another salt) which could be checked against a hidden field (hashed) in the form.

The receiving form handler page then checks the session variable for a value and then hashes it and then compares it to the hidden form field. If 'true' then form "must" have come from the true form page. Where 'false' bounce user back to form page with a message.
didnt suggest the process was necessary, but the OP could be creating the login page for nuclear missile control sites....

Lgin: xxJoshua,
'Hello Doctor, Do you want to play a game?'
Global Thermonuclear War

only they know how much security/obscurity they require
Last edited by almostbob; Jan 29th, 2010 at 12:16 pm.
Reputation Points: 561
Solved Threads: 365
Posting Maven
almostbob is offline Offline
2,964 posts
since Jan 2009

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in PHP Forum Timeline: Aaarrrggghhh - Desperate need of help.
Next Thread in PHP Forum Timeline: Best way to login, read public databases





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC