php fixes

main
Yasen Pramatarov 2024-06-28 14:36:20 +03:00
parent 544d2973dd
commit a0c826ed97
4 changed files with 19 additions and 3 deletions

13
jilo-web/README.md 100644
View File

@ -0,0 +1,13 @@
requirements
- web server (deb: apache | nginx)
- php support in the web server (deb: php-fpm | libapache2-mod-php)
- pdo and pdo_sqlite support in php (deb: php-db, php-sqlite3) uncomment in php.ini: ;extension=pdo_sqlite
TODO
- jilo-web.db outside web root
- jilo-web.db writable by web server user

View File

@ -17,7 +17,7 @@ class Database {
}
public function getConnection() {
return $this-pdo;
return $this->pdo;
}
}

View File

@ -5,7 +5,7 @@ require 'classes/user.php';
unset($error);
try {
$db = new Database('./jilo-web.db');
$db = new Database('../jilo-web.db');
$user = new User($db);
if ( $_SERVER['REQUEST_METHOD'] == 'POST' ) {

View File

@ -29,7 +29,10 @@ if (isset($error)) {
<body>
<ul class="menu">
<?php if ( !isset($_SESSION['user_id']) ) { ?>
<li><a href="login.php">login</a></li>
<li><a href="logout.php">logout</a></li>
<li><a href="register.php">register</a></li>
<?php } else { ?>
<li><a href="logout.php">logout</a></li>
<?php } ?>
</ul>