Counter styling
This commit is contained in:
parent
15b264ded2
commit
fac22f76c6
@ -1,21 +0,0 @@
|
||||
<?php
|
||||
|
||||
include_once "../../../base/settings.php";
|
||||
include_once "../../../base/database.php";
|
||||
include_once "./impl/functions.php";
|
||||
|
||||
$db = DB::openConnection();
|
||||
|
||||
$start = strlen($_SERVER["REQUEST_URI"]) - 256;
|
||||
$siteID = substr($_SERVER["REQUEST_URI"], $start);
|
||||
|
||||
$visitorCount = getHits($siteID, $db);
|
||||
|
||||
addHit($siteID, $db);
|
||||
|
||||
DB::closeConnection($db);
|
||||
|
||||
?>
|
||||
<div>
|
||||
Visitor count: <?= $visitorCount + 1 ?>
|
||||
</div>
|
||||
50
homework/2/counterDB/counter/counter.php
Normal file
50
homework/2/counterDB/counter/counter.php
Normal file
@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
include_once dirname(__FILE__) . "/../../../../base/settings.php";
|
||||
include_once dirname(__FILE__) . "/../../../../base/database.php";
|
||||
include_once dirname(__FILE__) . "/functions.php";
|
||||
|
||||
$db = DB::openConnection();
|
||||
|
||||
$start = strlen($_SERVER["REQUEST_URI"]) - 256;
|
||||
$siteID = substr($_SERVER["REQUEST_URI"], $start);
|
||||
|
||||
$visitorCount = getHits($siteID, $db);
|
||||
|
||||
addHit($siteID, $db);
|
||||
|
||||
DB::closeConnection($db);
|
||||
|
||||
?>
|
||||
|
||||
<style>
|
||||
.span-v3Yq3 {
|
||||
display: inline-block;
|
||||
padding: 6px 6px 4px;
|
||||
border-radius: 3px;
|
||||
background: #cccccc;
|
||||
margin-right: -2px;
|
||||
}
|
||||
|
||||
.center-v3Yq3 {
|
||||
text-align: center;
|
||||
width: 50%;
|
||||
margin: 20px auto;
|
||||
}
|
||||
|
||||
.message-v3Yq3 {
|
||||
color: #aaaaaa;
|
||||
font-size: 12px;
|
||||
}
|
||||
</style>
|
||||
<div>
|
||||
<div class="center-v3Yq3">
|
||||
<?php
|
||||
foreach (mb_str_split(($visitorCount + 1) . "") as $digit) { ?>
|
||||
<span class="span-v3Yq3"><?= $digit ?></span>
|
||||
<?php } ?>
|
||||
</div>
|
||||
<div class="center-v3Yq3 message-v3Yq3">
|
||||
Have visited this site
|
||||
</div>
|
||||
</div>
|
||||
@ -1,5 +1,5 @@
|
||||
<?php
|
||||
include_once "./impl/queries.php";
|
||||
include_once dirname(__FILE__) . "/./queries.php";
|
||||
|
||||
function getHits($id, $db)
|
||||
{
|
||||
@ -10,12 +10,13 @@
|
||||
<body>
|
||||
<?php
|
||||
// PHP
|
||||
include_once "../../../base/settings.php";
|
||||
include_once "../../../base/headers.php";
|
||||
Headers::html();
|
||||
?>
|
||||
This is a dummy test for the database Counter
|
||||
|
||||
<?php include_once "./counter.php" ?>
|
||||
<?php include_once "./counter/counter.php" ?>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@ -98,6 +98,8 @@
|
||||
</div>
|
||||
<?php } ?>
|
||||
</div>
|
||||
|
||||
<?php include_once "../../homework/2/counterDB/counter/counter.php" ?>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
Loading…
x
Reference in New Issue
Block a user