diff options
| -rw-r--r-- | database/README | 1 | ||||
| -rw-r--r-- | www/insertfile.php | 8 | ||||
| -rw-r--r-- | www/setup.php | 1 |
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)){ |
