You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: index.php
+16-16Lines changed: 16 additions & 16 deletions
Original file line number
Diff line number
Diff line change
@@ -212,7 +212,7 @@ function search($s='') {
212
212
foreach ($was &$wi) {
213
213
$wi = "(name LIKE '%".$c->real_escape_string($wi)."%' OR form LIKE '%".$c->real_escape_string($wi)."%' OR comments LIKE '%".$c->real_escape_string($wi)."%') ";
214
214
}
215
-
$q = "SELECT id, name, form FROM ".$_SESSION['dbprefix']."people WHERE ". implode(' AND ', $w) ."ORDER BY name ASC LIMIT 0, 50";
215
+
$q = "SELECT `id`, `name`, `form` FROM `".$_SESSION['dbprefix']."people` WHERE ". implode(' AND ', $w) ." ORDER BY `name` ASC LIMIT 0, 50";
216
216
$people = db($q, $c);
217
217
218
218
foreach($peopleas &$person) {
@@ -247,9 +247,9 @@ function get($detail) {
247
247
}else{
248
248
global$c;
249
249
if (is_numeric($detail)) {
250
-
$people = db("SELECT * FROM ".$_SESSION['dbprefix']."people WHERE id = ".$c->real_escape_string($detail)." LIMIT 1", $c);
250
+
$people = db("SELECT * FROM `".$_SESSION['dbprefix']."people` WHERE `id` = '".$c->real_escape_string($detail)."' LIMIT 1;", $c);
251
251
}else{
252
-
$people = db("SELECT * FROM ".$_SESSION['dbprefix']."people WHERE name LIKE '%".$c->real_escape_string($detail)."%' OR form LIKE '%".$c->real_escape_string($detail)."%' ORDER BY updated DESC LIMIT 1", $c);
252
+
$people = db("SELECT * FROM `".$_SESSION['dbprefix']."people` WHERE `name` LIKE '%".$c->real_escape_string($detail)."%' OR `form` LIKE '%".$c->real_escape_string($detail)."%' ORDER BY `updated` DESC LIMIT 1;", $c);
253
253
}
254
254
if ($people) {
255
255
$people = $people[0];
@@ -297,12 +297,12 @@ function save() {
297
297
}
298
298
//var_dump($array);
299
299
if ($_POST['id']) { // update details
300
-
$q = "UPDATE ".$_SESSION['dbprefix']."people SET
301
-
form = '".$c->real_escape_string(json_encode($array))."',
302
-
name = '".$c->real_escape_string($_POST['name'])."',
303
-
`updated` = '".time()."' WHERE id = ".($_POST['id']).";";
300
+
$q = "UPDATE `".$_SESSION['dbprefix']."people` SET
$q = "UPDATE ".$_SESSION['dbprefix']."people SET comments = '".$c->real_escape_string(json_encode($comments))."' WHERE id = ".$c->real_escape_string($_POST['id'])."";
398
+
$q = "UPDATE `".$_SESSION['dbprefix']."people` SET `comments` = '".$c->real_escape_string(json_encode($comments))."' WHERE `id` = '".$c->real_escape_string($_POST['id'])."';";
399
399
$result = db($q, $c);
400
400
401
401
if ($result) {
@@ -419,7 +419,7 @@ function commentdelete($id) {
419
419
}else{
420
420
global$c;
421
421
// load comments from person
422
-
$person = db("SELECT id,comments FROM ".$_SESSION['dbprefix']."people WHERE comments LIKE '%".$c->real_escape_string($id)."%' ORDER BY updated DESC LIMIT 1", $c);
422
+
$person = db("SELECT `id`, `comments` FROM `".$_SESSION['dbprefix']."people` WHERE `comments` LIKE '%".$c->real_escape_string($id)."%' ORDER BY `updated` DESC LIMIT 1;", $c);
0 commit comments