Archive: Will NSIS do what i'm looking to do?


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.


no, nsis cant do this itself, you'll need to use one of the few internet plugins available.


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.


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.


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.


Great! I guess it works as expected!
I think you should remove the temp file once the verification has done.


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.


can you please post the source for the install.zip file?
it can realy help me out

thanks


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.


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


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.


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


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


Thanks for that .......got it resolved .

Just now need to have a waiting screen that says "validating" in here ...

:)


You beat me to it..

Heres my version of it..


@ Dean,

Hi, could you please consider to make a reference page at wiki?
That would be indeed helpful for others.


Hi not working

I have For Checked User Site.




## Reserve Files,
ReserveFile "validateUser.ini"
!insertmacro MUI_RESERVEFILE_INSTALLOPTIONS

## Pages
Page custom UserPageShow UserPageLeave
Page custom validateUser
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES

## Languages
!insertmacro MUI_LANGUAGE English

Function .onInit
!insertmacro MUI_INSTALLOPTIONS_EXTRACT "validateUser.ini"
FunctionEnd

Function UserPageShow
!insertmacro MUI_INSTALLOPTIONS_EXTRACT "validateUser.ini"

PassDialog::InitDialog /NOUNLOAD UserPass
Pop $R0 # Page HWND

GetDlgItem $R1 $R0 ${IDC_USERNAME}
SetCtlColors $R1 0xFF0000 0xFFFFFF
GetDlgItem $R1 $R0 ${IDC_PASSWORD}
SetCtlColors $R1 0x0000FF 0xFFFFFF

PassDialog::Show
Pop $R0 # success, back, cancel or error
FunctionEnd

Function UserPageLeave


## Pop password & username from stack
Pop $R0
Pop $R1

## A bit of validation
StrCmp $R0 '${Username1}' 0 +2
StrCmp $R1 '${Password1}' Good Bad
StrCmp $R0 '${Username2}' 0 +2
StrCmp $R1 '${Password2}' Good Bad

!insertmacro MUI_HEADER_TEXT "Validating..." "Please Wait"


FunctionEnd

Function validateUser

;## Disable the Back button
GetDlgItem $R6 $HWNDPARENT 3
EnableWindow $R6 0
## Disable the Next button
GetDlgItem $R6 $HWNDPARENT 1
EnableWindow $R6 0

Banner::show /NOUNLOAD /set 76 "Please Wait Checking" "Validating ......"
Banner::getWindow /NOUNLOAD

GetTempFileName $0
InetLoad::load /post "licence=$R0-$R1" "http://www.site.com/site/user.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'
Banner::destroy
MessageBox MB_OK|MB_ICONEXCLAMATION "Invalid User. Setup will exit now."

Quit

${Else}
Banner::destroy
Goto USEROK
${EndIf}

USEROK:
FunctionEnd

Section ""
SectionEnd


It does not work.

If Someone know please help me!

Thank alot.

Afrow:

$result= mysql_query("SELECT status FROM key WHERE id='" . $_GET***91;'test'***93; . "'"); 

Bad. SQL injection at it's finest my friend ;)
$result= mysql_query("SELECT status FROM key WHERE id='" . mysql_real_escape_string($_GET***91;'test'***93;) . "'"); 

Looks good otherwise :)

Edit: Holy crap it's numba two hundred! :D

--Dan

Thanks can you example for me thank you


Error - aborting creation process




>## General
>InstallDir "$PROGRAMFILES\Test"
>Name "Test Installer"
>OutFile "Install.exe"

>## Include headers
>!include MUI.nsh
>!include LogicLib.nsh

>## Interface Settings
>!define MUI_ICON "$Icons\orange-install.ico"
>!define MUI_UNICON "Icons\orange-uninstall.ico"
>XPStyle on
AutoCloseWindow true


>## Reserve Files
>ReserveFile "validateUser.ini"
>!insertmacro MUI_RESERVEFILE_INSTALLOPTIONS

>## Pages
>Page custom UserPageShow UserPageLeave
Page custom validateUser
>!insertmacro MUI_PAGE_DIRECTORY
>!insertmacro MUI_PAGE_INSTFILES

>## Languages
>!insertmacro MUI_LANGUAGE English

>Function .onInit
>!insertmacro MUI_INSTALLOPTIONS_EXTRACT "validateUser.ini"
>FunctionEnd

>Function UserPageShow
!insertmacro MUI_INSTALLOPTIONS_EXTRACT "validateUser.ini"

PassDialog::InitDialog /NOUNLOAD UserPass
Pop $R0 # Page HWND

GetDlgItem $R1 $R0 ${IDC_USERNAME}
SetCtlColors $R1 0xFF0000 0xFFFFFF
GetDlgItem $R1 $R0${IDC_PASSWORD}
SetCtlColors $R1 0x0000FF 0xFFFFFF

PassDialog
::Show
Pop $R0 # success, back, cancel or error
>FunctionEnd

>Function UserPageLeave


>## Pop password & username from stack
>Pop $R0
Pop $R1

>## A bit of validation
>StrCmp $R0 '${Username1}' 0 +2
StrCmp $R1'${Password1}' Good Bad
StrCmp $R0'${Username2}' 0 +2
StrCmp $R1'${Password2}' Good Bad

!insertmacro MUI_HEADER_TEXT "Validating..." "Please Wait"


>FunctionEnd

>Function validateUser


;## Disable the Back button
GetDlgItem $R6 $HWNDPARENT 3
EnableWindow $R6 0
## Disable the Next button
GetDlgItem $R6 $HWNDPARENT 1
EnableWindow $R6 0

Banner::show /NOUNLOAD /set 76 "Please Wait Checking" "Validating ......"
Banner::getWindow /NOUNLOAD

GetTempFileName$0
InetLoad::load /post "licence=$R0-$R1" "http://www.site.com/site/user.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'
Banner::destroy
MessageBox MB_OK|MB_ICONEXCLAMATION "Invalid User. Setup will exit now."

Quit

${Else}
Banner::destroy
Goto USEROK
${EndIf}

USEROK:
>FunctionEnd

Section ""
>SectionEnd
>


MakeNSIS v2.37 - Copyright 1995-2008 Contributors

See the file COPYINGfor license details.
>Credits can be found in the Users Manual.

