Old 13th December 2006, 15:27   #1
deanbayley
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.
deanbayley is offline   Reply With Quote
Old 13th December 2006, 17:50   #2
Comm@nder21
Major Dude
 
Join Date: Jul 2003
Location: germany, b-w
Posts: 734
Send a message via ICQ to Comm@nder21
no, nsis cant do this itself, you'll need to use one of the few internet plugins available.
Comm@nder21 is offline   Reply With Quote
Old 13th December 2006, 22:15   #3
FineWolf
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.
FineWolf is offline   Reply With Quote
Old 14th December 2006, 14:04   #4
deanbayley
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.
Attached Files
File Type: zip verify.zip (13.4 KB, 859 views)
deanbayley is offline   Reply With Quote
Old 14th December 2006, 17:50   #5
deanbayley
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.
Attached Files
File Type: zip install.zip (54.4 KB, 1123 views)
deanbayley is offline   Reply With Quote
Old 14th December 2006, 18:02   #6
Red Wine
Forum King
 
Red Wine's Avatar
 
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
Red Wine is offline   Reply With Quote
Old 14th December 2006, 18:07   #7
deanbayley
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.
deanbayley is offline   Reply With Quote
Old 22nd March 2007, 10:24   #8
kisin
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
kisin is offline   Reply With Quote
Old 22nd March 2007, 17:34   #9
deanbayley
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.
deanbayley is offline   Reply With Quote
Old 23rd June 2008, 22:07   #10
pankajch82
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
pankajch82 is offline   Reply With Quote
Old 23rd June 2008, 23:49   #11
deanbayley
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.
deanbayley is offline   Reply With Quote
Old 24th June 2008, 09:02   #12
pankajch82
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
Attached Files
File Type: zip php+nsis.zip (1.7 KB, 477 views)
pankajch82 is offline   Reply With Quote
Old 24th June 2008, 10:14   #13
Afrow UK
Moderator
 
Afrow UK's Avatar
 
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
Afrow UK is offline   Reply With Quote
Old 24th June 2008, 10:27   #14
pankajch82
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 ...

pankajch82 is offline   Reply With Quote
Old 24th June 2008, 10:43   #15
deanbayley
Junior Member
 
Join Date: Dec 2006
Posts: 10
You beat me to it..

Heres my version of it..
Attached Files
File Type: txt test.php.txt (1.4 KB, 546 views)
deanbayley is offline   Reply With Quote
Old 24th June 2008, 11:36   #16
Red Wine
Forum King
 
Red Wine's Avatar
 
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
Red Wine is offline   Reply With Quote
Old 28th June 2008, 15:57   #17
didava
Member
 
Join Date: May 2007
Posts: 98
Hi not working

I have For Checked User Site.


code:


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

Last edited by didava; 28th June 2008 at 16:35.
didava is offline   Reply With Quote
Old 30th June 2008, 05:45   #18
dandaman32
Senior Member
 
dandaman32's Avatar
 
Join Date: Jan 2005
Location: Look behind you.
Posts: 209
Afrow:
PHP Code:
$result mysql_query("SELECT status FROM key WHERE id='" $_GET['test'] . "'"); 
Bad. SQL injection at it's finest my friend
PHP Code:
$result mysql_query("SELECT status FROM key WHERE id='" mysql_real_escape_string($_GET['test']) . "'"); 
Looks good otherwise

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.
dandaman32 is offline   Reply With Quote
Old 30th June 2008, 12:15   #19
didava
Member
 
Join Date: May 2007
Posts: 98
Thanks can you example for me thank you
didava is offline   Reply With Quote
Old 30th June 2008, 12:56   #20
didava
Member
 
Join Date: May 2007
Posts: 98
Error - aborting creation process

PHP Code:

## 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}' +2
StrCmp $R1 
'${Password1}' Good Bad
StrCmp $R0 
'${Username2}' +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 now holds the exit code for above

    
FileOpen $$"r"
    
FileRead $$3
    FileClose 
$2

    
${If} $== '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 

