-
Notifications
You must be signed in to change notification settings - Fork 0
/
passgen.php
63 lines (49 loc) · 1.32 KB
/
passgen.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
<?php
$l = $_GET['len'];
$n = 10;
function getPass($len, $strength)
{
$alph_set = array('0123456789',
'ABCDEFGHJKMNPQRSTUVWXYZ',
'!@#$%&*?',
);
$alph = "abcdefghjkmnpqrstuvwxyz";
$pass = "";
for ($i = 0; $i < $strength; $i++)
{
$alph .= $alph_set[$i];
$pass .= $alph_set[$i][array_rand(str_split($alph_set[$i]))];
}
for ($i = 0; $i < $len - $strength; $i++)
{
$pass .= $alph[rand() % strlen($alph)];
}
$pass = str_shuffle($pass);
return $pass;
}
for ($i = 0; $i < 10; $i++)
{
echo "<tr>";
for ($s = 1; $s <= 3; $s++)
{
echo "<td><span class='click-to-copy' data-toggle='tooltip' data-placement='top' title='Tooltip on top'>" . getPass($l, $s) . "</span></td>";
}
echo "</tr>";
}
?>
<script>
var client = new ZeroClipboard( $(".click-to-copy"), {
moviePath: "js/ZeroClipboard.swf",
debug: false
} );
client.on( "load", function(client)
{
client.on( 'dataRequested', function ( client, args ) {
client.setText( $(this).text() );
} );
client.on( "complete", function(client, args) {
$('.alert').fadeIn(200);
setTimeout(function(){$('.alert').fadeOut()}, 1500);
} );
} );
</script>