tags:

views:

92

answers:

2

hi all

in my project ,i am using my smf forum to control clients so i wanna create an application from which i can add member to my forum via my admin panel, in general i can do this by doing 1.login to my site ( with my admin user and pass)

2.then navigate to the url http://www.mysite.com/index.php?action=admin

3.then navigate to url http://www.mysite.com/index.php?action=regcenter

4.Fill data and click register button.

here is screen shot of adding new memeber for easy understand

http://i32.tinypic.com/wv3774.jpg

ok i started coding and i successful in doing first 3 steps ,but i am failing at 4th step

This is what i did i used live http header in firefox to grab what data it posting when registration button clicked manually i found data

user=dssa&email=asdsa%40ss.com&password=sadddsa&group=12&emailPassword=on&regSubmit=Register&sa=register&sc=c5efce4e867a83fa6915026342e4aa20

after that i seen page source to see what method its using in formaction its post method

> <form
> action="http://www.myaction.com/index.php?action=regcenter"
> method="post"
> accept-charset="ISO-8859-1"
> name="postForm" id="postForm">

and here is my code for doing this

 begin
    done first 3 step;
    str:=TStringList.Create;
   str.Add('user='+bsskinedit1.text);
   str.Add('email='+bsskinedit1.Text+'@ss.com');
   str.Add('password='+bsskinedit2.Text);
   str.Add('group='+group);
   str.Add('emailPassword=on');
   str.Add('regSubmit=Register');
   str.Add('sa=register');
   str.Add('sc=c5efce4e867a83fa6915026342e4aa20');
   s3:=IdHTTP1.Post('http://www.mysite.com/index.php?action=regcenter',str);
   end;

but its not adding new member :(

anyhelp appreciated

thanks in advance regards

A: 

You could use a TWebBrowser component to achieve this. Delphidabbler has some nice tutorials about manipulating the DOM, executing javascript functions, filling text fields.

Also here and here you will find more info.

Chris
+1  A: 

I would assume that sc should contain a dynamic cookie value that gets set after login. So you shouldn't hard-code it to c5efce4e867a83fa6915026342e4aa20 but instead read out the value your web-server sets it to after you login as admin and then use this value on all subsequent requests. If sc isn't the cookie, you could try to read the actual cookie value using TidCookieManager

Ben Schwehn
thanks for reply sir ,could u please tell me how to read that cookie ? :S
steve0
i found solution sir ,thanks for giving hint ,sc=session check :)problem solved :D
steve0