hi all, new here, please bear with me! I have an .asp page and I have this line of code which is used by an applet to access the ftp server: <param name = "url" value = " ftp://username:password@www.mydomain.com"> Code (markup): but i would like to have a form on the page where the the user could input the variables for the username and password and the then <param name> take them from what the user has inputted on the form. I need to do it this way for two reasons, firstly i have various users and secondly i do not want to leave usernames and passwords hardcoded into the page for anyone to look at the source. Can anyone help me out with this please? Thanks in advance for your time.
You can have one page asking for username and password: <form name="login_info" method="post" action="secondpage.asp" Username: <input type="text" name="username"><br> Password: <input type="text" name="password"><br> <input type="submit" value="Submit Username/Password"> Code (markup): Second page (asp): <% response.write "<param name = 'url' value = ' ftp://" & request.form("username") & ":" & request.form("password") & "@www.mydomain.com'>" %> Code (markup): the second page will write <param name = 'url' value = ' ftp://usernameassword@www.mydomain.com'> to the page where username and password are values from first page. Of course, instead of writing that to the page you can do something else with the data like access the database to check if it's valid.
Hi there, thank you for taking the time to reply and your suggestion. Would it be possible to have this on the same page rather than a 'previous' page? Would it work if I added the code you have given me to the current page without it having to then forward onto a next page ? Thanks again for your help.
try something like: <form name="login_info" method="post" action="mypage.asp"> Username: <input type="text" name="username"><br> Password: <input type="text" name="password"><br> <input type="submit" value="Submit Username/Password"> </form> <% If Request.Form("username") <> "" AND Request.Form("password") <> "" Then Response.Write "<param name = 'url' value = ' ftp://" & Request.Form("username") & ":" & Request.Form("password") & "@www.mydomain.com'>" End If %> Code (markup): where the name of the page is mypage.asp
or if you want it to hide the form after a user enters their info: <% If Request.Form("username") <> "" AND Request.Form("password") <> "" Then Response.Write "<param name = 'url' value = ' ftp://" & Request.Form("username") & ":" & Request.Form("password") & "@www.mydomain.com'>" Else %> <form name="login_info" method="post" action="mypage.asp"> Username: <input type="text" name="username"><br> Password: <input type="text" name="password"><br> <input type="submit" value="Submit Username/Password"> </form> <% End If %> Code (markup):