style body white-space nowrap line-height white-space nowrap font-size

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
<style>
body {
white-space:nowrap;
line-height: 0
}
.c {
white-space:nowrap;
font-size:0;
}
.c img
white-space:nowrap;
padding:0;
margin:0;
border:0;
}
</style>
<?php
ob_start();
$db = new PDO('mysql:host=localhost;dbname=sword', 'root', '');
/*
$sword = [
'id' => 1,
'slot' => [1 => 'sword.png', 3 => 'sword2.png'],
'count' => 2,
'name' => 'Медный, ска, меч',
'symbol' => '>',
'time' => [time(), time() - 3600]
];
*/
if(isset($_GET['slot'])){
$_sword = $db -> prepare('SELECT * FROM `sword` WHERE (`slot` = ? OR `slot` = ?) LIMIT 1');
$_sword -> execute([$_GET['slot'], ($_GET['slot'] - 3)]);
$sword = $_sword -> fetch();
if ($sword or $_GET['slot'] < 1 or $_GET['slot'] > 9){
header('Location:/');
exit;
}
else for($i>0; $i<2; ++$i){
$__slot = $db->prepare('INSERT INTO `sword` SET `user` = ?, `sword` = ?, `slot` = ?, `img` = ?');
$__slot->execute([1, 3, ($i == 1 ? $_GET['slot'] : ($_GET['slot'] - 3)), 'sword'.($i+1)]);
}
}
if(isset($_GET['slotl'])){
$_sword = $db -> prepare('SELECT * FROM `sword` WHERE (`slot` = ? OR `slot` = ?) LIMIT 1');
$_sword -> execute([$_GET['slotl'], ($_GET['slotl'] - 1)]);
$sword = $_sword -> fetch();
if ($sword or $_GET['slotl'] < 1 or $_GET['slotl'] > 9){
header('Location:/');
exit;
}
else for($i>0; $i<2; ++$i){
$__slot = $db->prepare('INSERT INTO `sword` SET `user` = ?, `sword` = ?, `slot` = ?, `img` = ?');
$__slot->execute([1, 3, ($i == 1 ? $_GET['slotl'] : ($_GET['slotl'] - 1)), 'swordl'.($i+1)]);
}
}
echo '
<div class="c">
';
foreach([1,2,3,4,5,6,7,8,9] as $slot=>$val){
$_sword = $db -> prepare('SELECT * FROM `sword` WHERE `user` = ? AND `slot` = ? LIMIT 1');
$_sword -> execute([1,$val]);
$sword = $_sword -> fetch();
$lal = ($sword['slot'] ? '
<img src="'.$sword['img'].'.png" />
' : (($sword['slot'] - 3) ? '
<a href="?slot='.$val.'">
<img src="bg.png" />
</a>
':'
<img src="bg.png" />
'));
echo (($slot%3)==0 ? '
<br />
'.$lal : $lal);
}
echo '
</div>
';
CREATE TABLE IF NOT EXISTS `sword` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`user` int(11) NOT NULL,
`sword` int(11) NOT NULL,
`slot` varchar(11) NOT NULL,
`img` varchar(22) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=82 ;
--
-- Дамп данных таблицы `sword`
--
INSERT INTO `sword` (`id`, `user`, `sword`, `slot`, `img`) VALUES
(1, 1, 1, '1', 'sword1'),
(2, 1, 1, '4', 'sword2'),
(3, 1, 2, '2', 'sword1'),
(4, 1, 2, '5', 'sword2'),
(73, 1, 3, '3', 'sword1'),
(74, 1, 3, '6', 'sword2'),
(78, 1, 3, '7', 'swordl1'),
(79, 1, 3, '8', 'swordl2');