"Next" Button not working after server-side validation. - Advanced Installer Community
Hunraywizzy
Posts: 3
Joined: Sat Dec 28, 2019 5:47 pm

"Next" Button not working after server-side validation.

Please i need urgent help.
I'm using advanced installer 15.1,
I created a project for testing, and I used the sample PHP code and SQL query provided in the advanced installer website. (I'm using Xampp Server)
When i run the installer, and put in the wrong serial number, it says "invalid serial number" but when i put the correct one from the database it still says "invalid serial number",
I tried debugging the code, the new code is posted below.

Now it's working fine, if i put a wrong one it says "invalid serial number", if i put the right one from the database it says "correct serial number"
But when i click "Next" button, nothing seems to be happening. And I'm stuck here. Please help me out what am i not doing right??
I have sent the attachment of the AI project.



//Debugged code

<?php
define('LICENSE_VALID', '601');
define('LICENSE_INVALID', '602');

//Datenbank
$db_host = 'localhost';
$db_user = 'root';
$db_pass = '';
$db_name = 'mydb';

// client information table
$clients_tbl_name = 'clients';
$sn_tbl_col = 'serial_no';


## ##
## Server HTTP response to the query issued by Advanced Installer serial validation tool. ##
## ##
function ServerResponse($is_valid, $posted_serial){
$msg_sep = "\n";

// load error messages from your database, using "$lang_id" for localization (optional)

if($posted_serial == '' && $is_valid == false){
return LICENSE_INVALID . $msg_sep . "Missing Serial Number!";
}
if($is_valid == true){
return LICENSE_VALID . $msg_sep . "Serial Number is Correct!";
}
else{
return LICENSE_INVALID . $msg_sep . "Serial Number: " . $posted_serial . ' is not Correct!';
}
}




if(isset($_POST['sn'])){
//User Inputs
$sn = $_POST['sn'];
$email = $_POST['email'];
$additional_information = $_POST['ai'];

//MySQL connection
mysql_connect($db_host, $db_user, $db_pass) or die(ServerResponse(false, $sn));
mysql_select_db($db_name) or die(ServerResponse(false, $sn));

//MySQL Request
$sn_query = "SELECT ". $sn_tbl_col ." FROM ". $clients_tbl_name ." WHERE ". $sn_tbl_col ." = '".mysql_real_escape_string($sn)."'";
$result = mysql_query($sn_query);

// get result set size
if(mysql_num_rows($result) == 0){
// serial number NOT found in database => issue error response
echo ServerResponse(false, $sn);
die();
}
else{
// serial number was found in database => issue SUCCESS response
echo ServerResponse(true, $sn);
die();
}
}


else{
// issue error response
$sn = '';
echo ServerResponse(false, $sn);
die();
}
?>
Attachments
log file2.zip
This is the verbose log file
(8.67 KiB) Downloaded 287 times
adv screenshot.PNG
adv screenshot.PNG (141.82 KiB) Viewed 4040 times
Test.zip
This is the AI project
(3.08 KiB) Downloaded 299 times
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: "Next" Button not working after server-side validation.

Hi Henry,

Looking over the installation log file you sent me over email it seems the problem is caused by the fact that your web server validation script returns an answer string starting with an empty new line character. I.e.
'

601
Serial Number is Correct!'


Please note that the web server validation script response must start with 601 (without any other prepending char, nor even an empty new line).

So, could you please check the implementation of your web server and make sure it does reply an answer starting just with 601 string?

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
Hunraywizzy
Posts: 3
Joined: Sat Dec 28, 2019 5:47 pm

Re: "Next" Button not working after server-side validation.

Thanks Daniel.. I've debugged my code and everything is working smoothly now.
I Even included the validation whereby it can only be used once after installation.
Thank you so much for your kind support.
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: "Next" Button not working after server-side validation.

You are always welcome Henry.

I am glad you got everything working.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”