-
Nov 7th, 2022, 10:52 PM
#1
Thread Starter
Lively Member
SQL Value +1
can someone tell me how to add the value in plus one?
PHP Code:
if ($lKey->Get('hwid') != '' && $lKey->Get('hwid') != $hwid){
$result = array("success"=>"false", "reason"=>"");
echo Encryption::Encrypt(json_encode($result));
$lKey->Update('inuse', + 1);
$lKey->Save();
die();
}
-
Nov 8th, 2022, 12:33 AM
#2
Re: SQL Value +1
I don’t see a SQL-Statement…
Last edited by Zvoni; Tomorrow at 31:69 PM.
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
One System to rule them all, One Code to find them,
One IDE to bring them all, and to the Framework bind them,
in the Land of Redmond, where the Windows lie
---------------------------------------------------------------------------------
People call me crazy because i'm jumping out of perfectly fine airplanes.
---------------------------------------------------------------------------------
Code is like a joke: If you have to explain it, it's bad
-
Nov 8th, 2022, 10:02 AM
#3
Re: SQL Value +1
I "do" ... but it's PHP, not VB so it's another lost thread that's going to get all the wrong responses...
stand by, asking the mods to move it...
-tg
EDIT - while it is a DB question, because of the library and technoloigy being used, it's less appropriate for the DB area, as it doesn't relate to general SQL ... but rather a mis use of a library in a specific language...
Last edited by techgnome; Nov 8th, 2022 at 10:05 AM.
-
Nov 8th, 2022, 10:06 AM
#4
Re: SQL Value +1
Code:
$lKey->Update('inuse', + 1);
$lKey->Save();
You're not updating the data there ... you're setting it to 1. You need to get the current value, +1 it, THEN use that result in the update.
-tg
-
Nov 9th, 2022, 10:38 PM
#5
Thread Starter
Lively Member
Re: SQL Value +1
Sorry, I don't know much about PHP and I'm trying my hand at it.
in the cell "inuse" is 1
if the stored hwid is wrong at
PHP Code:
if ($lKey->Get('hwid') != '' && $lKey->Get('hwid') != $hwid){
$result = array("success"=>"false", "reason"=>"Current Key is locked to different HWID, please contact product owner.");
$lKey->Get('inuse');
$lKey->Set('inuse', $inuse);
$lKey->Save();
echo Encryption::Encrypt(json_encode($result));
die();
}
the cell "inuse" + 1 should be added, which is then in the cell 2.
This is all the code:
PHP Code:
<?php
include('config/init.php');
if (isset($_POST['action'])){
if ($_POST['action'] == 'init'){
Encryption::Init(Config::Get('system.secret_app_key'));
}
}
else {
$request = file_get_contents('php://input');
$decrypted = Encryption::Decrypt($request);
$json = json_decode($decrypted, true);
if (isset($json['action']) == false)
{
$result = array("success"=>"false", "reason"=>"No API call specified.");
echo Encryption::Encrypt(json_encode($result));
die();
}
else {
$action = $json['action'];
if ($action == "login") {
$key = $json['key'];
$hwid = $json['hwid'];
$used = '1';
$inuse = + 1;
$app = $json['app'];
$lKey = new LicenseKey();
if ($lKey->Load(array('license_key'=>$key)) == false){
$result = array("success"=>"false", "reason"=>"Specified License Key was not found in our database.");
echo Encryption::Encrypt(json_encode($result));
die();
if ($lKey->Get('hwid') != '' && $lKey->Get('hwid') != $hwid){
$result = array("success"=>"false", "reason"=>"Current Key is locked to different HWID, please contact product owner.");
$lKey->Get('inuse');
$lKey->Set('inuse', $inuse);
$lKey->Save();
echo Encryption::Encrypt(json_encode($result));
die();
}
$result = array("success"=>"true", "reason"=>"You have been logged in.", "expires_on"=>Utils::GetDateNice($lKey->Get('expires_on')));
echo Encryption::Encrypt(json_encode($result));
Session::Set('key', $key);
Session::Set('app_id', $app);
Session::Set('hwid', $hwid);
$onl = new OnlineUser();
$onl->Update();
die();
}
}
}
i think this is wrong
PHP Code:
$lKey->Get('inuse');
$lKey->Set('inuse', $inuse);
$lKey->Save();
-
Nov 12th, 2022, 04:13 PM
#6
Thread Starter
Lively Member
Re: SQL Value +1
no one has an idea?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|