![]() |
Serial Strangeness
Hi there :)
I have this code which i use to validate a serial code: the user types their serial code in a box which then posts to a webpage to check against a MySQL database and says VALID if the key is valid and INVALID if not if the key is entered correctly, there is no problem. If the key is NOT then the page for entering the serial is shown again. The only difference is that when you enter the key the second time, it doesn't matter if the key is correct or not, it doesn't bother to validate. Please advise. I have posted the bit of code which validates below: code: |
Move the contents of validateSerial into SerialPageLeave.
You don't Call SerialPageShow to show the page again... you just call Abort. Stu |
you mean like this:
code: or like this: code: Using the first method, the installer exits the second time a code is entered whether valid or not. |
code: Notice I have changed your InetLoad parameters a bit so that it's to the readme spec. Stu |
Edit (again!): The installer now simply says the code is invalid, even if the database doesn't say INVALID, but says Serial Validated
|
I have swapped the /silent and /post switched around.
Stu |
so should I switch them round?
still says invalid for all serials don't know if this is just my pc, but the installer takes at least 20 seconds to try and check (and fail) the serial the first time then only about 2 seconds the second, third, fourth etc times. |
Check the exit code. Your code would not have worked because all switches go before the url parts, not to mention you had /slient not /silent :)
Stu |
ok... i'm now a little confused... can you post the code to show what you mean... thanks.
|
Pop $1 # $1 now holds the exit code for above
Check the value of $1. Stu |
umm... how would i do that?
|
With a MessageBox perhaps :)
Stu |
ahh :)
like this: MessageBox MB_OK|MB_ICONEXCLAMATION "$1" the message box says "SendRequest Error" and the installer has now started validating every code... :confused: if you want to take a look at the installer to see for yourself i can post it here. |
If there is an error then obviously there is something wrong. Try removing the /silent "" bit.
Stu |
the installer just goes straight onto the components page and doesn't try to access the validate.php file
|
There must be something wrong with your php script or website. The code works fine for me using a different php script with post data.
Stu |
Please note, that FileRead returns string with newline char at the end (if any), so comparision may require a kind of trim for incoming string (or just use 'INVALIDE$\n' in ${if} statement). The following test works correct for me:
for the following test phpcode: PHP Code:
|
Quote:
i've checked the php manually (launched my browser and gone to the URL) and when i "post" an invalid code the source of the page simply says code: and when i "post" a valid one, code: Thats all the source shows. |
My PHP script is just a normal webpage. The only thing I can think of is make sure you set the content type to plain text before displaying your result in the PHP script:
header("Content-Type: text/plain"); Stu |
:l still doesn't work...
a temporary URL for the script is Here - At the moment any code should read INVALID... |
This is really starting to annoy me now lol... I tried putting some of this into my script:
Quote:
|
Make sure you aren't placing any new line characters on the end of the output string. FileRead reads new line characters as well.
Stu |
would that not mean that if would validate every code?
|
Sorry?
Just make sure in your PHP script you're echoing "INVALID" and not "INVALID\r\n" for example. What does your message box display? MessageBox MB_OK "Download Status: $0, Result = <$3>" Stu |
"INVALID"
|
| All times are GMT. The time now is 05:59. |
Copyright © 1999 - 2010 Nullsoft. All Rights Reserved.