>Processing config:
>Processing plugin dlls: "C:\Program Files\NSIS\Plugins\*.dll"
>- AccessControl::DenyOnFile
>- AccessControl::DenyOnRegKey
>- AccessControl::GrantOnFile
>- AccessControl::GrantOnRegKey
>- AccessControl::RevokeOnFile
>- AccessControl::RevokeOnRegKey
>- AccessControl::SetFileGroup
>- AccessControl::SetFileOwner
>- AccessControl::SetOnFile
>- AccessControl::SetOnRegKey
>- AccessControl::SetRegKeyGroup
>- AccessControl::SetRegKeyOwner
>- AdvSplash::show
>- Banner::destroy
>- Banner::getWindow
>- Banner::show
>- BgImage::AddImage
>- BgImage::AddText
>- BgImage::Clear
>- BgImage::Destroy
>- BgImage::Redraw
>- BgImage::SetBg
>- BgImage::SetReturn
>- BgImage::Sound
>- BrandingURL::Set
>- BrandingURL::Unload
>- ButtonEvent::AddEventHandler
>- ButtonEvent::Unload
>- ButtonEvent::WhichButtonID
>- Delay::DelayButton
>- Delay::Free
>- Dialer::AttemptConnect
>- Dialer::AutodialHangup
>- Dialer::AutodialOnline
>- Dialer::AutodialUnattended
>- Dialer::GetConnectedState
>- Dialogs::Author
>- Dialogs::Folder
>- Dialogs::Open
>- Dialogs::Ver
>- EmbeddedLists::Dialog
>- EmbeddedLists::InitDialog
>- EmbeddedLists::Show
>- EnumCDs::next
>- ExecCmd::exec
>- ExecCmd::wait
>- ExecDos::exec
>- ExecDos::wait
>- FontName::name
>- FontName::version
>- GetVersion::IEVersion
>- GetVersion::WindowsName
>- GetVersion::WindowsPlatformArchitecture
>- GetVersion::WindowsPlatformId
>- GetVersion::WindowsServerName
>- GetVersion::WindowsServicePack
>- GetVersion::WindowsServicePackBuild
>- GetVersion::WindowsType
>- GetVersion::WindowsVersion
>- InetLoad::load
>- InstOpts::dialog
>- InstallOptions::dialog
>- InstallOptions::initDialog
>- InstallOptions::show
>- InstallOptionsEx::dialog
>- InstallOptionsEx::initDialog
>- InstallOptionsEx::setFocus
>- InstallOptionsEx::show
>- LangDLL::LangDialog
>- Locate::_Close
>- Locate::_Find
>- Locate::_GetSize
>- Locate::_Open
>- Locate::_RMDirEmpty
>- Locate::_Unload
>- LockedList::AddFile
>- LockedList::AddModule
>- LockedList::Dialog
>- LockedList::InitDialog
>- LockedList::Show
>- LockedList::SilentPercentComplete
>- LockedList::SilentSearch
>- LockedList::SilentWait
>- LockedList::Unload
>- Math::Script
>- NSISArray::ArrayCount
>- NSISArray::ArrayExists
>- NSISArray::Clear
>- NSISArray::Concat
>- NSISArray::Copy
>- NSISArray::Cut
>- NSISArray::Debug
>- NSISArray::Delete
>- NSISArray::ErrorStyle
>- NSISArray::Exists
>- NSISArray::ExistsI
>- NSISArray::FreeUnusedMem
>- NSISArray::Join
>- NSISArray::New
-NSISArray::Pop
>- NSISArray::Push
>- NSISArray::Put
>- NSISArray::ReDim
>- NSISArray::Read
>- NSISArray::ReadToStack
>- NSISArray::Reverse
>- NSISArray::Search
>- NSISArray::SearchI
>- NSISArray::SetSize
>- NSISArray::Shift
>- NSISArray::SizeOf
>- NSISArray::Sort
>- NSISArray::Splice
>- NSISArray::Swap
>- NSISArray::Unload
>- NSISArray::Unshift
>- NSISArray::Write
>- NSISArray::WriteList
>- NSISArray::WriteListC
>- NSISdl::download
>- NSISdl::download_quiet
>- NotifyIcon::Icon
>- PPC-Registry::_CERAPIINIT
>- PPC-Registry::_CERAPIINITEX
>- PPC-Registry::_CERAPIUNINIT
>- PPC-Registry::_Close
>- PPC-Registry::_CopyKey
>- PPC-Registry::_CopyValue
>- PPC-Registry::_CreateKey
>- PPC-Registry::_DeleteKey
>- PPC-Registry::_DeleteKeyEmpty
>- PPC-Registry::_DeleteValue
>- PPC-Registry::_Find
>- PPC-Registry::_HexToStr
>- PPC-Registry::_KeyExists
>- PPC-Registry::_MoveKey
>- PPC-Registry::_MoveValue
>- PPC-Registry::_Open
>- PPC-Registry::_Read
>- PPC-Registry::_ReadExtra
>- PPC-Registry::_SaveKey
>- PPC-Registry::_StrToHex
>- PPC-Registry::_Unload
>- PPC-Registry::_Write
>- PPC-Registry::_WriteExtra
>- PassDialog::Dialog
>- PassDialog::InitDialog
>- PassDialog::Show
>- PopupListBox::MultiSelect
>- PopupListBox::SingleSelect
>- RealProgress::AddProgress
>- RealProgress::DetailProgress
>- RealProgress::FileProgress
>- RealProgress::GetProgress
>- RealProgress::GradualProgress
>- RealProgress::SetProgress
>- RealProgress::Unload
>- ScrollLicense::Set
>- ScrollLicense::Unload
>- SelfDel::del
>- SetCursor::File
>- SetCursor::Position
>- SetCursor::System
>- SetCursor::Visibility
>- ShutDown::LogOff
>- ShutDown::PowerOff
>- ShutDown::Reboot
>- ShutDown::ShutDown
>- Splash::show
>- StartMenu::Init
>- StartMenu::Select
>- StartMenu::Show
>- System::Alloc
>- System::Call
>- System::Copy
>- System::Free
>- System::Get
>- System::Int64Op
>- System::Store
>- ToggleInstFiles::Set
>- ToggleInstFiles::Unload
>- ToolTips::Author
>- ToolTips::Classic
>- ToolTips::Modern
>- TypeLib::GetLibVersion
>- TypeLib::Register
>- TypeLib::UnRegister
>- UserInfo::GetAccountType
>- UserInfo::GetName
>- UserMgr::AddPrivilege
>- UserMgr::AddToGroup
>- UserMgr::BuiltAccountEnv
>- UserMgr::ChangeUserPassword
>- UserMgr::CreateAccount
>- UserMgr::CreateAccountEx
>- UserMgr::CreateGroup
>- UserMgr::DeleteAccount
>- UserMgr::DeleteGroup
>- UserMgr::GetCurrentUserName
>- UserMgr::GetLocalizedStdAccountName
>- UserMgr::GetUserInfo
>- UserMgr::HasPrivilege
>- UserMgr::IsMemberOfGroup
>- UserMgr::RegLoadUserHive
>- UserMgr::RegUnLoadUserHive
>- UserMgr::RemoveFromGroup
>- UserMgr::RemovePrivilege
>- UserMgr::SetRegKeyAccess
>- UserMgr::SetUserInfo
>- VPatch::vpatchfile
>- WAnsis::config
>- WAnsis::setskin
>- WAnsis::skinit
>- WAnsis::unskinit
>- ZipDLL::extractall
>- ZipDLL::extractfile
>- cdrom::CLOSE
>- cdrom::FINDCLOSE
>- cdrom::FINDNEXT
>- cdrom::OPEN
>- cdrom::STATUS
>- cdrom::VOLUMENAME
>- cdrom::VOLUMESERIALNUMBER
>- inetc::get
>- inetc::head
>- inetc::post
>- inetc::put
>- md5dll::GetMD5File
>- md5dll::GetMD5Random
>- md5dll::GetMD5String
>- nsDialogs::Create
>- nsDialogs::CreateControl
>- nsDialogs::CreateItem
>- nsDialogs::GetUserData
>- nsDialogs::OnBack
>- nsDialogs::OnChange
>- nsDialogs::OnClick
>- nsDialogs::OnNotify
>- nsDialogs::SelectFileDialog
>- nsDialogs::SelectFolderDialog
>- nsDialogs::SetRTL
>- nsDialogs::SetUserData
>- nsDialogs::Show
>- nsExec::Exec
>- nsExec::ExecToLog
>- nsExec::ExecToStack
>- nsProcess::_FindProcess
>- nsProcess::_KillProcess
>- nsProcess::_Unload
>- nsisUser::IsLoginValid
>- nsislog::Log
>- registry::_Close
>- registry::_CopyKey
>- registry::_CopyValue
>- registry::_CreateKey
>- registry::_DeleteKey
>- registry::_DeleteKeyEmpty
>- registry::_DeleteValue
>- registry::_Find
>- registry::_HexToStr
>- registry::_KeyExists
>- registry::_MoveKey
>- registry::_MoveValue
>- registry::_Open
>- registry::_Read
>- registry::_ReadExtra
>- registry::_RestoreKey
>- registry::_SaveKey
>- registry::_StrToHex
>- registry::_Unload
>- registry::_Write
>- registry::_WriteExtra
>- version::GetWindowsVersion
>- version::IsWindows2000
>- version::IsWindows2003
>- version::IsWindows31
>- version::IsWindows95
>- version::IsWindows98
>- version::IsWindows98orLater
>- version::IsWindowsME
>- version::IsWindowsNT351
>- version::IsWindowsNT40
>- version::IsWindowsPlatform9x
>- version::IsWindowsPlatformNT
>- version::IsWindowsXP
>- xml::_CloneNode
>- xml::_Coordinate
>- xml::_CreateNode
>- xml::_CreateText
>- xml::_DeclarationEncoding
>- xml::_DeclarationStandalone
>- xml::_DeclarationVersion
>- xml::_ElementPath
>- xml::_FindCloseElement
>- xml::_FindNextElement
>- xml::_FirstAttribute
>- xml::_FirstChild
>- xml::_FirstChildElement
>- xml::_FreeNode
>- xml::_GetAttribute
>- xml::_GetNodeValue
>- xml::_GetText
>- xml::_GotoHandle
>- xml::_GotoPath
>- xml::_InsertAfterNode
>- xml::_InsertBeforeNode
>- xml::_InsertEndChild
>- xml::_IsCDATA
>- xml::_LastAttribute
>- xml::_LastChild
>- xml::_LoadFile
>- xml::_NextAttribute
>- xml::_NextSibling
>- xml::_NextSiblingElement
>- xml::_NoChildren
>- xml::_NodeHandle
>- xml::_NodeType
>- xml::_Parent
>- xml::_PreviousAttribute
>- xml::_PreviousSibling
>- xml::_RemoveAttribute
>- xml::_RemoveNode
>- xml::_ReplaceNode
>- xml::_RootElement
>- xml::_SaveFile
>- xml::_SetAttribute
>- xml::_SetAttributeName
>- xml::_SetAttributeValue
>- xml::_SetCDATA
>- xml::_SetCondenseWhiteSpace
>- xml::_SetEncoding
>- xml::_SetNodeValue
>- xml::_SetText
>- xml::_Unload

