Archive: Register Product


Register Product
I want to add register page to track the users that have installed the application. if they choose to skip the register, I would likt to hit a url to "log" the install. Does this exist, or should i start from scratch?


Not sure if you mean an HTTP GET or POST, but InetLoad can do either one.
http://nsis.sourceforge.net/wiki/InetLoad


not just the download...
I know its easy to hit a url. I am looking for a registartion form. A place for the user to enter name, address...


You need a php/cgi/asp type of page that can connect to a database and write in the data entered by your users? If so, you should probably look into a mysql/php solution and find a relevant forum to get help with on that.


Either that, or create the form in NSIS using a custom page and then use inetload to pass the info back to the web server. (But you'd still need the code on the web server to process the request.)

But, having the form on the web page itself makes more sense becuaes then you could allow the user to come back later and register without having to run the setup again.


me too

I want to add register page to track the users that have installed the application. if they choose to skip the register, I would likt to hit a url to "log" the install.
@mlavwilson: This is also pretty much exactly the functionality I'm looking for. You didn't say this explicitly, but in my case at least, I would like the install to fail if the user can't or doesn't want to register. I'm not looking for something uncrackable, just something that makes it so average joe user can't install unless he pings my web site. I don't mind if Joe Hacker can figure out how to unzip the installer and install manually, or something like that.

@dienjd: is InetLoad definitely the way to go for the inet connection part, as opposed to NSISdl?

@comperio: I want the install to fail if the user can't connect, so for me I'd rather the installer didn't have to launch the user's browser to complete the install. The "custom page" (with a web-cgi form back end) you speak of sounds like what I'll want then.

I've never given much thought to developing these sorts of "registration code" installers, so I'm not very knowledgeable in this area. Are there any gotchas? Will a simple ack from the web server side be enough, or should I be using some kind of passcode or hash of a machine-specific id as the server response? Again, I'm not that concerned with even a novice hacker being able to circumvent the registration, I just want it so grandma will have no idea how to install without going through the registration.

Thanks for any advice. I'm brand new to NSIS. Been using InnoSetup up till now, but I don't think it's up to this task.

Re: me too

Originally posted by baxissimo
@dienjd: is InetLoad definitely the way to go for the inet connection part, as opposed to NSISdl?
I'd recommend going with InetLoad since it has more functionality (I don't think NSISdl can do an HTTP POST)--that way you won't find yourself changing later and then having to retest all your Internet-related stuff.

I'm having trouble using inetload to post data by calling a cgi script (written in perl) on the server side. Has anyone able to get it working on their machine?

Thanks!


php POST sample (handling GET parameters as well) included to the package, this worked correct in all tests. So may be problem is in you perl script or server settings? Can you attach a script?


I got it working.
the problem I had was that I forgot to include response page.

e.g.
InetLoad::load /post name=$NAME "http://localhost/cgi-bin/test.cgi" "$EXEDIR\response.html"

When "$EXEDIR\response.html" was omitted in the statement, the CGI script would not send registration information throgh email to me.


can you provide the code
Hi I am really interested in that registration issue.
Can you please provide a step-by-step quide or more details how to implement that. I would be great help to a lot of people.

Thanks a lot

Regards
Stephan


Here is basically what I have in the nsi script (I only attached the relevant part),

I put registration page after license page,

e.g.
# Installer pages
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_LICENSE license.txt
Page custom RegistrationPage
!insertmacro MUI_PAGE_COMPONENTS
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_STARTMENU Application $StartMenuGroup
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_PAGE_FINISH
!insertmacro MUI_UNPAGE_WELCOME
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
!insertmacro MUI_UNPAGE_FINISH


# define function
Function RegistrationPage
!insertmacro MUI_HEADER_TEXT "My Product"
"Registration Form"
!insertmacro MUI_INSTALLOPTIONS_DISPLAY "register.ini"

; read user input
!insertmacro MUI_INSTALLOPTIONS_READ $FIRSTNAME "register-nwspro.ini" "Field 2" "State"
!insertmacro MUI_INSTALLOPTIONS_READ $LASTNAME "register-nwspro.ini" "Field 4" "State"
!insertmacro MUI_INSTALLOPTIONS_READ $COMPANY "register-nwspro.ini" "Field 6" "State"
!insertmacro MUI_INSTALLOPTIONS_READ $ADDRESS "register-nwspro.ini" "Field 8" "State"
!insertmacro MUI_INSTALLOPTIONS_READ $CITY "register-nwspro.ini" "Field 10" "State"
!insertmacro MUI_INSTALLOPTIONS_READ $STATE "register-nwspro.ini" "Field 12" "State"
!insertmacro MUI_INSTALLOPTIONS_READ $EMAIL "register-nwspro.ini" "Field 14" "State"
!insertmacro MUI_INSTALLOPTIONS_READ $PHONE "register-nwspro.ini" "Field 16" "State"

