diff options
| author | Horus3 | 2014-02-25 19:20:09 +0100 |
|---|---|---|
| committer | Horus3 | 2014-02-25 19:20:09 +0100 |
| commit | aca3a7a20547aaee220300b570d070e4c6fe9869 (patch) | |
| tree | e756f3cc57d3eba1c55808acdcdf9337bca76a71 | |
| parent | de391af1ff6695bd5bf52d08bd4b1512cfc524b3 (diff) | |
| parent | f254f1553d06953083c66620c6257682355064d1 (diff) | |
| download | random-aca3a7a20547aaee220300b570d070e4c6fe9869.tar.gz | |
Merge branch 'master' of git.iamfabulous.de:random
| -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)){ |
