-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathSteamKeyGenerator.php
More file actions
36 lines (32 loc) · 946 Bytes
/
SteamKeyGenerator.php
File metadata and controls
36 lines (32 loc) · 946 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<?php
function gen() {
$characters = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ';
$charactersLength = strlen($characters);
$randomString1 = '';
$randomString2 = '';
$randomString3 = '';
for ($i = 0; $i < 5; $i++) {
$randomString1 .= $characters[rand(0, $charactersLength - 1)];
}
for ($i = 0; $i < 5; $i++) {
$randomString2 .= $characters[rand(0, $charactersLength - 1)];
}
for ($i = 0; $i < 5; $i++) {
$randomString3 .= $characters[rand(0, $charactersLength - 1)];
}
$key = $randomString1 . "-" . $randomString2 . "-" . $randomString3;
echo $key . PHP_EOL;
return $key;
}
$options = getopt("a:"); // Required value (-a)
$a = $options['a'];
if (is_numeric($a) && $a > 0) {
while ($a > 0) {
$save[] = gen();
$a--;
}
} else {
echo "Enter the amount.";
}
$saveFile = "keys.txt";
file_put_contents($saveFile, implode("\n", $save));