-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdemo.php
More file actions
63 lines (55 loc) · 1.38 KB
/
Copy pathdemo.php
File metadata and controls
63 lines (55 loc) · 1.38 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
<?php
include "includes/db.php";
include "includes/bg.php";
date_default_timezone_set('Europe/Kiev');
add_msg(5);
add_server(5);
delete_msg(2);
function add_server($n) {
for($i = 0; $i < $n; $i++) {
$date = date("Y-m-d H:i:s");
$server = R::dispense('servers');
$server->name = rand() % 100000;
$server->ip = rand() % 1000000;
$server->date_onov = $date;
R::store($server);
}
echo "Було додано ". $n. " серверів!";
echo "\n";
}
function add_msg($n) {
for($i = 0; $i < $n; $i++) {
$date = date("Y-m-d H:i:s");
$msg = R::dispense('messages');
$msg->text = rand() % 1000;
$rand = rand() % 5;
if($rand == 0)
$msg->type = "info";
if($rand == 1)
$msg->type = "debug";
if($rand == 2)
$msg->type = "warning";
if($rand == 3)
$msg->type = "error";
if($rand == 4)
$msg->type = "fatal";
$msg->priority = rand() % 200;
$msg->level = (rand() % 1000) / 1000;
$msg->added_date = $date;
$msg->server = "localhost";
$server = R::findOne('servers', 'name = ?', array("localhost"));
$server->ownMessagesList[] = $msg;
R::store($server);
}
echo "Було додано ". $n. " повідомлень!";
echo "\n";
}
function delete_msg($n) {
for($i = 0; $i < $n; $i++) {
$msg = R::findOne( 'messages' , ' ORDER BY id DESC LIMIT 1 ' );
R::trash($msg);
}
echo "Було видалено ". $n. " повідомлень!";
echo "\n";
}
?>