InetLoad::load /post "product_name=$(^Name)&version=${VERSION}&firstname=$FIRSTNAME&lastname=$LASTNAME \
&company=$COMPANY&address=$ADDRESS&city=$CITY&state=$STATE&email=$EMAIL&phone=$PHONE" \
"http://localhost/cgi-bin/register.cgi" "$EXEDIR\response.html"
Pop $0 # return value = exit code, "OK" if OK
StrCmp $0 "OK" done
MessageBox MB_OK "Failed to register: $0"
Abort
done:
FunctionEnd




Here is the content of register.ini file
; Auto-generated by EclipseNSIS InstallOptions Script Wizard
; May 2, 2006 5:35:58 PM
[Settings]
NumFields=16
Title=Registration Form

[Field 1]
Type=Label
Left=9
Top=26
Right=47
Bottom=35
Text=First Name

[Field 2]
Type=Text
Left=47
Top=25
Right=95
Bottom=36
State=
MaxLen=20
MinLen=1

[Field 3]
Type=Label
Left=154
Top=27
Right=190
Bottom=35
Text=Last Name

[Field 4]
Type=Text
Left=195
Top=25
Right=257
Bottom=36
State=
MaxLen=20
MinLen=1


[Field 5]
Type=Label
Left=9
Top=46
Right=41
Bottom=54
Text=Company

[Field 6]
Type=Text
Left=47
Top=44
Right=141
Bottom=54
State=
MaxLen=30
MinLen=1

[Field 7]
Type=Label
Left=9
Top=65
Right=41
Bottom=73
Text=Adddress

[Field 8]
Type=Text
Left=47
Top=63
Right=141
Bottom=73
State=
MaxLen=50
MinLen=2

[Field 9]
Type=Label
Left=154
Top=65
Right=167
Bottom=73
Text=City

[Field 10]
Type=Text
Left=167
Top=63
Right=212
Bottom=73
State=
MaxLen=20

[Field 11]
Type=Label
Left=218
Top=65
Right=236
Bottom=73
Text=State

[Field 12]
Type=Text
Left=236
Top=63
Right=268
Bottom=73
MaxLen=2
MinLen=1

[Field 13]
Type=Label
Left=9
Top=86
Right=37
Bottom=93
Text=Email

[Field 14]
Type=Text
Left=47
Top=83
Right=128
Bottom=94
State=
MaxLen=30
MinLen=5

[Field 15]
Type=Label
Left=9
Top=104
Right=35
Bottom=112
Text=Phone

[Field 16]
Type=Text
Left=47
Top=102
Right=128
Bottom=113
State=
MaxLen=20
MinLen=10



Here is the content of register.cgi file
#!/usr/bin/perl
use CGI
$q = new CGI;

$product_name = $q->param('product_name');
$version = $q->param('version');
$firstname = $q->param('firstname');
$lastname = $q->param('lastname');
$company = $q->param('company');
$address = $q->param('address');
$city = $q->param('city');
$state = $q->param('state');
$email = $q->param('email');
$phone = $q->param('phone');


$mailto = "localdomain";
open(MAIL,"| /usr/sbin/sendmail -oi -n -t");
print MAIL <<END;
To:$mailto
From:$mailto
Subject: Registration

Registered User Contact Information
***********************************

Product Name = $product_name
Version = $version

First Name = $firstname
Last Name = $lastname
Company = $company
Address = $address
City = $city
State = $state
Email = $email
Phone = $phone

END

close(MAIL);


print "Content-type:text/html\n\n";
print <<HTML_RESPONSE;
<html>
<body>
Name: $lastname, $firstname</br>
Company: $company</br>
Address: $address, $city, $state</br>
Email: $email</br>
Phone: $phone</br>
</body>
</html>
HTML_RESPONSE


hope this helps!


cool thanks a lot I will test it - it is very usefull.

Regards
Stephan