Server-side Validation fails - Advanced Installer Community
Cubiboy
Posts: 6
Joined: Wed Aug 06, 2014 10:01 am

Server-side Validation fails

Hello Communtiy,

I have an Problem with the Server-Side Validation function in Advanced Installer.
I have edit all the options in the programm correctly, but now i'll get the message, that the serial number didn't sent.
The program echos 'Seriennummer nicht gefunden'.

This ist my Code:

Code: Select all

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

//Datenbank
$db_host = 'localhost';
$db_user = 'mbpicturessql5';
$db_pass = 'mariusbutz';
$db_name = 'mbpicturessql5';

// 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 . "Seriennummer nicht gefunden!";
  }
  if($is_valid == true){
    return LICENSE_VALID . $msg_sep . "Seriennummer ist korrekt!";
  }
  else{
    return LICENSE_INVALID . $msg_sep . "Seriennummer: " . $posted_serial . ' ist unkorrekt!'; 
  }
}




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();
}
?>

What can I do?
Where is my mistake?


Thank you.

Cubiboy
Cubiboy
Posts: 6
Joined: Wed Aug 06, 2014 10:01 am

Re: Server-side Validation fails

Anyone an idea?

Cubiboy
Eusebiu
Posts: 4971
Joined: Wed Nov 14, 2012 2:04 pm

Re: Server-side Validation fails

Hi,

Sorry for the delayed reply.

I looked over your PHP code and it is correct, however, as you mentioned, it seems that the serial number is not sent to it, otherwise that message would not be displayed. Can you please send us the .AIP (project file) and a verbose log of the installation to support at advancedinstaller dot com, so we can investigate them?

Best regards,
Eusebiu
Eusebiu Aria - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
Cubiboy
Posts: 6
Joined: Wed Aug 06, 2014 10:01 am

Re: Server-side Validation fails

Hey Eusebiu,

I have fixed the Problem. I updated to 11.4 (before I used 10.7) and now it works. However I have an other question.
How can I start .bat files? I put them in the Installation directory in the Files and Folders Browser but whats now?
I've read youre explination on the Site, but I didn't understood it :(


Best regards,
Cubiboy
Eusebiu
Posts: 4971
Joined: Wed Nov 14, 2012 2:04 pm

Re: Server-side Validation fails

Hi,

I'm glad the first problem is fixed.

In order to launch a BAT file from your package you can follow the steps below:
- add your files in the project using the [Temporary Files] toolbar button (only if you want to launch them before the "Add Resources" action group, otherwise add them normally)
- go in the Custom Action page and add a "Launch file" custom action
- right-click in the "File To Launch" field, use the "File..." opiton and select your file from the newly appeared dialog
- build and run the project

Best regards,
Eusebiu
Eusebiu Aria - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
Cubiboy
Posts: 6
Joined: Wed Aug 06, 2014 10:01 am

Re: Server-side Validation fails

Thank you for this Solution.

Runs this solution the file after the complete installation?
because the batch uses sources, which will be installed.


Cubiboy
Eusebiu
Posts: 4971
Joined: Wed Nov 14, 2012 2:04 pm

Re: Server-side Validation fails

Yes, as I mentioned in the previous post, if the batch file is executed after the "Add Resources" action group, you can add it as a normal file in the "Files and Folders" page and follow the other steps I mentioned. Also, you may need to check the "deferred" with "no impersonation" options for your custom action.

Best regards,
Eusebiu
Eusebiu Aria - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”