Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Complete a URL from form field input!

Status
Not open for further replies.

marko2002

Technical User
Dec 16, 2003
61
GB
Guys,

Anyone possibly know to to add text to a URL from a form field?. I've set up an internal web site where users could optionally type something such as and they would then have access to their home folder via a web page after authentication. Ideally, what I'm trying to do is have the user enter their username in a form field on the index page and on Submit this would then take them to
Any help is, as always, greatly appreciated.

Marko
 
Just had another though actually - would it even be possible to have the user enter their username and password into the index page and on submit would both authenticate them as well as redirect them to the page.

Cheers again
Marko
 
You mean like

Code:
<script>
function login(){
window.location="[URL unfurl="true"]http://mydomain.com/"[/URL] + users.aname.value + users.apassword.value;
}
</script>


<form id="users"><pre>
 Name:     <input type="text" id="aname" />
 Password: <input type="text" id="apassword" />
 <input type="button" id="name" value="Log In" onclick="login();" /></pre>
</form>
 
Fendal,

This is great m8 - thanks so much for this, though I'm not sure about the authentication to the server - regardless, the URL works great.

Many thanks again
Marko
 
If your server uses php or asp you could get the password by calling querystring (in asp).

Code:
<script>
function _Submit(){
if(users.apassword.value=="" || users.aname.value==""){
alert("Enter Value");
return false;
}
window.location="[URL unfurl="true"]http://127.0.0.1/?name="+escape(users.aname.value)[/URL] + "&pass=" + escape(users.apassword.value);
}
</script>

<form id="users"><pre>
 Name:     <input type="text" id="aname" />
 Password: <input type="text" id="apassword" />
 <input type="button" id="sendit" value="Log In" onclick="_Submit();" /></pre>
</form>


this would give you two querystrings one called "name" and the other called "pass".
 
Fendal, thanx again for this - not had a chance to try it out but definately will - I'm not heavy into coding/scripting and so cannot quite fully understand much of the above scripts, though will this script 'authenticate' against the PDC and send the user to the required URL (i.e. I've tested the URL part which is great, not the 'authentication' part.

Thanx again
Marko
 
By PDC I assume you are talking about "Primary Domain Controller" ?, this script won't do that, it's just creating a basic query string to be used with ASP/PHP, I don't know much about PDC, sorry.
 
Fendal, sorry for not replying sooner - yes, I was referring to Primary Domain Controller, though the script does a great job for what I had initially requested and so thanx once again for this.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top