-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
89 lines (87 loc) · 2.61 KB
/
index.php
File metadata and controls
89 lines (87 loc) · 2.61 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
<!DOCTYPE html>
<html lang="sv">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Today's great wisdom:</title>
<style>
body {
font-family: Arial, sans-serif;
display: flex;
flex-direction: column;
justify-content: flex-start;
align-items: center;
height: 100vh;
margin: 0;
padding-top: 15vh;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}
.image-container {
margin-top: 10px;
}
.image-container img {
max-width: 300px;
height: auto;
}
.page-header {
color: white;
font-size: 14px;
margin-bottom: 20px;
opacity: 0.8;
}
.container {
background: white;
padding: 40px;
border-radius: 10px;
box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
text-align: center;
}
h1 {
color: #333;
margin-bottom: 30px;
}
.result {
font-size: 24px;
color: #667eea;
margin-bottom: 30px;
font-weight: bold;
}
button {
background-color: #667eea;
color: white;
border: none;
padding: 12px 30px;
font-size: 16px;
border-radius: 5px;
cursor: pointer;
transition: background-color 0.3s;
}
button:hover {
background-color: #764ba2;
}
</style>
</head>
<body>
<p class="page-header">This page contains randomized wisdom</p>
<div class="container">
<h1>Today's wisdom</h1>
<?php
// Läs ord från de tre filerna
$words1 = array_filter(array_map('trim', file('1.txt')));
$words2 = array_filter(array_map('trim', file('2.txt')));
$words3 = array_filter(array_map('trim', file('3.txt')));
// Slumpa ett ord från varje fil
$word1 = $words1[array_rand($words1)];
$word2 = $words2[array_rand($words2)];
$word3 = $words3[array_rand($words3)];
// Skriv ut utan radbrytningar, avslutat med punkt
$result = $word1 . " " . $word2 . " " . $word3 . ".";
?>
<div class="result"><?php echo htmlspecialchars($result); ?></div>
<button onclick="location.reload()">Give me another one!</button>
</div>
<div class="image-container">
<img src="tanke.png" alt="Tanke">
</div>
</body>
</html>