Solved

Changing Password in Internet server

Posted on 1998-10-10
11
168 Views
Last Modified: 2011-04-14
I have an internet account in which i have been allotted a
User id and a password.To change the pass word i have to go to the ISP's web site ,type my user Id and old password and
new password which is very tedious and a waste of connection time.
I have already written an application in Delphi 3 which makes use of a  RAS  component to connect to the internet account automatically.
Now i want to write a procedure which will change the password through the above application after i  feed all the data like user id,old password ,new password off line.Then when i connect to the net and  click a button the password maintained in the server should  change by sending the necessary data.
Can any one tell me the code in delphi 3 for this(only for changing the password in the server)
regards
venks
0
Comment
Question by:venks
  • 6
  • 3
  • 2
11 Comments
 
LVL 1

Author Comment

by:venks
ID: 1342443
Edited text of question
0
 
LVL 8

Expert Comment

by:ZifNab
ID: 1342444
Hi venks,

have you already looked for code at http://www.rtfm.be/fpiette/indexuk.htm?

Zif.
0
 
LVL 1

Author Comment

by:venks
ID: 1342445
Dear Zifnab
I am not too familiar with internet protocols.Kindly guide me as to for which component should i look for?
regards
venks
0
 
LVL 8

Expert Comment

by:ZifNab
ID: 1342446
Hi,

I would suggest you to look at the FtpCli Demo.
There you can let the program automatically fill in the password and userid.

About changing it, I don't know, but I guess it should be the same.

I'll look closer to your problem in a few days... when rush is over here.

Regards, Zif.
0
 
LVL 1

Author Comment

by:venks
ID: 1342447
Dear Zifnab
Thanks I will try it out and let you know
regards
venks
0
What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
LVL 1

Expert Comment

by:zac
ID: 1342448
Just a quick note, if the user ID & password changing is implemented as a form then what you will need to do is either use a HTTP component or a SOCKET component (harder) (from fpiette above) to "FAKE" a form submission using the method in  the <form method="GET OR POST"> attribute of the HTML which will be either get or post.  If it is GET then things are simple, you just have to encode the form fields on the url ie

changepass.cgi?username=<username>&oldpass=<oldpassword> etc...

Obviously the names of the parameters are those taken from the HTML form.

