Initial commit

This commit is contained in:
M. Gardner 2019-07-26 21:05:19 +03:00
commit a70d09915f
8 changed files with 96 additions and 0 deletions

7
add_image.sh Executable file
View File

@ -0,0 +1,7 @@
#!/bin/bash
printf -v file "%q" "$1"
printf -v title "%q" "$2"
printf -v hover "%q" "$3"
mysql -u web -e"SET @file '$file'; SET @title '$title'; SET @hover '$hover';" < add_image.sql

2
add_image.sql Normal file
View File

@ -0,0 +1,2 @@
USE web
INSERT INTO comics (file,title,hover) VALUES ('@file','@title','@hover')

18
css/style.css Normal file
View File

@ -0,0 +1,18 @@
tr {
display: flex;
flex-direction: row;
justify-content: space-between; }
a img {
width: 32px;
transition: all 0.2s; }
a img:hover {
width: 64px; }
#comic {
margin: 0 auto; }
.strip {
width: 512px; }
/*# sourceMappingURL=style.css.map */

7
css/style.css.map Normal file
View File

@ -0,0 +1,7 @@
{
"version": 3,
"mappings": "AAAA,EAAG;EACC,OAAO,EAAC,IAAI;EACZ,cAAc,EAAE,GAAG;EACnB,eAAe,EAAE,aAAa;;AAI9B,KAAG;EACC,KAAK,EAAC,IAAI;EACV,UAAU,EAAE,QAAQ;EACpB,WAAO;IACH,KAAK,EAAE,IAAI;;AAIvB,MAAO;EACH,MAAM,EAAE,MAAM;;AAGlB,MAAO;EACH,KAAK,EAAC,KAAK",
"sources": ["style.scss"],
"names": [],
"file": "style.css"
}

22
css/style.scss Normal file
View File

@ -0,0 +1,22 @@
tr {
display:flex;
flex-direction: row;
justify-content: space-between;
}
a{
img{
width:32px;
transition: all 0.2s;
&:hover{
width: 64px;
}
}
}
#comic {
margin: 0 auto;
}
.strip {
width:512px;
}

27
index.php Normal file
View File

@ -0,0 +1,27 @@
<?php
require "setup.php";
if(is_null($comic)){
$comic=0;
die("comic is null");
}
?><!DOCTYPE html>
<html>
<head>
<link href="css/style.css" rel="stylesheet"/>
<title>
<?php $comic["title"]?>
</title>
</head>
<table id=comic>
<tr><td colspan=5>
<img class=strip title=<?php echo "\"${comic["hover"]}\"";?> src=<?php echo "\"${comic["file"]}\""?> /></td>
</tr>
<tr>
<td><a href=index.php?id=0><img title="first comic" src="images/first.png"></a></td>
<td><a href=index.php?id=<?php echo $id-1?>><img title="previous comic" src=images/prev.png></a></td>
<td></td>
<td><a href=index.php?id=<?php echo $id+1?>><img title="next comic" src=images/next.png></a></td>
<td><a href=index.php ><img title="latest comic" src="images/latest.png" ></a></td>
</tr>
</table>
</html>

13
setup.php Normal file
View File

@ -0,0 +1,13 @@
<?php
$id=0;
if(!is_null($_GET["id"]) and is_numeric($_GET["id"])){
$id=$_GET["id"];
}
$msql=new mysqli('localhost','web','','web');
if($msql->connect_errno){
die("connection error: ".$msql->connect_error);
}
$string="SELECT id,file,title,hover FROM comics ORDER BY CASE WHEN (id='$id') THEN 0 ELSE 1 END, id DESC";
$qry=$msql->query($string) or die($msql->error);
$comic=$qry->fetch_assoc();
?>