PHP Code:
MakeNSIS v2.37 Copyright 1995-2008 Contributors
See the file COPYING 
for 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 Files\NSIS\Contrib\Modern UI\System.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"
XPStyleon
AutoCloseWindow
true
ReserveFile
"validateuser.ini" [compress124/139 bytes
!insertmacroMUI_RESERVEFILE_INSTALLOPTIONS
!insertmacroend of MUI_RESERVEFILE_INSTALLOPTIONS
Page
custom (creator:UserPageShow) (leave:UserPageLeave)
Pagecustom (creator:validateUser)
!
insertmacroMUI_PAGE_DIRECTORY
!insertmacroend of MUI_PAGE_DIRECTORY
!insertmacroMUI_PAGE_INSTFILES
!insertmacroend of MUI_PAGE_INSTFILES
!insertmacroMUI_LANGUAGE
!insertmacroend of MUI_LANGUAGE
Function: ".onInit"
!insertmacroMUI_INSTALLOPTIONS_EXTRACT
!insertmacroend of MUI_INSTALLOPTIONS_EXTRACT
FunctionEnd
Function: "UserPageShow"
!insertmacroMUI_INSTALLOPTIONS_EXTRACT
!insertmacroend of MUI_INSTALLOPTIONS_EXTRACT
File
"PassDialog.dll"->"$PLUGINSDIR\PassDialog.dll" [compress3933/8704 bytes
Plugin Command
InitDialog UserPass
Pop
$R0
warning
unknown variable/constant "{IDC_USERNAME}" detectedignoring (D:\Download\NSIS\code\2\verify\user.nsi:40)
GetDlgItemoutput=$R1 dialog=$R0 item=${IDC_USERNAME}
SetCtlColorshwnd=$R1 text=0xFF0000 background=0xFFFFFF
warning
unknown variable/constant "{IDC_PASSWORD}" detectedignoring (D:\Download\NSIS\code\2\verify\user.nsi:42)
GetDlgItemoutput=$R1 dialog=$R0 item=${IDC_PASSWORD}
SetCtlColorshwnd=$R1 text=0x0000FF background=0xFFFFFF
File
"PassDialog.dll"->"$PLUGINSDIR\PassDialog.dll" [compress0/8704 bytes
Plugin Command
Show
Pop
$R0
FunctionEnd
Function: "UserPageLeave"
Pop$R0
Pop
$R1
warning
unknown variable/constant "{Username1}" detectedignoring (D:\Download\NSIS\code\2\verify\user.nsi:57)
StrCmp "$R0" "${Username1}equal=0nonequal=+2
warning
unknown variable/constant "{Password1}" detectedignoring (D:\Download\NSIS\code\2\verify\user.nsi:58)
StrCmp "$R1" "${Password1}equal=Goodnonequal=Bad
warning
unknown variable/constant "{Username2}" detectedignoring (D:\Download\NSIS\code\2\verify\user.nsi:59)
StrCmp "$R0" "${Username2}equal=0nonequal=+2
warning
unknown variable/constant "{Password2}" detectedignoring (D:\Download\NSIS\code\2\verify\user.nsi:60)
StrCmp "$R1" "${Password2}equal=Goodnonequal=Bad
!insertmacroMUI_HEADER_TEXT
!insertmacroend of MUI_HEADER_TEXT
FunctionEnd
Function: "validateUser"
GetDlgItemoutput=$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" [compress1423/4096 bytes
Plugin Command
show /set 76 Please Wait Checking Validating ......
File"Banner.dll"->"$PLUGINSDIR\Banner.dll" [compress0/4096 bytes
Plugin Command
getWindow
GetTempFileName 
-> $0
File
"InetLoad.dll"->"$PLUGINSDIR\InetLoad.dll" [compress8136/16384 bytes
Plugin Command
load /post licence=$R0-$R1 [url]http://www.site.com/site/user.php[/url] $0 /slient 
Pop: $1
FileOpen
: $as -> $2
FileRead
: $2->$(max:)
FileClose: $2
!insertmacro_If
!insertmacroend of _If
File
"Banner.dll"->"$PLUGINSDIR\Banner.dll" [compress0/4096 bytes
Plugin Command
destroy
MessageBox
48"Invalid User. Setup will exit now."
Quit
!insertmacro_Else
!insertmacroend of _Else
Plugin Command
destroy
Goto: USEROK
!insertmacro_EndIf
!insertmacroend of _EndIf
FunctionEnd
Section
""
SectionEnd

Processed 1 file
writing output:
Adding plug-ins initializing function... Done!
Errorcould not resolve label "Good" in function "UserPageLeave"
Error aborting creation process 
Error: could not resolve label "Good" in function "UserPageLeave"
Error - aborting creation process
didava is offline   Reply With Quote
Old 30th June 2008, 13:59   #21
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 4,926
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
Anders is offline   Reply With Quote
Old 30th June 2008, 16:30   #22
Red Wine
Forum King
 
Red Wine's Avatar
 
Join Date: Mar 2006
Location: Ath. GR
Posts: 2,078
Quote:
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.

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
Red Wine is offline   Reply With Quote
Old 30th June 2008, 16:36   #23
didava
Member
 
Join Date: May 2007
Posts: 98
ok sorry sorry sorry can you help me!! plz example for me thank you very
didava is offline   Reply With Quote
Old 30th June 2008, 17:25   #24
Red Wine
Forum King
 
Red Wine's Avatar
 
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
Red Wine is offline   Reply With Quote
Old 30th June 2008, 18:05   #25
didava
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!
didava is offline   Reply With Quote
Old 30th June 2008, 18:43   #26
Red Wine
Forum King
 
Red Wine's Avatar
 
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
Red Wine is offline   Reply With Quote
Old 30th June 2008, 19:01   #27
didava
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:
Errorcould 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.
Attached Files
File Type: nsi user.nsi (2.3 KB, 395 views)
didava is offline   Reply With Quote
Old 30th June 2008, 19:22   #28
Red Wine
Forum King
 
Red Wine's Avatar
 
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
Red Wine is offline   Reply With Quote
Old 15th July 2008, 10:04   #29
arctic_ged
Junior Member
 
Join Date: Jul 2008
Posts: 2
Question 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??
arctic_ged is offline   Reply With Quote
Old 15th July 2008, 10:38   #30
pospec
Senior Member
 
pospec's Avatar
 
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
pospec is offline   Reply With Quote
Old 15th July 2008, 10:47   #31
arctic_ged
Junior Member
 
Join Date: Jul 2008
Posts: 2
Excellent that is what I’ve been looking for. Cheers!
arctic_ged is offline   Reply With Quote
Old 15th July 2008, 10:49   #32
pospec
Senior Member
 
pospec's Avatar
 
Join Date: Jun 2007
Location: Otrokovice, Czech Republic
Posts: 308
Thumbs up

I always find something that I am looking for in Examples directory
pospec is offline   Reply With Quote
Old 13th October 2008, 19:34   #33
didava
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...
didava is offline   Reply With Quote
Old 14th October 2008, 12:48   #34
didava
Member
 
Join Date: May 2007
Posts: 98
hello...
didava is offline   Reply With Quote
Old 14th October 2008, 20:35   #35
Comperio
Major Dude
 
Comperio's Avatar
 
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.)
Comperio is offline   Reply With Quote
Old 15th October 2008, 23:03   #36
didava
Member
 
Join Date: May 2007
Posts: 98
thanks Comperio.
didava is offline   Reply With Quote
Old 21st October 2008, 17:38   #37
D13G0
Junior Member
 
Join Date: Oct 2008
Posts: 1
Quote:
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.
D13G0 is offline   Reply With Quote
Old 7th January 2010, 09:48   #38
Sinister Edd
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
Sinister Edd is offline   Reply With Quote
Old 22nd January 2010, 14:06   #39
anandharaja
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
Attached Files
File Type: zip validate serial number.zip (120.9 KB, 344 views)
anandharaja is offline   Reply With Quote
Old 15th February 2010, 17:45   #40
technobuddha
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?
technobuddha is offline   Reply With Quote
Reply
Go Back   Winamp & SHOUTcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump