Start on HW
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
Order deny,allow
|
||||
Deny from all
|
||||
Allow from 127.0.0.1
|
||||
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
include_once "./impl/queries.php";
|
||||
|
||||
function getHits($id, $db)
|
||||
{
|
||||
global $getHitsQuery;
|
||||
$stmt = $db->prepare($getHitsQuery);
|
||||
$stmt->bindValue(":SID", $id);
|
||||
$stmt->execute();
|
||||
$hits = $stmt->fetch(PDO::FETCH_COLUMN);
|
||||
return $hits !== false ? $hits : 0;
|
||||
}
|
||||
|
||||
function addHit($id, $db)
|
||||
{
|
||||
global $setHitsQuery;
|
||||
$stmt = $db->prepare($setHitsQuery);
|
||||
$stmt->bindValue(":SID", $id);
|
||||
$stmt->execute();
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
$getHitsQuery = "
|
||||
SELECT
|
||||
hits
|
||||
FROM
|
||||
Counter
|
||||
WHERE
|
||||
siteID LIKE :SID";
|
||||
|
||||
$setHitsQuery = "
|
||||
INSERT INTO
|
||||
Counter(siteID, hits)
|
||||
VALUES
|
||||
(:SID, 1)
|
||||
ON DUPLICATE KEY UPDATE
|
||||
hits = hits + 1";
|
||||
Reference in New Issue
Block a user