# HG changeset patch # User peter # Date 1199550349 0 # Node ID ce1c4d5e1576e693a19717f5daa0832cde3e02ee # Parent dab0e9deeb67e356ae0ca4ab226c5843a69e6e45 [feladat @ 112] Added better support of the PEAR:MDB2 package by using the setLimit() function instead of adding a LIMIT to the query itself and by using the quote() function to quote all parameters. Added an error when no valid email address was given when creating or modifying a user. diff -r dab0e9deeb67 -r ce1c4d5e1576 delete_record.php --- a/delete_record.php Thu Jan 03 23:04:46 2008 +0000 +++ b/delete_record.php Sat Jan 05 16:25:49 2008 +0000 @@ -28,7 +28,8 @@ error(ERR_RECORD_ACCESS_DENIED); } if ((!level(5)) && ($_SESSION[$zoneId.'_ispartial'] == 1)) { - $checkPartial = $db->queryOne("SELECT id FROM record_owners WHERE record_id='".$_GET["id"]."' AND user_id='".$_SESSION["userid"]."' LIMIT 1"); + $db->setLimit(1); + $checkPartial = $db->queryOne("SELECT id FROM record_owners WHERE record_id=".$db->quote($_GET["id"])." AND user_id=".$db->quote($_SESSION["userid"])); if (empty($checkPartial)) { error(ERR_RECORD_ACCESS_DENIED); } diff -r dab0e9deeb67 -r ce1c4d5e1576 delete_user.php --- a/delete_user.php Thu Jan 03 23:04:46 2008 +0000 +++ b/delete_user.php Sat Jan 05 16:25:49 2008 +0000 @@ -102,7 +102,7 @@ } $message = _('You are going to delete this user, are you sure?'); - if(($numrows = $db->queryOne("select count(id) from zones where owner=$id")) != 0) + if(($numrows = $db->queryOne("SELECT count(id) FROM zones WHERE owner=".$db->quote($id))) != 0) { $message .= " " . _('This user has access to ') . $numrows . _(' zones, by deleting him you will also delete these zones.'); } diff -r dab0e9deeb67 -r ce1c4d5e1576 edit.php --- a/edit.php Thu Jan 03 23:04:46 2008 +0000 +++ b/edit.php Sat Jan 05 16:25:49 2008 +0000 @@ -28,7 +28,7 @@ $recordOwnerError = 'No records where selected to assign an sub-owner.'; } else { foreach ($_POST["rowid"] as $x_user => $recordid){ - $x_userid = $db->queryOne("SELECT id FROM record_owners WHERE user_id = '".$_POST["userid"]."' AND record_id='".$recordid."'"); + $x_userid = $db->queryOne("SELECT id FROM record_owners WHERE user_id = ".$db->quote($_POST["userid"])." AND record_id=".$db->quote($recordid)); if (empty($x_userid)) { add_record_owner($_GET["id"],$_POST["userid"],$recordid); } @@ -300,7 +300,7 @@ ?> query("SELECT r.user_id,u.username,u.fullname FROM record_owners as r, users as u WHERE r.record_id='".$r['id']."' AND u.id=r.user_id"); + $x_result = $db->query("SELECT r.user_id,u.username,u.fullname FROM record_owners as r, users as u WHERE r.record_id=".$db->quote($r['id'])." AND u.id=r.user_id"); echo "