|
Posted by Toby Inkster on 09/26/05 00:32
tencip wrote:
> <form action="http://www.mysite.com/admin/index.php" method="post"
> name="login" id="login" >
> <input name="usrname" type="text">
> <input name="pass" type="password">
> <input name="domain" type="text">
> <input name="submit" type="submit" value="Login">
> </form>
>
> Now, the issue is, instead of the action I have now, I need the action
> to change based on what is typed by the user in the domain field.
Is method="post" set in stone?
If not, the easy solution is this:
<form action="somefile.php" method="get">
<input name="usrname">
<input name="pass" type="password">
<input name="domain">
<input type="submit" value="Login">
</form>
The form will *always* submit to "somefile.php", but then from
somefile.php we redirect to the correct location:
<?php
$url = sprintf("http://%s/admin/index.php?usrname=%s&pass=%s",
$_REQUEST['domain'], $_REQUEST['usrname'], $_REQUEST['pass']);
header("Location: $url");
?>
<title>Redirect</title>
<h1>Redirect</h1>
<p><a href="<?=$url?>"><?=$url?></a></p>
Of course, if you use GET rather than POST you have the problem of the
password being part of the URL, in plain sight.
--
Toby A Inkster BSc (Hons) ARCS
Contact Me ~ http://tobyinkster.co.uk/contact
[Back to original message]
|