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
FOLLOW US
Get the latest news in Application Packaging