<?php
//If the key is blank, go on to the HTML section
if (! $_POST["key"]) {
//DO NOTHING
}
else
{
$validation = "false";
$logfile = "validation.txt";
//Read file for creating final report
$handle = fopen($logfile, "r");
//If there is no information in the log, display a message and exit
if (filesize($logfile) < 1) {
$validation = "false";
fclose ($handle); }
//Otherwise, print the report!
else {
$log = fread($handle, filesize($logfile));
fclose ($handle);
// Seperate each logline
$log = explode("|", trim($log));
// Seperate each part in each logline
for ($i = 0; $i < count($log); $i++) {
if ($log[$i] == $_POST["key"]) {
$validation = "true"; }
}
}
if ($validation == "false") {
$handle = @fopen("Validation.txt", "a");
fputs($handle, $_POST["key"] . "|");
fclose ($handle);
}
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"...
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Validation Log</title>
</head>
<body>
<form action="" method="post" name="frm">
<center><br />
Enter Your Product Key:<br />
<input type="text" id="key" name="key" /><br />
<input type="text" id="Confirm" name="Confirm" value="<?php echo $validation; ?>" />
<!--<input type="text" id="Confirm" name="Confirm" />-->
</center>
<p>
<label>
<center><input type="submit" id="valcheck" value="Validate" /></center>
</label>
</p>
</form>
</body>
</html>