Skip to content

Commit 6c14965

Browse files
Update
1 parent 73f261f commit 6c14965

File tree

4 files changed

+12
-27
lines changed

4 files changed

+12
-27
lines changed

public/functions.php

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,13 @@
11
<?php
22

3-
session_start();
4-
5-
63
// header
7-
function head(){
8-
?>
9-
10-
<h1> Blog </h1>
4+
function head(): string{
115

12-
<?php
6+
return '<h1> Blog </h1>';
137
}
148

159
// main
16-
function all_articles(){
10+
function all_articles(): void{
1711

1812
require 'connect.php';
1913

@@ -71,12 +65,13 @@ function all_articles(){
7165

7266

7367
//footer
74-
function foot(){
75-
?>
68+
function foot(): string{
69+
70+
return '
7671
<div>
7772
<a>&copy 2024 - <?php echo date("Y"); ?> Dominik-developer <!--project:one®--></a>
7873
<br><br>
7974
<a> Contact: www.blog@example.com</a> <!--<a>+00 000 000 000 </a>-->
80-
</div>
81-
<?php
75+
</div>';
76+
8277
}

public/index.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,8 @@
33
session_start();
44

55
require_once 'service.alg.php';
6-
//require_once 'main.php';
76

87
service();
98

109
header('Location: main.php');
1110

12-
13-

public/service.alg.php

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
<?php
22

3-
function service()
3+
function service(): void
44
{
55

6-
session_start();
7-
86
require 'connect.php';
97

108
$conn = @new mysqli($host, $db_user, $db_password, $db_name);
@@ -26,22 +24,17 @@ function service()
2624

2725
if($num >0)
2826
{
29-
3027
$row = $result->fetch_assoc();
3128

3229
$_SESSION['service_status'] = $row['service_status'];
33-
34-
//echo $_SESSION['servis_status'];
3530

3631
if(!$_SESSION['service_status'] == 0)
3732
{
38-
echo 'servis';
3933
//unset($_SESSION['status']);
4034
header('Location: service.html');
4135
}
4236
else
4337
{
44-
//echo 'no servis';
4538
//$_SESSION['user_session'] = session_id(); // Przypisanie identyfikatora sesji
4639
}
4740

public/single.alg.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22

33

44

5-
function articles($restored_title) {
5+
function articles($restored_title): void {
66
require 'connect.php';
77

88
$conn = new mysqli($host, $db_user, $db_password, $db_name);
99

1010
if ($conn->connect_errno) {
1111
header("HTTP/1.1 500 Internal Server Error");
1212
header("Location: error_404.php");
13-
return;
13+
exit();
1414
}
1515

1616
// prepared statement
@@ -23,7 +23,7 @@ function articles($restored_title) {
2323
if ($result->num_rows === 1) {
2424
$row = $result->fetch_assoc();
2525

26-
echo '
26+
echo'
2727
<article>
2828
<header id="title">
2929
<a>' . htmlspecialchars($row['title']) . '</a>

0 commit comments

Comments
 (0)