summaryrefslogtreecommitdiff
path: root/www/check.hash.php
diff options
context:
space:
mode:
authorroot2014-04-28 10:12:33 +0200
committerroot2014-04-28 10:12:33 +0200
commitd0857bc2803f3c223d7331c8770aedcbc4b310a2 (patch)
treeb32c74abc12e30ce0176ec9ee5c19d8e1e0089b5 /www/check.hash.php
parent11ed3a4c720d9379beaf7f5770f297677da5d9a7 (diff)
downloadfiles.iamfabulous.de-d0857bc2803f3c223d7331c8770aedcbc4b310a2.tar.gz
Unimportant changes #1
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;
+ }
+}