summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHorus32014-02-25 19:20:09 +0100
committerHorus32014-02-25 19:20:09 +0100
commitaca3a7a20547aaee220300b570d070e4c6fe9869 (patch)
treee756f3cc57d3eba1c55808acdcdf9337bca76a71
parentde391af1ff6695bd5bf52d08bd4b1512cfc524b3 (diff)
parentf254f1553d06953083c66620c6257682355064d1 (diff)
downloadrandom-aca3a7a20547aaee220300b570d070e4c6fe9869.tar.gz
Merge branch 'master' of git.iamfabulous.de:random
-rw-r--r--database/README1
-rw-r--r--www/insertfile.php8
-rw-r--r--www/setup.php1
3 files changed, 9 insertions, 1 deletions
diff --git a/database/README b/database/README
new file mode 100644
index 0000000..10ca50c
--- /dev/null
+++ b/database/README
@@ -0,0 +1 @@
+# Do nothing here, use setup.php to create the database.
diff --git a/www/insertfile.php b/www/insertfile.php
index 5e07130..8053eb5 100644
--- a/www/insertfile.php
+++ b/www/insertfile.php
@@ -7,19 +7,25 @@ $bool = false;
$db = new SQLite3("../database/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] . ");
+ INSERT INTO " . $table . " VALUES (NULL, \"" . $file[$i] . "\");
COMMIT;
")){
echo "Failure writing to the database at row" . $i ."!";
$bool = true;
break;
}
+
}
if(!$bool){
diff --git a/www/setup.php b/www/setup.php
index a4ab123..9158353 100644
--- a/www/setup.php
+++ b/www/setup.php
@@ -1,6 +1,7 @@
<?
$db = new SQLite3("../database/dict.db");
+$bool = false;
foreach ($_GET as $name => $value) {
if(preg_match("/drop(ped)?/i",$name)){