-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrekey.php
More file actions
70 lines (53 loc) · 1.19 KB
/
rekey.php
File metadata and controls
70 lines (53 loc) · 1.19 KB
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
<?php
// Include section
// include('file.php');
include('server.php');
// Dependent Variables
// $user = ...
// $id = ...
// $user = '610b4dab4efeb';
$user = '602d5b998a635';
// $user = '610efb74a2b98';
// Code to test
// echo something
$array = name_array();
$count = name_row_count();
// print_r($array);
echo $uuid;
for($i = 0; $i < $count; $i++){
$uid = $array[$i]['uid'];
$uuid = uuid();
$query = "UPDATE Budget.Accounts SET uid = '$uuid' WHERE uid = '$uid'";
printf($query, "\n");
mysqli_query($db, $query);
}
function uuid() {
$uuid = base64_encode(uniqid(rand(1000,9518)));
return $uuid;
}
function name_row_count() {
global $db, $user;
$query = "SELECT * FROM Budget.Accounts";
if ($result = mysqli_query($db, $query)) {
$row_cnt = mysqli_num_rows($result);
mysqli_free_result($result);
return $row_cnt;
}
}
function name_array() {
global $db, $user;
$query = "SELECT * FROM Budget.Accounts";
$result = mysqli_query($db, $query);
$name_array = array();
while($row = mysqli_fetch_assoc($result)) {
$name = $row['Account_name'];
$uid = $row['uid'];
$tmp = array(
"Name" => "$name",
"uid" => "$uid"
);
array_push($name_array, $tmp);
}
return $name_array;
}
?>