-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathupdate_users.php
More file actions
57 lines (44 loc) · 1.79 KB
/
update_users.php
File metadata and controls
57 lines (44 loc) · 1.79 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
<?php
include_once ('classes/Database.php');
include_once ('user/local.php');
# database options
$db = Database::getDB();
$mysqli = $db->getCon();
# line endings
if (php_sapi_name() == 'cli') {
$line_end = "\n";
} else {
$line_end = '<br>' . "\n";
}
# rename user fields
$sql = 'ALTER TABLE `users`
CHANGE `ID` `id` SMALLINT( 6 ) NOT NULL AUTO_INCREMENT ,
CHANGE `Name` `username` VARCHAR( 64 ) CHARACTER SET utf8 NOT NULL,
CHANGE `Password` `password_hash` VARCHAR( 128 ) CHARACTER SET utf8 NOT NULL,
CHANGE `Rights` `rights` VARCHAR( 20 ) CHARACTER SET utf8 NOT NULL ,
CHANGE `Email` `mail` VARCHAR( 128 ) CHARACTER SET utf8 NOT NULL ,
CHANGE `regDate` `registred` DATETIME NOT NULL ,
CHANGE `Contactmail` `contact_mail` VARCHAR( 128 ) CHARACTER SET utf8 NOT NULL ,
CHANGE `Clearname` `screen_name` VARCHAR( 128 ) CHARACTER SET utf8 NOT NULL,
CHANGE `About` `description` TEXT CHARACTER SET utf8 NOT NULL,
CHANGE `Website` `website` VARCHAR( 128 ) CHARACTER SET utf8 NOT NULL,
ADD `profile_image` TEXT CHARACTER SET utf8 NOT NULL,
DROP `cmtNotify`;';
$result = $mysqli->multi_query($sql);
if (!$result) {
echo '<pre>'; print_r($mysqli); echo '</pre>';
echo 'could not change fields in table users' . $line_end;
} else {
echo 'changed fields in table users' . $line_end;
}
# add notification fields
$sql = 'ALTER TABLE `comments`
ADD `notifications` TINYINT( 1 ) DEFAULT 1 NOT NULL;';
$result = $mysqli->multi_query($sql);
if (!$result) {
echo '<pre>'; print_r($mysqli); echo '</pre>';
echo 'could not change fields in table comments' . $line_end;
} else {
echo 'changed fields in table comments' . $line_end;
}
?>