This commit is contained in:
vadym Novoselskyi 2024-10-07 08:18:58 +02:00
parent 22efe9d5cc
commit 31a4541545
18 changed files with 46 additions and 34 deletions

2
.gitignore vendored
View File

@ -10,5 +10,3 @@ nginx/*
php/*
!php/php.ini
db/mysql
db/performance_schema

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,11 +1,51 @@
17,4
48,7
48,6
48,5
48,4
12,3
17,3
48,3
23,3
22,9
22,8
22,7
22,6
22,5
22,4
22,3
21,34
21,33
21,32
21,31
21,29
21,28
21,26
21,25
21,24
21,23
21,22
21,21
21,20
21,18
21,17
21,16
21,15
21,12
21,11
21,10
21,9
21,8
21,7
21,6
21,5
21,4
21,3
17,4
17,3
12,3
7,3
5,3
4,3
3,2
1,2
1,45
3,44
2,44

Binary file not shown.

Binary file not shown.

BIN
db/ibtmp1

Binary file not shown.

BIN
db/tc.log

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -7,7 +7,7 @@
</head>
<body>
<?php
include_once('../inc/egytalk_connect.php');
include_once('../inc/world_connect.php');
/* Kör frågan mot databasen world och tabellen country */
$stmt = $db->prepare("SELECT Name, Population FROM country WHERE Name LIKE 'Z%' ORDER BY Population DESC");

View File

@ -32,31 +32,5 @@
<input type="hidden" name="logout">
<input type="submit" value="Log Out"> <br><br>
</form>
<?php
if(isset($_POST['firstName'],$_POST['surName'],$_POST['username'],$_POST['password'])){
include_once('../inc/egytalk_connect.php');
$firstName = filter_input(INPUT_POST, 'firstName', FILTER_SANITIZE_SPECIAL_CHARS);
$surName = filter_input(INPUT_POST, 'surName', FILTER_SANITIZE_SPECIAL_CHARS);
$username = filter_input(INPUT_POST, 'username', FILTER_SANITIZE_SPECIAL_CHARS);
$password = password_hash($_POST['password'], PASSWORD_DEFAULT);
$stmt= $db->prepare("INSERT INTO user(uid, firstname, surname, username, password) VALUES(UUID(), :fn, :sn,:user,:pwd)");
$stmt->bindValue(":fn", $firstName);
$stmt->bindValue(":sn", $surName);
$stmt->bindValue(":user", $username);
$stmt->bindValue(":pwd", $password);
try{
$stmt->execute();
echo "Good";
}catch(Exception $e){
echo "Not good";
}
}
?>
</body>
</html>

View File

@ -6,7 +6,7 @@
define('DB_PASSWORD', '12345');
}
if (!defined('DB_HOST')) {
define('DB_HOST', 'localhost'); // Use 'mariadb' for Docker, otherwise '127.0.0.1'
define('DB_HOST', 'mariadb'); // Use 'mariadb' for Docker, otherwise '127.0.0.1'
}
if (!defined('DB_NAME')) {
define('DB_NAME', 'egytalk');

View File

@ -2,7 +2,7 @@
// Definierar konstanter med användarinformation.
define ('DB_USER', 'world');
define ('DB_PASSWORD', '12345');
define ('DB_HOST', 'localhost'); // 'Om docker - 'mariadb', annars 127.0.0.1
define ('DB_HOST', 'mariadb'); // 'Om docker - 'mariadb', annars 127.0.0.1
define ('DB_NAME', 'world');
// Skapar en anslutning till MySql och databasen world