diff --git a/homework/2/counterDB/counter.php b/homework/2/counterDB/counter.php new file mode 100644 index 0000000..bf690ec --- /dev/null +++ b/homework/2/counterDB/counter.php @@ -0,0 +1,21 @@ + +
+ Visitor count: +
\ No newline at end of file diff --git a/homework/2/counterDB/impl/.htaccess b/homework/2/counterDB/impl/.htaccess new file mode 100644 index 0000000..872a3ce --- /dev/null +++ b/homework/2/counterDB/impl/.htaccess @@ -0,0 +1,3 @@ +Order deny,allow +Deny from all +Allow from 127.0.0.1 \ No newline at end of file diff --git a/homework/2/counterDB/impl/functions.php b/homework/2/counterDB/impl/functions.php new file mode 100644 index 0000000..00c0f57 --- /dev/null +++ b/homework/2/counterDB/impl/functions.php @@ -0,0 +1,20 @@ +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(); +} diff --git a/homework/2/counterDB/impl/queries.php b/homework/2/counterDB/impl/queries.php new file mode 100644 index 0000000..a0b609e --- /dev/null +++ b/homework/2/counterDB/impl/queries.php @@ -0,0 +1,16 @@ + + + + + + + Counter DB Tester + + + + + This is a dummy test for the database Counter + + + + + \ No newline at end of file