-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfunctions.php
More file actions
148 lines (135 loc) · 4 KB
/
Copy pathfunctions.php
File metadata and controls
148 lines (135 loc) · 4 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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
<?php
function deleteBetweenWords($string, $startWord, $endWord)
{
$pattern = "/$startWord(.*?)$endWord/s";
$replacement = "$startWord$endWord";
$result = preg_replace($pattern, $replacement, $string);
return $result;
}
function extractBetweenWords($string, $startWord, $endWord)
{
$pattern = "/.*?$startWord(.*?)$endWord.*/s";
$result = preg_replace($pattern, '$1', $string);
return $result;
}
function deleteDates($string)
{
$pattern = '/\b\d{4}-\d{2}-\d{2}\b/';
$result = preg_replace($pattern, '', $string);
$result = preg_replace('/\s+/', ' ', $result);
return trim($result);
}
function deleteTagsWithClass($html, $classname)
{
$pattern = '/<[^>]*\bclass\s*=\s*["\'][^"\']*?\b' . preg_quote($classname, '/') . '\b[^"\']*?["\'][^>]*>(.*?)<\/[^>]+>/i';
$htmlStringWithoutClass = preg_replace($pattern, '', $html);
$htmlStringWithoutClass = preg_replace('/\s+/', ' ', $htmlStringWithoutClass);
return $htmlStringWithoutClass;
}
function sendmonday()
{
try {
$link = mysqli_connect("localhost", "root", "", "bazy_danych_proj");
} catch (Exception) {
echo 'Error connecting database :c';
}
if ($link) {
$h = 5;
for ($i = 1; $i < 7; $i++) {
$c = 2;
$s = 1;
if ($i == 1 || $i == 2) {
$c = 2;
}
if ($i == 3 || $i == 5) {
$c = 5;
}
if ($i == 4) {
$c = 3;
}
if ($i == 6) {
$s = 2;
$c = 7;
}
$sql = "INSERT INTO `main` (`id`, `weekdays_id`, `hours_id`, `subjects_id`, `classes_id`, `rooms_id`) VALUES (NULL, '1', '$h', '$s', '$c', '1')";
$h++;
mysqli_query($link, $sql);
}
}
}
function sendchewsday()
{
try {
$link = mysqli_connect("localhost", "root", "", "bazy_danych_proj");
} catch (Exception) {
echo 'Error connecting database :c';
}
if ($link) {
$h = 4;
for ($i = 1; $i < 8; $i++) {
if ($i == 1 || $i == 2 || $i == 6 || $i == 7) {
$s = 1;
} else {
$s = 2;
}
if ($i == 1) {
$c = 1;
}
if ($i == 2) {
$c = 3;
}
if ($i == 3 || $i == 4) {
$c = 4;
}
if ($i == 5) {
$c = 7;
}
if ($i == 6 || $i == 7) {
$c = 8;
}
$sql = "INSERT INTO `main` (`id`, `weekdays_id`, `hours_id`, `subjects_id`, `classes_id`, `rooms_id`) VALUES (NULL, '2', '$h', '$s', '$c', '1')";
$h++;
mysqli_query($link, $sql);
}
}
}
function sendfriday()
{
try {
$link = mysqli_connect("localhost", "root", "", "bazy_danych_proj");
} catch (Exception) {
echo 'Error connecting database :c';
}
if ($link) {
$h = 5;
for ($i = 1; $i < 5; $i++) {
if ($i == 1 || $i == 2) {
$c = 1;
} else {
$c = 6;
}
$sql = "INSERT INTO `main` (`id`, `weekdays_id`, `hours_id`, `subjects_id`, `classes_id`, `rooms_id`) VALUES (NULL, '5', '$h', '1', '$c', '2')";
$h++;
mysqli_query($link, $sql);
}
}
}
// function extractWords($inputString, $arg1, $arg2, $groupnr)
// {
// $lines = explode("\n", $inputString);
// $counter = 0;
// $resultText = '';
// foreach ($lines as $line) {
// $counter += substr_count($line, $arg1);
// if ($counter == $groupnr) {
// $resultText .= substr($line, strpos($line, $arg1) + strlen($arg1)) . ' ';
// }
// $counter -= substr_count($line, $arg2);
// if ($counter <= 0 && $resultText !== '') {
// break;
// }
// }
// // Usunięcie tekstu po arg2
// $resultText = strstr($resultText, $arg2, true);
// return trim($resultText);
// }