-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
149 lines (140 loc) · 3.33 KB
/
index.php
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="/main.css" media="screen">
<title>Password Generator</title>
</head>
<body>
<?php date_default_timezone_set('UTC'); ?>
<?php /* Copyright 2016 Warren Myers ([email protected]).
Published under the CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/)
license. You are free to share, adapt, and otherwise include or modify the
code so long as attribution is given to the original author (Warren Myers).
No warranties are given, granted, or implied.
*/ ?>
<div id="header">
<h1><a href="/"></a>Password Generator</a></h1>
</div>
<div id="page">
<div id="intro">
<p>Every time this page loads, you will see several random string triplets ranging from 12-24 characters, one each of three different varieties (<a href="//stackoverflow.com/q/5950756/4418">"4 of 4"</a>, "upper & lower alphanumeric", and "lower alphanumeric").
</div>
<div id=codice>
<h1>12 Characters</h1>
<?php
$p = array('a','b','c','d','e','f','g','h','i','j','k','l','m','n',
'o','p','q','r','s','t','u','v','w','x','y','z','1','2',
'3','4','5','6','7','8','9','0','A','B','C','D','E','F',
'G','H','I','J','K','L','M','N','O','P','Q','R','S','T',
'U','V','W','X','Y','Z','!','@','#','$','%','^','&','*',
'(',')','_','+','=','-','?');
$seed = intval(date("dmHs"));
if(isset($kt))
srand(($seed+rand(1,$seed)));
else
srand($seed);
echo "<p><code>";
$kt = 0;
$seed = intval(date("sHs"));
while($kt<12){
$s = (rand(1,$seed) % 77);
echo $p[$s];
$kt++;
}
echo "</code><p><code>";
$kt = 0;
while($kt<12){
$s = (rand(1,$seed) % 62);
echo $p[$s];
$kt++;
}
echo "</code><p><code>";
$kt = 0;
while($kt<12){
$s = (rand(1,$seed) % 36);
echo $p[$s];
$kt++;
}
echo "</code><p>\n";
?>
</div>
<div id=codice>
<h1>16 Characters</h1>
<?php
echo "<p><code>";
$kt = 0;
$seed = intval(date("sHs"));
while($kt<16){
$s = (rand(1,$seed) % 77);
echo $p[$s];
$kt++;
}
echo "</code><p><code>";
$kt = 0;
while($kt<16){
$s = (rand(1,$seed) % 62);
echo $p[$s];
$kt++;
}
echo "</code><p><code>";
$kt = 0;
while($kt<16){
$s = (rand(1,$seed) % 36);
echo $p[$s];
$kt++;
}
echo "</code><p>\n";
?>
</div>
<div id=codice>
<h1>24 Characters</h1>
<?php
echo "<p><code>";
$kt = 0;
$seed = intval(date("sHs"));
while($kt<24){
$s = (rand(1,$seed) % 77);
echo $p[$s];
$kt++;
}
echo "</code><p><code>";
$kt = 0;
while($kt<24){
$s = (rand(1,$seed) % 62);
echo $p[$s];
$kt++;
}
echo "</code><p><code>";
$kt = 0;
while($kt<24){
$s = (rand(1,$seed) % 36);
echo $p[$s];
$kt++;
}
echo "</code><p>\n";
?>
</div>
<div id=codice>
<h1>~50 Character Passphrase</h1>
<?php
$list = "";
$words = file("detros.list");
while(strlen($list) < 50){
$ndx = rand(0,count($words));
$list .= $words[$ndx];
}
echo "<p><code>";
echo $list;
echo "</code>";
?>
</div>
</div>
<div id="footer">
<address>Copyright © 2016-<?php echo date("Y")." ";?>
by <a href="//antipaucity.com">Warren Myers</a>.
Some rights reserved - <a href="https://creativecommons.org/licenses/by/4.0">CC BY 4.0</a>.
Loaded <?php echo date("jS M Y H:i");?> UTC.
</address>
</div>
</body>
</html>