-
Notifications
You must be signed in to change notification settings - Fork 1
/
setup.php
31 lines (28 loc) · 1.18 KB
/
setup.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
<?php
/**
* Execute an sql query in the database. The correct database connection
* will be chosen and the query will be logged with the success status.
*
* @param string $query string query to execute
*/
function exec_query($query) {
global $database, $errors;
$conn = $database->getConnectionHandler();
$success = $conn->Query($query);
//Kimai_Logger::logfile($query);
if (!$success) {
$errorInfo = serialize($conn->Error());
Kimai_Logger::logfile('[ERROR] in [' . $query . '] => ' . $errorInfo);
$errors = true;
}
}
include('/var/www/html/includes/basics.php');
$randomAdminID = random_number(9);
echo "=================================================\n";
echo "Setting up default Password for admin: changeme \n";
echo "=================================================\n";
$adminPassword = encode_password('changeme');
$query = "INSERT INTO `kimai_users` (`userID`,`name`,`mail`,`password`, `globalRoleID` ) VALUES ('$randomAdminID','admin','[email protected]','$adminPassword',1);";
exec_query($query);
$query = "INSERT INTO `kimai_groups_users` (`groupID`,`userID`, `membershipRoleID`) VALUES ('1','$randomAdminID','1');";
exec_query($query);