>!define: "MUI_INSERT_NSISCONF"=""

>Changing directory to: "D:\Download\NSIS\code\2\verify"

>Processing script file: "D:\Download\NSIS\code\2\verify\user.nsi"
>InstallDir: "$PROGRAMFILES\Test"
>Name: "Test Installer"
>OutFile: "Install.exe"
>!include: "C:\Program Files\NSIS\Include\MUI.nsh"
>!include: "C:\Program Files\NSIS\Contrib\Modern UI\System.nsh"
>NSIS Modern User Interface version 1.75 - © 2002-2007 Joost Verburg (C:Program FilesNSISContribModern UISystem.nsh:11)
!
define: "MUI_VERBOSE"="3"
>!include: closed: "C:\Program Files\NSIS\Contrib\Modern UI\System.nsh"
>!include: closed: "C:\Program Files\NSIS\Include\MUI.nsh"
>!include: "C:\Program Files\NSIS\Include\LogicLib.nsh"
>!include: closed: "C:\Program Files\NSIS\Include\LogicLib.nsh"
>!define: "MUI_ICON"="C:\Program Files\NSIS\Contrib\Graphics\Icons\orange-install.ico"
>!define: "MUI_UNICON"="C:\Program Files\NSIS\Contrib\Graphics\Icons\orange-uninstall.ico"
>XPStyle: on
AutoCloseWindow: true
ReserveFile: "validateuser.ini" ***91;compress***93; 124/139 bytes
>!insertmacro: MUI_RESERVEFILE_INSTALLOPTIONS
>!insertmacro: end of MUI_RESERVEFILE_INSTALLOPTIONS
Page: custom (creator:UserPageShow) (leave:UserPageLeave)
>Page: custom (creator:validateUser)
!insertmacro: MUI_PAGE_DIRECTORY
>!insertmacro: end of MUI_PAGE_DIRECTORY
>!insertmacro: MUI_PAGE_INSTFILES
>!insertmacro: end of MUI_PAGE_INSTFILES
>!insertmacro: MUI_LANGUAGE
>!insertmacro: end of MUI_LANGUAGE
>Function: ".onInit"
>!insertmacro: MUI_INSTALLOPTIONS_EXTRACT
>!insertmacro: end of MUI_INSTALLOPTIONS_EXTRACT
FunctionEnd
>Function: "UserPageShow"
>!insertmacro: MUI_INSTALLOPTIONS_EXTRACT
>!insertmacro: end of MUI_INSTALLOPTIONS_EXTRACT
File: "PassDialog.dll"->"$PLUGINSDIR\PassDialog.dll" ***91;compress***93; 3933/8704 bytes
Plugin Command: InitDialog UserPass
Pop: $R0
warning: unknown variable/constant "{IDC_USERNAME}" detected, ignoring (D:DownloadNSIScode2verifyuser.nsi:40)
>GetDlgItem: output=$R1 dialog=$R0 item=${IDC_USERNAME}
>SetCtlColors: hwnd=$R1 text=0xFF0000 background=0xFFFFFF
warning: unknown variable/constant "{IDC_PASSWORD}" detected, ignoring (D:DownloadNSIScode2verifyuser.nsi:42)
>GetDlgItem: output=$R1 dialog=$R0 item=${IDC_PASSWORD}
>SetCtlColors: hwnd=$R1 text=0x0000FF background=0xFFFFFF
File: "PassDialog.dll"->"$PLUGINSDIR\PassDialog.dll" ***91;compress***93; 0/8704 bytes
Plugin Command: Show
Pop: $R0
FunctionEnd
>Function: "UserPageLeave"
>Pop: $R0
Pop: $R1
warning: unknown variable/constant "{Username1}" detected, ignoring (D:DownloadNSIScode2verifyuser.nsi:57)
>StrCmp "$R0" "${Username1}" equal=0, nonequal=+2
warning: unknown variable/constant "{Password1}" detected, ignoring (D:DownloadNSIScode2verifyuser.nsi:58)
>StrCmp "$R1" "${Password1}" equal=Good, nonequal=Bad
warning: unknown variable/constant "{Username2}" detected, ignoring (D:DownloadNSIScode2verifyuser.nsi:59)
>StrCmp "$R0" "${Username2}" equal=0, nonequal=+2
warning: unknown variable/constant "{Password2}" detected, ignoring (D:DownloadNSIScode2verifyuser.nsi:60)
>StrCmp "$R1" "${Password2}" equal=Good, nonequal=Bad
>!insertmacro: MUI_HEADER_TEXT
>!insertmacro: end of MUI_HEADER_TEXT
FunctionEnd
>Function: "validateUser"
>GetDlgItem: output=$R6 dialog=$HWNDPARENT item=3
EnableWindow: handle=$R6 enable=0
GetDlgItem: output=$R6 dialog=$HWNDPARENT item=1
EnableWindow: handle=$R6 enable=0
File: "Banner.dll"->"$PLUGINSDIR\Banner.dll" ***91;compress***93; 1423/4096 bytes
Plugin Command: show /set 76 Please Wait Checking Validating ......
>File: "Banner.dll"->"$PLUGINSDIR\Banner.dll" ***91;compress***93; 0/4096 bytes
Plugin Command: getWindow
GetTempFileName-> $0
File: "InetLoad.dll"->"$PLUGINSDIR\InetLoad.dll" ***91;compress***93; 8136/16384 bytes
Plugin Command: load /post licence=$R0-$R1 ***91;url***93;http://www.site.com/site/user.php***91;/url***93; $0 /slient
>Pop: $1
FileOpen: $0 as r -> $2
FileRead: $2->$3 (max:)
>FileClose: $2
>!insertmacro: _If
>!insertmacro: end of _If
File: "Banner.dll"->"$PLUGINSDIR\Banner.dll" ***91;compress***93; 0/4096 bytes
Plugin Command: destroy
MessageBox: 48: "Invalid User. Setup will exit now."
>Quit
>!insertmacro: _Else
>!insertmacro: end of _Else
Plugin Command: destroy
Goto: USEROK
>!insertmacro: _EndIf
>!insertmacro: end of _EndIf
FunctionEnd
Section: ""
>SectionEnd

