I am wanting to have a webpage check for a validation key that is stored in a mysql database. In the database I have 1000 serial numbers stored.
After a serial number gets validated I would like for it to return me to the page and NOT ask me for a serial number again.
Here is what I have so far:
<?php
require 'keygen-connect.php';
$key = addslashes(htmlentities($_GET['key']));
if ($key == "") {
die("No key found");
}
$query = "SELECT * FROM `keys` WHERE key='".$key."'";
$result = mysql_query($query) or die("Could not execute query");
if (mysql_num_rows($result) > 0) {
echo "Key valid";
// Setting the key activated
$query = "UPDATE `keys` SET activation='yes' WHERE `key`='".$key."'";
$result = mysql_query($query);
} else {
echo "Key invalid";
}
?>
This is saved as a file on my server called "keygen-validate.php". This file will connect to my database and look through the serial numbers to make sure it is ok.
Where I am having trouble is the part that tells my page to run the serial number through the keygen-validation.php file.
<!DOCTYPE html>
<html lang="en">
<head>
<?php
// what do I need to put here to have this page run this serial number
784a97bf1955d5f7a2b9dd6c1e371e17b73c42bc
through the keygen-validation.php file?
?>
</head>
<body>
</body>
</html>
I should also add that this is meant to be something simple. I do not need the pricey options. I'm sure that folks could easily do things to circumvent my efforts but this is as much of a learning project as anything else.
Thanks
Also, it has been pointed out that I need to update to pdo ... so, yeah, I'm working on that :)