If the method is post (more likely) then things are somewhat more tricky, you will have to look into the HTTP/1.0 (or 1.1) RFC as to how this is implemented (I can't remember.....)

Note, it may be possible to use the get method even if post is specified in the html form......

If you need some further info, let me know....

I hope this helps, it works with my ISP....

Cheers,

Zac
0
 
LVL 1

Author Comment

by:venks
ID: 1342449
Dear Zac
You have to be little more specific.Rather i would like to have the delphi code for it
Regards
venks
0
 
LVL 1

Accepted Solution

by:
zac earned 50 total points
ID: 1342450
Venks,

I cannot give you a full answer because that depends on your isp and the way their HTML form is set up, but I will give you some sample code for D4.

Firstly lets assume that the form on you ISP is something like this:

<form method=post action=changepass.cgi>
User Name<input type="text" name="username">
Old Password<input type="text" name="oPass">
New Password<input type="text" name="nPass1">
New Password (again)<input type="text" name="nPass2">
</form>

<DELPHI 4 PRO>
Drop a TNMHTTP component on your form, then have a couple of lines like this (presumably on an onconnect handler)

procedure TForm1.Button1Click(Sender: TObject);
var
  PostData : String;
begin
  // Set up the post data as it is in the HTML form
  PostData := 'username=' + EditName.Value + '&oPass=' + EditOldPass.Value;
  PostData := PostData + '&nPass1=' + EditnPass.Value;
  PostData := PostData + '&nPass2=' + EditnPass2.Value;
  NMHTTP1.OutputFileMode := FALSE;
  NMHTTP1.Post('http://www.yourisp.com/location_of_form', PostData);
end;

Obviously the url above is the full URL of your ISP change password script.

I have assumed that your ISP uses post as the form method, however if they use GET the code would look like this:


procedure TForm1.Button1Click(Sender: TObject);
var
  PostData : String;
begin
  // Set up the post data as it is in the HTML form
  PostData := 'username=' + EditName.Value + '&oPass=' + EditOldPass.Value;
  PostData := PostData + '&nPass1=' + EditnPass.Value;
  PostData := PostData + '&nPass2=' + EditnPass2.Value;
  NMHTTP1.OutputFileMode := FALSE;
  NMHTTP1.GET('http://www.yourisp.com/location_of_form?' + PostData);
end;

Note the change of NMHTTP1.Post to GET and the subtle change of the numbers of parameters.

You can then hook the OnSucess event so that you know when you have sucessfully changed your password.  (Set Handled to false to raise an exception if an error occurs).

I hope this helps more than the last effort.

Good luck

Zac


0
 
LVL 1

Author Comment

by:venks
ID: 1342451
Dear Zac
I do not have delphi 4.
But i used another HTTP component did a 'Get 'and got the following code from the server.I will be glad if you could convert this to delphi code (I have delphi 3 c/s)
<html>
<title>Change Your Password</title>
<body background="inmtextb.gif">

<h1 align=center>Change Your Password</h1>
<center>
<strong>What can I do with this form?</strong><br>

You can use this form to change your GIAS access password .  
You will need to select your hostname, enter your username,
old (current) password and desired password (twice).

<hr size=2>
<form method="POST" action="/cgi-bin/password/clus.cgi">
<strong>Hostname</strong><br>

<select name="host" size=1>
<option value="">Choose Your Server Here
<option value="giasbm01">giasbm01.vsnl.net.in
<option value="bom2">bom2.vsnl.net.in
<option value="bom3">bom3.vsnl.net.in
<option value="bom4">bom4.vsnl.net.in
<option value="bom5">bom5.vsnl.net.in
<option value="bom6">bom6.vsnl.net.in
<option value="ad1">ad1.vsnl.net.in
<option value="giaspn01">giaspn01.vsnl.net.in
</select><hr>

<strong>Username</strong><br>
<!..Enter your user name below  (<varyogesh</var).>
<pre>Enter Username (like <var>yogesh</var>):  <INPUT type=text name=username value="" size=40></pre>

<hr>

<strong>Old password</strong><br>
<samp> needed for verification</samp>

<pre>Enter Current Password:         <input type=password name=password size=25 value=""></pre>

<hr>

<strong>New password</strong><br>

<samp>Be sure there are no spelling mistakes and
                  it is 6 to 10 characters long.</samp>
<pre>New password:         <input type=password name=pass size=25 value="">
New password (again): <input type=password name=pass1 size=25 value=""></pre>

<hr>
<input type=submit value="Change my password">
<input type=reset value="Restore defaults">
</center>
<hr size=3>
</form>

</body>
</html>


Frankly you have given me a good lead and i should be awarding the points to you for the troubule you have taken.But just to make my job easy (I do not know HTML) i am asking for this favor.
The points will be awarded to you even if you are not able to help me out.But let me know waht you intend doing.
regards
venks

0
 
LVL 1

Expert Comment

by:zac
ID: 1342452
Venks,

Please remeber that I am "flying blind" now, so I am making assumptions about your HTTP component.

I am assuming that your component supports the POST method (you can see the post method in the html form item - probably best to stick to it rather than use get).

The post method will probably take two parameters a url and a list of name value pairs ie

procedure POST(sUrl, Var : String);

or something similar

I also assume that the server upon which the above file was located is called www.myisp.com (why not?)

NOTE: you may have to encode (MIME) your parameter string if you are using not standard 7 bit ASCII chars.

Anyway on to the code with brief descriptions of how it compares to the HTML (blind knowledge is useless)...

What we are going to do is perform a POST to www.myisp.com/cgi-bin/password/clus.cgi with the relevant variables in this case:

host=giasbm01 // This value represents: giasbm01.vsnl.net.in

The value can be found by looking at the HTML ie ad1 = ad1.vsnl.net.in

password='test' // Your old password
pass='newpass'  // New password 1st time
pass1='newpass' // Ditto second time

Hence you can make a string of your POST variables thus (note I have used hard coded values):
//Note & is the thingy that means another item follows
// Assume postvars declared as string...
PostVars := 'host=giasbm01&password=test&pass=newpass&pass1=newpass';
MyHTTPComponent.Post('http://www.myisp.com/cgi-bin/password/clus.cgi', PostVars)


I hope this provides a solution & perhaps gives you a quick primer on HTML forms....

If you have any further questions let me know....

Laters,

Zac
0
 
LVL 1

Author Comment

by:venks
ID: 1342453
Dear Zac
Thanks.I will try out your advice.I am awarding you the points.
If i have any problems i will come back.
Regards
venks
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Suggested Solutions

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
This video discusses moving either the default database or any database to a new volume.
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

705 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now