Processed 1 file, writing output:
>Adding plug-ins initializing function... Done!
>Error: could not resolve label "Good" in function "UserPageLeave"
>Error - aborting creation process
>
Error: could not resolve label "Good" in function "UserPageLeave"
Error - aborting creation process

you might want to attach the code or use pastebin next time instead of filling the thread with a long ass script


Originally posted by Anders
you might want to attach the code or use pastebin next time instead of filling the thread with a long ass script
Right! Moreover, is difficult to keep my eyes on the text while the girl from the avatar is looking at me. ;)
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.

ok sorry sorry sorry can you help me!! plz example for me thank you very


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?


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!


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.


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:


Error: could not resolve label "Good" in function "UserPageLeave"

>Error - aborting creation process
>
guide us where exactly our problem lies. we appreciate if you just give us an example+script. thank you very much for your cooperation dear.

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


Popup Window
  Does anyone know how to create a popup that says "Please wait... Verifying your serial number", as seen on deanbayley's completed installer??


I don't know what is deanbayley's completed installer, however you can try to look into NSIS's Examples\Banner subdirectory ;)


Excellent that is what I’ve been looking for. Cheers!


I always find something that I am looking for in Examples directory
:up:


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...


hello...


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.)


thanks Comperio.


Originally posted by pankajch82
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
Hi, the same happens to me, I created a database and a table with 2 fields, one for the key and another for the status, insert a key into the database to perform the test but does not work.

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.

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


hello

iam searching a serialUI like that, i spending lot of time to find the code. now i got the result. see my attachement


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?