![]() |
#1 |
Junior Member
Join Date: Dec 2006
Posts: 10
|
Will NSIS do what i'm looking to do?
Hi Guys,
I've recently discovered NSIS and before learning the NSIS language I need to know if it'll do what i want.. I have an application that's about 10mb, i want the installer to prompt the user for a licence code and username, when the user presses next i want the installer to send a POST (or GET) to: http://www.mydomain.com/myapp/reg.php?u=%USER_NAME%&c=%LICENCE_CODE% My script will either provide a 64 char string or the word INVALID, if it returns a string that string needs to be written to a file during the installation, if it returns invalid then the installer needs to prevent the install from proceeding. Thanks! D. |
![]() |
![]() |
![]() |
#2 |
Major Dude
|
no, nsis cant do this itself, you'll need to use one of the few internet plugins available.
hand by comm@nder21 ---------- WiKi pages:CreateInternetShortcut|Enhanced FindWindow|Parse CSV-Data|Open/Close CD-Drive|Installer without Icon|Vista application compatibility |
![]() |
![]() |
![]() |
#3 |
Junior Member
Join Date: Dec 2003
Location: Montreal, Canada
Posts: 14
|
Yes you can do what you want via NSISdl (included with the NSIS distribution). I have used something similar in the past do make sure that the installer used was the latest version.
|
![]() |
![]() |
![]() |
#4 |
Junior Member
Join Date: Dec 2006
Posts: 10
|
Thanks for the answers guys!
After several hours i've come up with the following: ## General InstallDir "$PROGRAMFILES\Test" Name "Test Installer" OutFile "Install.exe" ## Include headers !include MUI.nsh !include LogicLib.nsh ## Interface Settings !define MUI_ICON "${NSISDIR}\Contrib\Graphics\Icons\orange-install.ico" !define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\orange-uninstall.ico" XPStyle on ## Reserve Files, files that are required before the actual installation should be stored first, this will make your installer start faster. ReserveFile "validateSerial.ini" !insertmacro MUI_RESERVEFILE_INSTALLOPTIONS ## Pages Page custom SerialPageShow SerialPageLeave Page custom validateSerial !insertmacro MUI_PAGE_DIRECTORY !insertmacro MUI_PAGE_INSTFILES ## Languages !insertmacro MUI_LANGUAGE English Function .onInit !insertmacro MUI_INSTALLOPTIONS_EXTRACT "validateSerial.ini" FunctionEnd Function SerialPageShow !insertmacro MUI_HEADER_TEXT "Enter Serial Code" "Enter the software serial code to continue." PassDialog::Dialog Serial \ /HEADINGTEXT 'Please enter the serial code located on the software CD case...' \ /CENTER \ /BOXDASH 12 70 5 '' \ /BOXDASH 92 70 5 '' \ /BOXDASH 172 70 5 '' \ /BOXDASH 252 70 5 '' \ /BOX 332 70 5 '' Pop $R0 # success, back, cancel or error FunctionEnd Function SerialPageLeave ## Pop values from stack Pop $R1 Pop $R2 Pop $R3 Pop $R4 Pop $R5 ;!insertmacro MUI_HEADER_TEXT "Validating..." "Please Wait" ;!insertmacro MUI_INSTALLOPTIONS_DISPLAY "validateSerial.ini" ;MessageBox MB_OK "Break1" FunctionEnd Function validateSerial ;MessageBox MB_OK "Break2" ;## Disable the Back button ;GetDlgItem $R6 $HWNDPARENT 3 ;EnableWindow $R6 0 ;## Disable the Next button ;GetDlgItem $R6 $HWNDPARENT 1 ;EnableWindow $R6 0 GetTempFileName $0 InetLoad::load /post "licence=$R1-$R2-$R3-$R4-$R5" "http://www.deanbayley.co.uk/test/verify.php" "$0" /slient "" Pop $1 # $1 now holds the exit code for above FileOpen $2 $0 "r" FileRead $2 $3 FileClose $2 ${If} $3 == 'INVALID' MessageBox MB_OK|MB_ICONEXCLAMATION "Invalid Serial" Call SerialPageShow ${Else} Goto serialOK ${EndIf} Abort serialOK: FunctionEnd Section "" SectionEnd The required files and plugins are attached, (plugins need copied to the plugins dir) aaaaa-aaaaa-aaaaa-aaaaa-aaaaa is a valid serial and will verify, anything else will return INVALID and should cause the script to not continue... If you read through the script you can see what i was trying to do, i want it to work like so: Enter serial -> Press Next -> Displays Custom Page "please wait..." -> if it was valid continue to install dir selection || if NOT go back to the begining... At the moment it goes back to the begining after an error but then doesn't care if the serial validates or not... Any help wold be really appreciated... D. |
![]() |
![]() |
![]() |
#5 |
Junior Member
Join Date: Dec 2006
Posts: 10
|
I've sorted it...
After spending about 2 hours reading the manual i found a much more efficient way of doing this. For anyone interested i've attached the result to this post. Thanks Guys. |
![]() |
![]() |
![]() |
#6 |
Forum King
Join Date: Mar 2006
Location: Ath. GR
Posts: 2,078
|
Great! I guess it works as expected!
I think you should remove the temp file once the verification has done. Quick AVI Creator - Quick and easy convert from DVD/MPEG/AVI/MKV to AVI/MP4/MKV Quick AVI Creator entirely edited with NSIS and entirely upgraded to Unicode NSIS |
![]() |
![]() |
![]() |
#7 |
Junior Member
Join Date: Dec 2006
Posts: 10
|
I'll leave the server side script there (its not the live one anyway) so that people can play with it and hopefully learn from it...
The only valid serial is aaaaa-aaaaa-aaaaa-aaaaa-aaaaa anything else will return invalid. Now to start adding files to the installer ![]() Dean. |
![]() |
![]() |
![]() |
#8 |
Junior Member
Join Date: Mar 2007
Posts: 1
|
can you please post the source for the install.zip file?
it can realy help me out thanks |
![]() |
![]() |
![]() |
#9 |
Junior Member
Join Date: Dec 2006
Posts: 10
|
I would love to help on any specific questions but unfortunately i don't have the specific source code you requested and for security reasons i can't release the final versions source code...
Dean. |
![]() |
![]() |
![]() |
#10 |
Junior Member
Join Date: Jun 2008
Posts: 9
|
i am trying same , using above code & using below url
http://pnilyaoverseas.com/pankaj/test.php?test=12345 for easy testing i had disabled post from 5 boxes , now it just post from 1st box .....so if u type 12345 it should return Valid , if u type 00000 it should return INVALID. But its not happening , its taking valid for everything |
![]() |
![]() |
![]() |
#11 |
Junior Member
Join Date: Dec 2006
Posts: 10
|
Hi pankajch82,
I wondered who was testing it today, i setup a notification when people visit the test url... Anyway it is impossible for anyone to know why its not working without you posting your PHP source code, its like showing the doctor your foot and asking whats wrong with your ear... If you post your PHP source i'll have a look... D. |
![]() |
![]() |
![]() |
#12 |
Junior Member
Join Date: Jun 2008
Posts: 9
|
hi , yep your code is famous
![]() I am very new to both NSIS & PHP attached is PHP + NSIS stuff .... URL to test :http://pnilyaoverseas.com/pankaj/test.php?test=12345 only 12345 & 00000 are valid , rest are all invalid. In temp file i get the below error <br /> <b>Warning</b>: mysql_num_rows(): supplied argument is not a valid MySQL result resource in <b>/home/home2/indiamm/public_html/pankaj/test.php</b> on line <b>19</b><br /> INVALID It will be great if you can provide me detail son how you are handling . Thanks |
![]() |
![]() |
![]() |
#13 |
Moderator
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
|
That will occur if $_GET['test'] is empty.
http://pnilyaoverseas.com/pankaj/test.php?test= You need extra single quotes: $result = mysql_query("SELECT status FROM key WHERE id='" . $_GET['test'] . "'"); Stu |
![]() |
![]() |
![]() |
#14 |
Junior Member
Join Date: Jun 2008
Posts: 9
|
Thanks for that .......got it resolved .
Just now need to have a waiting screen that says "validating" in here ... ![]() |
![]() |
![]() |
![]() |
#15 |
Junior Member
Join Date: Dec 2006
Posts: 10
|
You beat me to it..
Heres my version of it.. |
![]() |
![]() |
![]() |
#16 |
Forum King
Join Date: Mar 2006
Location: Ath. GR
Posts: 2,078
|
@ Dean,
Hi, could you please consider to make a reference page at wiki? That would be indeed helpful for others. Quick AVI Creator - Quick and easy convert from DVD/MPEG/AVI/MKV to AVI/MP4/MKV Quick AVI Creator entirely edited with NSIS and entirely upgraded to Unicode NSIS |
![]() |
![]() |
![]() |
#17 |
Member
Join Date: May 2007
Posts: 98
|
Hi not working
I have For Checked User Site. code: It does not work. If Someone know please help me! Thank alot. Last edited by didava; 28th June 2008 at 16:35. |
![]() |
![]() |
![]() |
#18 |
Senior Member
Join Date: Jan 2005
Location: Look behind you.
Posts: 209
|
Afrow:
PHP Code:
![]() PHP Code:
![]() Edit: Holy crap it's numba two hundred! ![]() --Dan ExperienceUI for NSIS | Latest project: Enano CMS Do not PM me on the Winamp forums, I hardly ever check my messages here; you are more likely to get my attention through the ExperienceUI forum. ![]() Last edited by dandaman32; 30th June 2008 at 06:11. |
![]() |
![]() |
![]() |
#19 |
Member
Join Date: May 2007
Posts: 98
|
Thanks can you example for me thank you
|
![]() |
![]() |
![]() |
#20 |
Member
Join Date: May 2007
Posts: 98
|
Error - aborting creation process
PHP Code:
PHP Code:
Error - aborting creation process |
![]() |
![]() |
![]() |
#21 |
Moderator
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,356
|
you might want to attach the code or use pastebin next time instead of filling the thread with a long ass script
IntOp $PostCount $PostCount + 1 |
![]() |
![]() |
![]() |
#22 | |
Forum King
Join Date: Mar 2006
Location: Ath. GR
Posts: 2,078
|
Quote:
![]() btw didava, the compiler explains its self when it throws errors. Complains about some missing labels but you should take care about the warnings too. Quick AVI Creator - Quick and easy convert from DVD/MPEG/AVI/MKV to AVI/MP4/MKV Quick AVI Creator entirely edited with NSIS and entirely upgraded to Unicode NSIS |
|
![]() |
![]() |
![]() |
#23 |
Member
Join Date: May 2007
Posts: 98
|
ok sorry sorry sorry can you help me!! plz example for me thank you very
|
![]() |
![]() |
![]() |
#24 |
Forum King
Join Date: Mar 2006
Location: Ath. GR
Posts: 2,078
|
didava, I'd say you're trying to achieve things which are beyond of your nsis knowledge so far, for instance take a look at the log you've posted above, there are several warnings and errors. If you don't know how to deal with these issues what example are you seeking? You should already know how to declare user variables and how to add/use labels.
My advice is go start with the very basics. Review the manual, examine the included simple examples, use the forum and step by step you'll become able to proceed in more complicated scripting. And finally, where the girl has gone? Quick AVI Creator - Quick and easy convert from DVD/MPEG/AVI/MKV to AVI/MP4/MKV Quick AVI Creator entirely edited with NSIS and entirely upgraded to Unicode NSIS |
![]() |
![]() |
![]() |
#25 |
Member
Join Date: May 2007
Posts: 98
|
first of all, I have to say that the grammatical errors you noticed above are not mine! I have a friend who has very little inkling of English. anyway, I want you to excuse me for such an inconvenience. secondly, I had followed your manual and had reviewed it several times. But, I have to admit that we have just kicked off NSIS. We have some knowledge about PHP; however, the problem is how we can relate/combine NSIS with PHP? we noticed in your example that you have used NSIS for serial number. now we want to use your example for username and password. But how?
We want you to kindly give us an example+code for username and password. thanks in advance! |
![]() |
![]() |
![]() |
#26 |
Forum King
Join Date: Mar 2006
Location: Ath. GR
Posts: 2,078
|
Well, I haven't noticed grammatical errors and I would never talk about such things. I was talking about compiler's errors and warnings that you should be able to deal with, at least according to the long log that you've posted above.
I haven't published any manual, it is the nsis manual. Unfortunately it is not my example either, in fact I have never implemented it in a real world installer of mine. However, I'm watching this thread and I know that at least 2 users have done it successfully. Provided that your script does not throw errors and warnings related to labels and user variables, I guess that would be a step forward to use it for user name/password instead of serial number. Quick AVI Creator - Quick and easy convert from DVD/MPEG/AVI/MKV to AVI/MP4/MKV Quick AVI Creator entirely edited with NSIS and entirely upgraded to Unicode NSIS |
![]() |
![]() |
![]() |
#27 |
Member
Join Date: May 2007
Posts: 98
|
we have attached our code for you to see if there is any problem in it. and also take a look at the error it causes:
PHP Code:
|
![]() |
![]() |
![]() |
#28 |
Forum King
Join Date: Mar 2006
Location: Ath. GR
Posts: 2,078
|
Please, I've already mentioned several times that you're missing the very basics of nsis scripting. In fact, I'd say that you're keep posting on the wrong place. This thread is dedicated to a specific implementation. You're coming back again and again asking for a ready to use script while you don't even know what a label is. The compiler speaks to you and tells you exactly what is the error. If you don't know what a label is, please read the nsis manual. And if you still can't deal with it, search the forum or open a new thread to ask for help but leave the current thread for those that would be useful for them.
http://nsis.sourceforge.net/Docs/Chapter4.html#4.2.1 http://nsis.sourceforge.net/Docs/Chapter4.html#4.3 Quick AVI Creator - Quick and easy convert from DVD/MPEG/AVI/MKV to AVI/MP4/MKV Quick AVI Creator entirely edited with NSIS and entirely upgraded to Unicode NSIS |
![]() |
![]() |
![]() |
#29 |
Junior Member
Join Date: Jul 2008
Posts: 2
|
![]()
Does anyone know how to create a popup that says "Please wait... Verifying your serial number", as seen on deanbayley's completed installer??
|
![]() |
![]() |
![]() |
#30 |
Senior Member
Join Date: Jun 2007
Location: Otrokovice, Czech Republic
Posts: 308
|
I don't know what is deanbayley's completed installer, however you can try to look into NSIS's Examples\Banner subdirectory
![]() |
![]() |
![]() |
![]() |
#31 |
Junior Member
Join Date: Jul 2008
Posts: 2
|
Excellent that is what I’ve been looking for. Cheers!
|
![]() |
![]() |
![]() |
#32 |
Senior Member
Join Date: Jun 2007
Location: Otrokovice, Czech Republic
Posts: 308
|
![]()
I always find something that I am looking for in Examples directory
![]() |
![]() |
![]() |
![]() |
#33 |
Member
Join Date: May 2007
Posts: 98
|
hello, how is it goin?
i could very easily develop the program by means of your nice method! and, by the way, the username and password work properly! but please tell me, if i want the username and password work only on one computer,what should i do? i appreciate if you could guide me through this: when the subscriber wants to install the program, i want to do sth that the serial number on his hard disk or motherboard be sent to me in order that i can realize that he is the real subscriber or not!!! if there is any plug-in, i appreciate if you send it to me with an example. thanks in advance!!! i'm eagerly looking forward to hearing from you soon... |
![]() |
![]() |
![]() |
#34 |
Member
Join Date: May 2007
Posts: 98
|
hello...
|
![]() |
![]() |
![]() |
#35 |
Major Dude
Join Date: Jan 2005
Location: Oregon Coast
Posts: 737
|
Here's an example of how to get the drive serial number:
http://nsis.sourceforge.net/Get_Disk..._Serial_Number But just keep in mind you'd be restricting installation that DRIVE not to the computer. Getting the serial numbers from other hardware might be more involved. This is the best info I could find from NSIS: http://forums.winamp.com/showthread....hreadid=257639 Other than that, you'll probably have to do some research on your own (maybe at MSDN, etc.) |
![]() |
![]() |
![]() |
#36 |
Member
Join Date: May 2007
Posts: 98
|
thanks Comperio.
|
![]() |
![]() |
![]() |
#37 | |
Junior Member
Join Date: Oct 2008
Posts: 1
|
Quote:
I think that everything is fine, because if i apply the test directly to the site the result is the expected, but not with the installer. Any help is welcome. |
|
![]() |
![]() |
![]() |
#38 |
Junior Member
Join Date: Jan 2010
Posts: 2
|
Hello all,
I was wondering what the solution was on that problem when you enter a false key and where send back to the insert product key page, then when you entered the same key the key was valid. Thanks in advance |
![]() |
![]() |
![]() |
#39 |
Member
Join Date: Mar 2009
Posts: 50
|
hello
iam searching a serialUI like that, i spending lot of time to find the code. now i got the result. see my attachement |
![]() |
![]() |
![]() |
#40 |
Junior Member
Join Date: Jan 2010
Posts: 11
|
putting output into variable, is it possible
Hello there,
Does anyone have an example on how I can put the return html status into a variable? I'm still new to NSIS, and I fully admit i'm not a programmer (systems admin guy here). I'm creating a username and password functionality, and the return from the PHP file would normally go into a file, but I'd like to have this return into a variable. Do I need to do fileOpen ? or? |
![]() |
![]() |
![]() |
|
Thread Tools | Search this Thread |
Display Modes | |
|
|