Skip to content

Commit

Permalink
resetting db, updating form handler to escape data that goes in the d…
Browse files Browse the repository at this point in the history
…b, reports proxy now shows stuff in reverse order
  • Loading branch information
steveklabnik committed Feb 10, 2010
1 parent 1c1a324 commit 2994f8f
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
Binary file modified db/database.sqlite3
Binary file not shown.
1 change: 1 addition & 0 deletions report_form_handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@
$dbhandle = new SQLite3('db/database.sqlite3');
//$dbhandle->exec("CREATE TABLE reports (id INTEGER PRIMARY KEY, date STRING, title STRING, name STRING, location STRING, lat STRING, long STRING, report STRING, link STRING, photo STRING, embed STRING");
//die("INSERT INTO reports (date, title, name, location, lat, long, report, link, photo, embed) values ('{$report['date']}','{$report['title']}','{$report['name']}','{$report['location']}','{$report['latitude']}','{$report['longitude']}','{$report['text']}','{$report['link']}','{$report['image']}','{$report['embed']}'");
$report = array_map("sqlite_escape_string", $report);
$dbhandle->exec("INSERT INTO reports (date, title, name, location, lat, long, report, link, photo, embed) values ('{$report['date']}','{$report['title']}','{$report['name']}','{$report['location']}','{$report['latitude']}','{$report['longitude']}','{$report['text']}','{$report['link']}','{$report['image']}','{$report['embed']}')");

break;
Expand Down
19 changes: 14 additions & 5 deletions services/reports_proxy.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,12 +96,21 @@ function json_encode($a=false)
case "sqlite":
$dbhandle = new SQLite3('../db/database.sqlite3');
$result = $dbhandle->query('SELECT id, date, title, name, location, lat, long, report, link, photo, embed FROM reports');
while ($row = $result->fetchArray(SQLITE3_ASSOC)) {
$array[] = $row;
while ($data = $result->fetchArray(SQLITE3_ASSOC)) {
$reports['id']=$data['id'];
$reports['date']=$data['date'].'';
$reports['title']=$data['title'].'';
$reports['name']=$data['name'].'';
$reports['location']=$data['location'].'';
$reports['lat']=$data['lat'].'';
$reports['long']=$data['long'].'';
$reports['report']=$data['report'].'';
$reports['link']=$data['link'].'';
$reports['photo']=$data['photo'].'';
$reports['embed']=$data['embed'].'';
$array[]=$reports;
}
//foreach ($result as $entry) {
//echo 'Name: ' . $entry['name'] . ' E-mail: ' . $entry['email'];
//}
$array = array_reverse($array);
break;

}
Expand Down

0 comments on commit 2994f8f

Please sign in to comment.