Compare commits
6 Commits
Author | SHA1 | Date |
---|---|---|
james | d2145779c4 | |
pawel | e2c94ceeb1 | |
pawel | c9adecf9b0 | |
pawel | 364c6f3ca9 | |
pawel | 7e73a7cea6 | |
pawel | 2455fa869f |
5
get.php
5
get.php
|
@ -1,13 +1,14 @@
|
|||
<?
|
||||
<?php
|
||||
$dbhost = "localhost";
|
||||
$dbuser = "root";
|
||||
$dbpass = "";
|
||||
$dbname = "osoby";
|
||||
$dbname = "osdb";
|
||||
|
||||
$conn = mysqli_connect($dbhost, $dbuser, $dbpass, $dbname);
|
||||
$ans = mysqli_query($conn, "SELECT * FROM osoby");
|
||||
$json = array();
|
||||
|
||||
|
||||
while ($row = mysqli_fetch_assoc($ans)) {
|
||||
$json[] = $row;
|
||||
}
|
||||
|
|
19
index.html
19
index.html
|
@ -1,13 +1,22 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<html lang="pl">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Document</title>
|
||||
<title>Sortowanie Sufiksów</title>
|
||||
<link rel="stylesheet" href="styles.css">
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
|
||||
<script src="fetch.js"></script>
|
||||
<h1>Sortowanie Sufiksów</h1>
|
||||
<input type="text" id="slowo" placeholder="Podaj słowo">
|
||||
<button onclick="sortujSufiksy()">Sortuj Sufiksy</button>
|
||||
<h2>Nieposortowane Sufiksy</h2>
|
||||
<pre id="nieposortowane"></pre>
|
||||
<h2>Posortowane Sufiksy</h2>
|
||||
<pre id="posortowane"></pre>
|
||||
<script src="js.js"></script>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
|
@ -0,0 +1,21 @@
|
|||
const url = "http://localhost/P20.05"
|
||||
|
||||
fetch('get.php')
|
||||
.then(response => response.json())
|
||||
.then( data => {
|
||||
console.log(data)
|
||||
})
|
||||
|
||||
function sortujSufiksy() {
|
||||
const slowo = document.getElementById('slowo').value;
|
||||
const sufiksy = [];
|
||||
for (let i = 0; i < slowo.length; i++) {
|
||||
sufiksy.push(slowo.slice(i));
|
||||
}
|
||||
document.getElementById('nieposortowane').textContent = formatSufiksy(sufiksy);
|
||||
sufiksy.sort();
|
||||
document.getElementById('posortowane').textContent = formatSufiksy(sufiksy);
|
||||
}
|
||||
function formatSufiksy(sufiksy) {
|
||||
return sufiksy.map((sufiks, index) => `${index + 1} ${sufiks}`).join('\n');
|
||||
}
|
|
@ -0,0 +1,58 @@
|
|||
|
||||
body {
|
||||
font-family: Arial, sans-serif;
|
||||
background-color: #f5f5f5;
|
||||
color: #333;
|
||||
margin: 0;
|
||||
padding: 20px;
|
||||
line-height: 1.6;
|
||||
}
|
||||
|
||||
h1 {
|
||||
text-align: center;
|
||||
color: #0056b3;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
|
||||
input[type="text"] {
|
||||
width: calc(100% - 22px);
|
||||
padding: 10px;
|
||||
margin-bottom: 10px;
|
||||
border: 1px solid #ccc;
|
||||
border-radius: 4px;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
|
||||
button {
|
||||
display: block;
|
||||
width: 100%;
|
||||
padding: 10px;
|
||||
background-color: #0056b3;
|
||||
color: white;
|
||||
border: none;
|
||||
border-radius: 4px;
|
||||
cursor: pointer;
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
button:hover {
|
||||
background-color: #004494;
|
||||
}
|
||||
|
||||
|
||||
h2 {
|
||||
color: #0056b3;
|
||||
border-bottom: 2px solid #0056b3;
|
||||
padding-bottom: 5px;
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
pre {
|
||||
background-color: #fff;
|
||||
border: 1px solid #ccc;
|
||||
padding: 10px;
|
||||
border-radius: 4px;
|
||||
overflow-x: auto;
|
||||
}
|
Loading…
Reference in New Issue