-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfunctions.php
41 lines (38 loc) · 990 Bytes
/
functions.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
<?php
function recurse_copy($src,$dst) {
$dir = opendir($src);
@mkdir($dst);
while(false !== ( $file = readdir($dir)) ) {
if (( $file != '.' ) && ( $file != '..' )) {
if ( is_dir($src . '/' . $file) ) {
recurse_copy($src . '/' . $file,$dst . '/' . $file);
}
else {
copy($src . '/' . $file,$dst . '/' . $file);
}
}
}
closedir($dir);
}
function create_uuid()
{
#29eeddc3-4149-4249-b053-d7d3f046802a
#758e65c5-30d7-4a11-9b09-8fbff26ad763
$index = 0;
$hex[$index] = bin2hex(random_bytes(4)) ."-";
$index++;
$hex[$index] = bin2hex(random_bytes(2)) ."-";
$index++;
$hex[$index] = bin2hex(random_bytes(2)) ."-";
$index++;
$hex[$index] = bin2hex(random_bytes(2)) ."-";
$index++;
$hex[$index] = bin2hex(random_bytes(6));
$uuid = "";
for($i = 0;$i <= $index;$i++)
{
$uuid .= $hex[$i];
}
return $uuid;
}
?>