-2

So I was writing a simple PHP script to check a database to see whether a license key was contained within it. `

if (!isset($_POST['License'])) {
    exit('No License Found');
}

$authtoken = $_POST['License'];
$query = "SELECT * FROM nexus_licensekeys WHERE lkey_key='$authtoken'";

if($result = $conn->query($query)){
    if($row = $result->fetch_assoc()){
        echo "AUTHORIZED";
    }
    else{
        echo "NOT AUTHORIZED";
    }
}
else{
    echo "FAILED";
}

When I send a post request with a license key contained within the database, "No License Found" is returned. I've tried sending a post request in many different way but I can't figure out why it isn't receiving the post data.

2020欧洲杯时间表This is how I am sending the post data:

net::requests m_request(L"webp", false);
std::wstring answer = m_request.Post(false, URL, "License=%s", Licence.c_str());

if (answer == L"AUTHORIZED") { return true; }
else if (answer == L"NOT AUTHORIZED") { return false; }
else if (answer == L"FAILED") { return false; }
else if (answer == L"No License Found") { return false; }
else { return false; }
New contributor
Gabe M is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
  • Show us how do you send your POST requests – Vladimir Mar 27 at 3:09
  • I added it to the original post – Gabe M Mar 27 at 3:14
  • Sorry, I'm not familiar with this syntax. What language is that? – Vladimir Mar 27 at 5:01
  • c++, but it isn't a client side issue. Even when i use a program like postman, i still get the same result. – Gabe M Mar 27 at 5:17
  • Can you add what you get in PHP with var_dump($_POST);? If there's nothing, the C++ doesn't generate a valid POST request. You might want to add the SO tag 'c++' to get help there. ALSO IN ANY CASE your PHP code is vulnerable to SQL injection by POST data! You should look into prepared statements to avoid that. – Jonas Eberle Mar 27 at 8:05

Your Answer

Gabe M is a new contributor. Be nice, and check out our Code of Conduct.

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.