I am trying to generate some sort of serial number using a customer name. This is for a PHP software I am developing. But I have never done trial systems and serial generation and stuff like this.
This is the code I use to generate the serial numbers:
<?php
// URL is = http://teionsoft.com/classified/keygen.php?token=
$token = @$_POST['token'];
if(empty($token))
{
echo '
<p>Token can not be blank or zero.</p>
<p>
<form action="keygen.php" method="post">
<input type="text" name="token" id="token" placeholder="Type in your full name" /><br /><br />
<input type="submit" name="submit" value="Get serial!" />
</form>
</p>';
exit;
}
function serialKey() {
// Create a token
// GUID is 128-bit hex
$hash = strtoupper(md5($token));
// Create formatted GUID
$guid = '';
// GUID format is XXXXX-XXXXX-XXXXX-XXXXX-XXXXX for readability
$guid .= substr($hash, 0, 5) .
'-' .
substr($hash, 8, 5) .
'-' .
substr($hash, 12, 5) .
'-' .
substr($hash, 16, 5) .
'-' .
substr($hash, 20, 5);
// temporary code to test base64 codeing / decoding ;
$string = $guid;
$encoded = base64_encode($string);
$decoded = base64_decode($encoded);
echo $encoded ."<br /><br />";
echo $decoded;
}
if(isset($_POST['submit']))
{
serialKey();
}
?>
How can I extract the customer name from the serial number?