summaryrefslogtreecommitdiff
path: root/blob/insertfile.php
diff options
context:
space:
mode:
authorroot2014-09-13 22:26:58 +0200
committerroot2014-09-13 22:26:58 +0200
commitc5639ee890215e4e8e0f544821ea8d285ca58eb8 (patch)
tree29f685943c61c4d7ec0e376e485686e985b97065 /blob/insertfile.php
parentf8c60cae423fc78ed21d17a9217716ccc1e6dab1 (diff)
downloadvideo-dl-c5639ee890215e4e8e0f544821ea8d285ca58eb8.tar.gz
init
Diffstat (limited to 'blob/insertfile.php')
-rw-r--r--blob/insertfile.php41
1 files changed, 41 insertions, 0 deletions
diff --git a/blob/insertfile.php b/blob/insertfile.php
new file mode 100644
index 0000000..d098223
--- /dev/null
+++ b/blob/insertfile.php
@@ -0,0 +1,41 @@
+<?php
+
+$dic = "en_GB.dic";
+$table = "english";
+
+//$dic = "../blob/wordlist_german.txt";
+//$table = "german";
+
+$bool = false;
+
+$db = new SQLite3("db/dict.db");
+//$db = new SQLite3("dict.db");
+
+
+if($file = file($dic)){
+
+ $rows = count($file);
+ for($i=0;$i<$rows;$i++){
+
+ $file[$i] = preg_replace("/\/(.*)$/", "", $file[$i]);
+// echo "#" . $i . ": " . $file[$i] . "<br>";
+
+ if(!$db->exec("
+ BEGIN TRANSACTION;
+ INSERT INTO " . $table . " VALUES (NULL, \"" . $file[$i] . "\");
+ COMMIT;
+ ")){
+ echo "Failure writing to the database at row" . $i ."!";
+ $bool = true;
+ break;
+ }
+
+ }
+
+ if(!$bool){
+ echo "Successfull transfered the file into the database.";
+ }
+
+} else {
+ echo "No file found!";
+}