244 lines
7.2 KiB
PHP
244 lines
7.2 KiB
PHP
<?php
|
|
require ("3-protect.php");
|
|
//session_start();
|
|
include 'i18n_setup.php';
|
|
/*include 'localize.php';
|
|
$domain = 'sentier';
|
|
localize($domain);
|
|
*/
|
|
include 'functions.php';
|
|
?>
|
|
<!DOCTYPE html>
|
|
<html lang="en">
|
|
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
|
<title><?php echo gettext('View photos in Sqlite base'); ?></title>
|
|
|
|
<link rel="stylesheet" href="css/sls.css" />
|
|
<link rel='stylesheet' href='lc-lightbox/css/lc_lightbox.min.css' />
|
|
<link rel='stylesheet' href='lc-lightbox/css/open_close_fx.css' />
|
|
<link rel='stylesheet' href='lc-lightbox/skins/minimal.css' />
|
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.1.1/css/all.min.css" integrity="sha512-KfkfwYDsLkIlwQp6LFnl8zNdLGxu9YAA1QvwINks4PhcElQSvqcyVLLD9aMhXd13uQjoXtEKNosOWaZqXgel0g==" crossorigin="anonymous" referrerpolicy="no-referrer" />
|
|
|
|
<script src="https://code.jquery.com/jquery-3.6.0.min.js" integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4=" crossorigin="anonymous"></script>
|
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<h1><?php echo gettext('View database'); ?></h1>
|
|
|
|
<?php
|
|
|
|
$base = 'db_photo.sqlite3';
|
|
|
|
_pr($_POST);
|
|
/*
|
|
(
|
|
[model] => Canon EOS 7D
|
|
)
|
|
*/
|
|
//if ((isset($_POST)) and (! empty($_POST))) {
|
|
if (! empty($_POST)){
|
|
echo "info dispo";
|
|
$key = key($_POST);
|
|
$val = $_POST["$key"];
|
|
$_POST = array();
|
|
|
|
$page = 1;
|
|
|
|
//echo $key . " - " . $val;
|
|
$req = "SELECT * FROM photos WHERE " . $key . " = '" . $val . "'";
|
|
echo $req;
|
|
|
|
$conn2 = new PDO("sqlite:db_photo.sqlite3");
|
|
$conn2->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
|
|
|
$limit = 13;
|
|
$offset = $limit * ($page -1);
|
|
|
|
$stmt = $conn2->prepare($req);
|
|
//$stmt->execute(array($limit, $offset));
|
|
$stmt->execute();
|
|
|
|
$result = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
|
$rowcount = count($result);
|
|
echo $rowcount;
|
|
|
|
}
|
|
else {
|
|
echo "non dispo";
|
|
}
|
|
|
|
_pr($_POST);
|
|
|
|
echo '<a href="requests.php">requests</a>';
|
|
|
|
|
|
$conn = new PDO("sqlite:db_photo.sqlite3");
|
|
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
|
|
|
$request = array(
|
|
'lens' => 'SELECT DISTINCT lens FROM photos WHERE lens <> "" ORDER BY lens',
|
|
'model' => 'SELECT DISTINCT model FROM photos WHERE model <> "" ORDER BY model',
|
|
'iso' => 'SELECT DISTINCT iso FROM photos WHERE iso <> "" ORDER BY iso',
|
|
'speed' => 'SELECT DISTINCT speed FROM photos WHERE speed <> "" ORDER BY speed',
|
|
'keywords' => 'SELECT DISTINCT keywords FROM photos WHERE keywords <> ""'
|
|
);
|
|
|
|
$select = array();
|
|
$i = 0;
|
|
foreach ($request as $key => $val){
|
|
$query = $conn->query($val);
|
|
$select[$i] = $query->fetchAll(PDO::FETCH_ASSOC);
|
|
$select[$i] = array_column($select[$i],$key);
|
|
if ($i == 4){
|
|
$mc = array();
|
|
foreach($select[$i] as $row){
|
|
$x = explode(",", $row);
|
|
foreach ($x as $y){
|
|
if ((! str_starts_with($y, "_")) && (! str_ends_with($y, "_"))) {
|
|
$mc [] = $y;
|
|
}
|
|
}
|
|
}
|
|
$motcles = array_unique($mc);
|
|
usort($motcles, 'strcasecmp'); // 'strcasecmp'
|
|
$select[$i] = $motcles;
|
|
}
|
|
$i++;
|
|
}
|
|
//_pr($select);
|
|
|
|
/*
|
|
try {
|
|
$query = $conn->query('SELECT DISTINCT lens FROM photos WHERE lens <> "" ORDER BY lens');
|
|
$lens = $query->fetchAll(PDO::FETCH_ASSOC);
|
|
$lens = array_column($lens,'lens');
|
|
|
|
$query = $conn->query('SELECT DISTINCT model FROM photos WHERE model <> "" ORDER BY model');
|
|
$model = $query->fetchAll(PDO::FETCH_ASSOC);
|
|
$model = array_column($model,'model');
|
|
|
|
$query = $conn->query('SELECT DISTINCT iso FROM photos WHERE iso <> "" ORDER BY iso');
|
|
$iso = $query->fetchAll(PDO::FETCH_ASSOC);
|
|
$iso = array_column($iso,'iso');
|
|
|
|
$query = $conn->query('SELECT DISTINCT speed FROM photos WHERE speed <> "" ORDER BY speed');
|
|
$speed = $query->fetchAll(PDO::FETCH_ASSOC);
|
|
$speed = array_column($speed,'speed');
|
|
|
|
$query = $conn->query('SELECT DISTINCT keywords FROM photos WHERE keywords <> ""');
|
|
$keywords = $query->fetchAll(PDO::FETCH_ASSOC);
|
|
$keywords = array_column($keywords,'keywords');
|
|
|
|
$conn = null;
|
|
}
|
|
catch(PDOException $e) {
|
|
echo $e->getMessage();
|
|
}
|
|
|
|
|
|
//_pr($keywords);
|
|
|
|
$mc = array();
|
|
foreach($keywords as $row){
|
|
$x = explode(",", $row);
|
|
foreach ($x as $y){
|
|
if ((! str_starts_with($y, "_")) && (! str_ends_with($y, "_"))) {
|
|
$mc [] = $y;
|
|
}
|
|
}
|
|
}
|
|
|
|
$motcles = array_unique($mc);
|
|
usort($motcles, 'strcasecmp'); // 'strcasecmp'
|
|
|
|
echo count($motcles);
|
|
*/
|
|
/*
|
|
https://www.csscodelab.com/pure-css-custom-select-box-dropdown-styling/
|
|
*/
|
|
?>
|
|
|
|
<div class="myForm">
|
|
<form id="keywordSelect" name="keywordSelect" action="requests.php" method="post" >
|
|
<select name="keyword" id="keyword" class="classic">
|
|
<option value=""><?php echo gettext('keywords'); ?></option>
|
|
<?php
|
|
for( $i = 0; $i < count($select[4]); $i++) {
|
|
echo '<option value="' . $select[4]["$i"] . '">' . $select[4]["$i"] . '</option>';
|
|
}
|
|
?>
|
|
</select>
|
|
<button type="submit" class="myButton">Ok</button>
|
|
</form>
|
|
</div>
|
|
|
|
<div class="myForm">
|
|
<form name="modelSelect" action="requests.php" method="post" >
|
|
<select name="model" id="model" class="classic">
|
|
<option value=""><?php echo gettext('model'); ?></option>
|
|
<?php
|
|
for( $i = 0; $i < count($select[1]); $i++) {
|
|
echo '<option value="' . $select[1]["$i"] . '">' . $select[1]["$i"] . '</option>';
|
|
}
|
|
?>
|
|
</select>
|
|
<button type="submit" class="myButton">Ok</button>
|
|
</form>
|
|
</div>
|
|
<div class="myForm">
|
|
<form name="lensSelect" action="requests.php" method="post" >
|
|
<select name="lens" id="lens" class="classic">
|
|
<option value=""><?php echo gettext('lens'); ?></option>
|
|
<?php
|
|
for( $i = 0; $i < count($select[0]); $i++) {
|
|
echo '<option value="' . $select[0]["$i"] . '">' . $select[0]["$i"] . '</option>';
|
|
}
|
|
?>
|
|
</select>
|
|
<button type="submit" class="myButton">Ok</button>
|
|
</form>
|
|
</div>
|
|
<div class="myForm">
|
|
<form name="isoSelect" action="requests.php" method="post" >
|
|
<select name="iso" id="iso" class="classic">
|
|
<option value=""><?php echo gettext('iso'); ?></option>
|
|
<?php
|
|
for( $i = 0; $i < count($select[2]); $i++) {
|
|
echo '<option value="' . $select[2]["$i"] . '">' . $select[2]["$i"] . '</option>';
|
|
}
|
|
?>
|
|
</select>
|
|
<button type="submit" class="myButton">Ok</button>
|
|
</form>
|
|
</div>
|
|
<div class="myForm">
|
|
<form name="speedSelect" action="requests.php" method="get" >
|
|
<select name="speed" id="speed" class="classic">
|
|
<option value=""><?php echo gettext('speed'); ?></option>
|
|
<?php
|
|
for( $i = 0; $i < count($select[3]); $i++) {
|
|
echo '<option value="' . $select[3]["$i"] . '">' . $select[3]["$i"] . '</option>';
|
|
}
|
|
?>
|
|
</select>
|
|
<button type="submit" class="myButton">Ok</button>
|
|
</form>
|
|
</div>
|
|
|
|
<p class="navPage"><a href="index.php" title="<?php echo gettext("Home"); ?>"><?php echo gettext("Home"); ?></a> | <a href="photo-du-mois.php" title="<?php echo gettext("Picture of the month"); ?>"><?php echo gettext("Picture of the month"); ?></a> | <a href="maps.php" title="<?php echo gettext("Maps"); ?>"><?php echo gettext("Maps"); ?></a> | <a href="admin.php" title="<?php echo gettext("Admin page"); ?>"><?php echo gettext("Admin page"); ?></a></p>
|
|
|
|
<p><em><small>© 2013-<?php echo date('Y'); ?> sur-le-sentier.fr</small></em></p>
|
|
|
|
<script src='lc-lightbox/js/lc_lightbox.min.js' type='text/javascript'></script>
|
|
<script src='lc-lightbox/lib/AlloyFinger/alloy_finger.min.js' type='text/javascript'></script>
|
|
|
|
</body>
|
|
|
|
</html>
|