Solved

Only send certain fields

Posted on 2003-11-21
8
221 Views
Last Modified: 2010-04-09
Is there anyway I can choose which fields i want sent in a posted form?
I currently have the fields user and pass and enc in a login form.
Enc is an encryption of pass.
I only want to send user and enc.

I have thought about just encrypting pass into the pass field when the user attempts to login, but i don't want to do it this way.

Is there any other option i can try?
0
Comment
Question by:enasni_mark
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
8 Comments
 
LVL 8

Expert Comment

by:Barry62
ID: 9800093
Here you go!

<html>
<head>
<title></title>
<script type="text/javascript">
function encryptit(){
  /*encryption
     code
     goes
     here
  */
  testform2.enc2.value = //encrypted password
  testform2.user2.value = testform.user.value;
  testform2.submit();
}
</script>
</head>
<body>
<form name="testform" onSubmit="encryptit();">
Username: <input type="text" name="user"><br>
Password: <input type="password"><br>
<div align="center"><input type="submit">
</form>

<form name="testform2" action="somepage" method="post">
 <input type="hidden" name="enc2">
<input type="hidden" name="user2">
</form>
0
 

Expert Comment

by:TigerBoy
ID: 9800100
You could always add a onSubmit event that will remove the pass field from your form before sending it.

onSubmit="mForm.pass.value = ''; return true;"

0
 
LVL 16

Expert Comment

by:jaysolomon
ID: 9800195
how are you encrypting your code?
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 8

Expert Comment

by:Barry62
ID: 9800386
he's not encrypting his code, just the password that the user enters. :)
0
 
LVL 58

Expert Comment

by:Gary
ID: 9800928
<script language=javascript>
function submitform(){
document.myform2.user.value=document.myform1.user.value
document.myform2.enc.value=document.myform1.enc.value
myform2.submit()
}
</script>

<form name=myform1>
<input type=text name=user>
<input type=text name=pass>
<input type=text name=enc>
<input type=button onclick=submitform()>
</form>
<form name=myform2 action=page2.asp>
<input type=hidden name=user>
<input type=hidden name=enc>
<input type=button onclick=submitform()>
</form>
0
 
LVL 11

Expert Comment

by:Zontar
ID: 9801258
Depending on JS to do encryption is not a very good idea IMO.

If you need that much security, consider using SSL.

Otherwise, many serverside programming languages and databases provide ways to encrypt/decrypt passwords.

E.g. in PHP/MySQL:

$user = $_POST["username"];
$pass = $_POST["password"];

$q = "SELECT userid FROM users WHERE username='$user' AND password=MD5('$pass')";
if(mysql_num_rows( mysql_query($q) ) == 1)
  $login_status = TRUE;
0
 
LVL 31

Accepted Solution

by:
GwynforWeb earned 125 total points
ID: 9801483
Disable the fields before submission. I have demonstrated for 'get' but it works for post as well. (google is great for seeing what gets sent)

<form onSubmit="t3.disabled=true;t4.disabled=true; return true" action="http://google.com">
<input type="text" name="t1" >
<input type="text" name="t2">
<input type="text" name="t3">
<input type="text" name="t4">
<input type="submit"" value="submit">
<form>
0
 
LVL 31

Expert Comment

by:GwynforWeb
ID: 9806687
Thanks, :-)
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Use these top 10 tips to master the art of email signature design. Create an email signature design that will easily wow recipients, promote your brand and highlight your professionalism.
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
In this tutorial viewers will learn how to style elements, such a divs, with a "drop shadow" effect using the CSS box-shadow property Start with a normal styled element, such as a div.: In the element's style, type the box shadow property: "box-shad…
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question