I'm trying to get the key that is inside the sql list on a local server to learn but it's returning this error Exception:Winhttprequest
I know there are several similar topics, but so far I haven't found anything with a database.
Pascal Script
function ValidateActivationKey(key: string): Boolean;
var
WinHttpReq: Variant;
begin
Result := False;
try
WinHttpReq := CreateOleObject('WinHttp.WinHttpRequest.5.1');
WinHttpReq.Open('GET', 'https://localhost/PHP2/verify_key.php?key=' + key, False);
WinHttpReq.Send();
if WinHttpReq.Status = 'Validated' then
begin
MsgBox('Valid key! Starting installation.', mbInformation, MB_OK);
Result := True;
end
else
begin
MsgBox('Invalid or already used key.', mbError, MB_OK);
end;
except
MsgBox('Error connecting to server.', mbError, MB_OK);
end;
end;
function InitializeSetup(): Boolean;
var
key: string;
begin
Result := ValidateActivationKey(key);
end;
Php
$key = $_GET['key'] ?? '';
if ($key == '') {
die("ERRO: Key not provided.");
}
$sql = "SELECT * FROM keys WHERE key = '$key' AND activated = 0";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
$conn->query("UPDATE keys SET activated = 1 WHERE key = '$key'");
echo "VALID";
} else {
echo "INVALID";
}
$conn->close();
?>
SQL
If you can give me a hint or where the error might be, I would greatly appreciate it.
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744115022a4559130.html
评论列表(0条)