License check goer ikke som det skal
er ved at proeve at lave en license server, hvor man kan secure sine scripts, Jeg kan ikke faa den til at checke domain ordentligt.problemet sker ved oprettelse af et nyt domain der skal den checke om domainet exsisterer og om man er tilladt at oprette et domain ekstra til licenscoden.
Den goer det maaske rigtigt men den opretter i saa fald ikke domain i databasen.
Licence check:
$code23 = $_POST["code23"];
$domain23 = $_POST["domain"];
$con=mysqli_connect("localhost","techhost_apt","PW_skjult,"techhost_apt");
if ($mysqli->connect_errno) {
echo "Failed to connect to MySQL: (" . $mysqli->connect_errno . ") " . $mysqli->connect_error;
}
//check license code
$result= mysqli_query($con, "SELECT * FROM apt where licensecode='".$code23."'");
while ($row=mysqli_fetch_array($result))
$licensecode=$row["licensecode"];
// Check status
$result= mysqli_query($con, "SELECT * FROM apt where licensecode='".$code23."'");
while ($row=mysqli_fetch_array($result))
$status=$row["status23"];
// Check domain
$result= mysqli_query($con, "SELECT * FROM apt where licensecode='".$code23."' AND domain23='".$domain23."'");
while ($row=mysqli_fetch_array($result))
$domain =$row["domain23"];
//If domain is emty = not exist
if ($domain==''){
// Check allowed domains
$result= mysqli_query($con,"SELECT * FROM apt where licensecode='".$code23."'");
while ($row=mysqli_fetch_array($result))
$allowed=$row["doallowed"];
//get license name
$result= mysqli_query($con,"SELECT * FROM apt where licensecode='".$code23."'");
while ($row=mysqli_fetch_array($result))
$name23 = $row["lienced_to"];
//Count how many times license is used
$result= mysqli_query($con,"select count(1) FROM apt Where licensecode='".$code23."'");
while ($row = mysqli_fetch_array($result))
$total = $row[0];
//check if there is allowed more domains
$dototal = $total +1;
//compare total domains and if ok to add new domain as ok
if ($dototal >=$allowed ){
// if new domain exist allowed domain insert domain in database with status = false
// and allow it first time
mysqli_query($con,"INSERT INTO apt (doallowed, lienced_to, domain23, licensecode, status, reason)
VALUES ('".$allowed."','".$name23."','".$domain."','".$code23."','false','8002')");
echo "false";
exit();
}
else {
// if new domain is allowed insert new domain in database with status = ok and send status ok
mysqli_query($con,"INSERT INTO apt (doallowed, lienced_to, domain23, licensecode, status, reason)
VALUES ('".$allowed."','".$name23."','".$domain."','".$code23."','ok','200')");
echo "ok";
}
}
elseif ($code23==$licensecode AND $domain23==$domain AND $status=='ok'){
echo "ok";
}
else {
echo "false";
}
echo $domain;
echo $code23;
?>
$domain er tom naar jeg checker, som den skal vaere efter check i databasen, men syntes ikke den vil saette det nye domain ind
Kommer bare med status code ok og licens koden.
Test licenscode: XEUia5nmscMijQSxFRzZ5vYPs3asDGjXoz4p6DAz
domain what ever
[url= http://apt.techhost24.com[/url]