simplify user deletion

This commit is contained in:
Andrew Dolgov 2009-01-20 15:26:24 +01:00
parent d404ae81a5
commit ec800fe1f2
1 changed files with 7 additions and 7 deletions

View File

@ -212,21 +212,21 @@
} }
} else if ($subop == "remove") { } else if ($subop == "remove") {
if (!WEB_DEMO_MODE && $_SESSION["access_level"] >= 10) { if ($_SESSION["access_level"] >= 10) {
$ids = split(",", db_escape_string($_GET["ids"])); $ids = split(",", db_escape_string($_GET["ids"]));
foreach ($ids as $id) { foreach ($ids as $id) {
db_query($link, "BEGIN"); if ($id != $_SESSION["uid"]) {
db_query($link, "DELETE FROM ttrss_feeds WHERE owner_uid = '$id' AND owner_uid != " . $_SESSION["uid"]); db_query($link, "DELETE FROM ttrss_tags WHERE owner_uid = '$id'");
db_query($link, "DELETE FROM ttrss_users WHERE id = '$id' AND id != " . $_SESSION["uid"]); db_query($link, "DELETE FROM ttrss_feeds WHERE owner_uid = '$id'");
db_query($link, "COMMIT"); db_query($link, "DELETE FROM ttrss_users WHERE id = '$id'");
}
} }
} }
} else if ($subop == "add") { } else if ($subop == "add") {
if (!WEB_DEMO_MODE && $_SESSION["access_level"] >= 10) { if ($_SESSION["access_level"] >= 10) {
$login = db_escape_string(trim($_GET["login"])); $login = db_escape_string(trim($_GET["login"]));
$tmp_user_pwd = make_password(8); $tmp_user_pwd = make_password(8);