summaryrefslogtreecommitdiff
path: root/www/check.hash.php
diff options
context:
space:
mode:
Diffstat (limited to 'www/check.hash.php')
-rw-r--r--www/check.hash.php35
1 files changed, 35 insertions, 0 deletions
diff --git a/www/check.hash.php b/www/check.hash.php
new file mode 100644
index 0000000..2149355
--- /dev/null
+++ b/www/check.hash.php
@@ -0,0 +1,35 @@
+<?php
+
+$db = new SQLite3("../database/sqlite.db");
+
+//$hash_db = $db->query("SELECT count(hash) FROM (SELECT DISTINCT hash FROM files WHERE folder='FILE')");
+$hash_db = $db->query("SELECT hash FROM (SELECT DISTINCT hash FROM files WHERE folder='FILE')");
+$file_name = array_diff(scandir("../files/"), array(".", "..", "README"));
+$ar_key = array_keys($file_name);
+$file = array();
+
+$cnt=0;
+
+while($hash_ar = $hash_db->fetchArray(SQLITE3_NUM)){
+ $res[$count] = $hash_ar[0].".gz";
+ $count++;
+}
+
+echo "Checking for leftover hashs in dir... <br>";
+for($i=0;$i<count($ar_key); $i++){
+ if(!in_array($file_name[$ar_key[$i]], $res)){
+ $file[$cnt] = $file_name[$ar_key[$i]];
+ $cnt++;
+ }
+}
+
+var_dump($file);
+
+echo "<br><br> Checking for leftover hashs in database... <br>";
+
+foreach($file_name as $file){
+ if(!in_array($res, $file)){
+ echo "<br>";
+ echo $file;
+ }
+}